Beruflich Dokumente
Kultur Dokumente
Final Report
Project Title
Test board for stepper motor
Project Team Name
Touch The Sky
All graces belong to the Almighty alone. Without His grace and blessing, this project
would not have succeeded achieving the objective of the project. We would like to take
this opportunity to express our sincere gratitude to all those who have contributed in
completing this project. Firstly, our sincere thanks goes to our project design’s client
Mr. Tee Zee Wei for his professional ideas and constant attention throughout the
project design . It has been a privilege to work under him as our client .
We also appreciate the efforts and numerous suggestions of Mr. Liau Chung
Fan, to improve the performance of the project. We would like to extend our sincere
appreciation to the ROBOCON team for lending us to use the laboratory and for helped
us to further our step in doing this project by providing facilities and technical help
throughout the project.
Our product is Test Board for Stepper Motor. The main purpose of designing this
product is for educational kit for a university student. However to make the learning
process more interesting, we design the test board for the stepper motor in the form of
car control. The main component of this product is stepper motor, PIC microcontroller,
encoder and LCD (liquid crystal display). Moreover to control the car control we are
using wireless remote by radio frequency.
The car is built with three wheels. For this product we only used one stepper
motor and it only control one wheel of the car and the other two wheels is used to
stabilize the car. It means that our car only can run forward and backward. Since our
purpose of design this project is for educational kit, we ignore the car control problems
to turn left or right.
In technically, we are design circuit by referring to the books, internet and also
by our own idea. Then we are using Proteus 7 professional to design the complete
circuit. Moreover to interface PIC with the stepper motor and LCD, we are using C
programming. The complete program is simulated in the MPLAB IDE v8.10 and it is
transfer to the PIC using PICkit V2.55 program.
There are many experiments we are doing in a process of building this product.
We are dividing our product into several technical parts such as encoder, LCD, speed
control, remote control and also radio frequency. Each of the part is experimented
separately and any changing will be done due to the time.
The stepper motor will be control by a remote control using radio frequency. The
input will be send directly to the microcontroller and microcontroller will send the data
to the motor drive. Therefore the motor drive will drive the motor. The output of the
motor will be send to the encoder to calculate the speed and from the encoder, the
speed will display to the LCD to display the output.
However there are many difficulties occur while doing the experiment for this
product. From the experiment we already done, we have to cancel some part in our
product. We found that we cannot use radio frequency to interface remote control with
the stepper motor. This is because there are some problem occurs while test our radio
frequency. Radio frequency has a problem to receive a data if in the same range of our
place there a same frequency is used. Noise from surrounding really can affect data
transferring. Therefore it will lag the time for the product to functioning.
Beside radio frequency, we also have to cancel our encoder part. This is because
we broke our encoder while test this part. Moreover it is hard to program the encoder.
Therefore we decide to cancel this part and find other solution to replace it.
As a solution for our failure in our process making this product, we replace the
part we already cancel with other method. For the problem of our radio frequency we
replace it with wire. We interface our remote control and stepper motor with a wire.
Therefore there no more wireless remote control. The main purpose we are changing
this part to wire is our product is about to test the stepper motor and if we get a
problem to send an input to the stepper motor, our product will totally fail. So by using
wire the input can be send to the stepper motor without any problem. Even this method
is not high technology, but we have to realize that it is more important to make the
stepper motor working and we have to ignore the wireless.
In addition of the solution, we replace the encoder with the PIC. Since the
function of the encoder is to calculate the speed of the stepper motor and the output
the data to display on the LCD screen, we decide to use PIC to calculate the speed.
Therefore we write C program to the PIC to calculate the data. In this case we produce
one formula to calculate the speed and put it to the program. So, the output of the
stepper motor will be calculated at PIC and send straightly to the LCD to display.
In conclusion of our finding in our process of making our product, we are really
recommended that this project to take an additional research for future because with
an additional research, this product could be improve and the quality can be increases.
List of figures
CHAPTER 1
CHAPTER 3
Figure 3.4: Design of PCB layout using Proteus ( Circuit inside the remote
control)…………………………………………………………………………………………………….….17
Figure 3.5 : Design of PCB layout using Proteus ( Circuit inside the racing
car)……………………………………………………………………………………………………..……...17
Figure 3.8 : Location of Dual Full Bridge and Free Wheeling Diode in the motor
driver……………………………………………………………………………………………………….....19
CHAPTER 4
CHAPTER 2
CHAPTER 3
CHAPTER 4
Table 4.7a : Shows the result of the movement of the car at flat road.……………48
Table 4.7b : Shows the car movement result when run up the 300 hill……………49
Chapter 1
INTRODUCTION
1.1 Background
Stepper motor filled a unique niche in the motor control world. These motors
are mainly used in measurement and control applications. Sample applications include
ink jet printers, CNC machines and volumetric pumps. Several features common to all
stepper motors make them ideally suitable for these types of applications. Stepper
motors are brushless. The commutator and brushes of conventional motor are some of
the most failure prone components and they create electrical arcs that are undesirable
or dangerous in some environments. Stepper motor also will not turn at a speed
regardless of a load as long as the load does not exceed the torque rating of the motor.
Open loop position of stepper motors move in quantified increments of steps. Holding
torque characteristic is able to hold the shaft stationary. Stepper Motors come in a
variety of sizes, and strengths, from tiny floppy disk motors, to huge machinery
steppers. There are two basic types of stepper motors, bipolar and unipolar. The
unipolar stepper has 4 wires. Bipolar steppers have 5,6 or 8 wires.
Unipolar Stepper motor has 2 coils, simple lengths of wound wire. The coils are
identical and are not electrically connected. Each coil has a center tap - a wire coming
out from the coil that is midway in length between its two terminals. If the terminals of
a coil are connected, the shaft becomes harder to turn. Because of the long length of
the wound wire, it has a significant resistance (and inductance). The resistance from a
terminal to the center tap is half the resistance from the two terminals of a coil. Coil
resistance of half a coil is usually stamped on the motor. Figure 1.1 shows the cross
section of a stepper unipolar motor. Motor winding number 1 is distributed between the
top and bottom of stator poles, while motor winding 2 of stepper motor is distributed
between left and right of the stator poles. The rotor is permanent magnet with six
poles, three north and three south.
The Bipolar Stepper motor is very similar to the unipolar Stepper except that the
motor coils lack center taps. Because of this, the Bipolar motor requires a different
type of controller, one that reverses the current flow through the coils by alternating
polarity of the terminals. The advantage to not having a center taps is that the current
runs through entire windings at a time instead just half the windings. As a result bipolar
motor produce more torque that unipolar motor. The draw back of bipolar motors, that
more complex control circuitry is required by bipolar motor. Current flow in bipolar
motor is bidirectional. This requires changing of polarity of each end of the windings. A
control circuit known as H-bridge is used to change the polarity on the end of the
windings.
The conceptual design is used as education kit for technical college especially for
engineering courses to educate them about stepper motor by applying in remote
control car. Basically it can apply to applied mechanic technical lab kit which can
calculate the speed motion of remote car controller. The racing car can control the
speed and show the speed value in the same time. For this design, the remote control
work as test board for control decided speed value and the LCD display showing the
control car moving speed. In this project, three different types of motors that are
bipolar stepper motor, unipolar stepper motor and DC motor. The main reason to use
different motors is to differentiate the functionality of each motor.
1.3 Objective
The objective of the project can be expressed from two prospects; they are from
project prospect and the individual prospect.
The objective of the project from the prospect of the project itself is to develop a
remote control car by using stepper motor. The development process covers the
designing process, fabrication and testing of the whole car controller and speed display
circuit. The designing process is the mechanical designing of the car structure and the
designing of the car speed controller and speed display circuitry. The fabricated
mechanical design will be tested to proof the performance level of the stepper motor.
From the individual prospect, the objective of the project is to improve the
designing, planning and analytical skills in examining the performance and relevance of
an idea from the scope of engineering field. On the other hand, throughout this project,
we gain valuable experience in designing a new product and would also gain deeper
understanding in microcontroller interfacing.
1.4 Problems with current method and new approach.
The educational kit with current method is only testing the speed of stepper
motor. Actually there are many advantages of stepper motor compared to the DC
motor. In the design, we are specifically testing the speed of stepper motor and the
grip braking of stepper motor. Steppers have very good holding torque. Steppers are
can hold a position (to a lesser degree) without power applied, using magnetic 'detent'
torque. Furthermore, we also included the test to differentiate between bipolar and
unipolar motor. Current method also not sufficient to the students as it is hard to
handle and not attractive.
New approach that we implemented in our design is testing the holding torque of
stepper motor. We built three different cars which are using bipolar, unipolar and DC
motor and tested simultaneously to differentiate the characteristic of holding torque of
each motor. To make our design attractive, we implemented the motors in racing cars.
Chapter 2
The primary or main function of this project is to do a test board for the stepper
motor. The test board for the stepper motor should be able to control the speed of
stepper motor and display the speed. The new approach that we introduced in the
design is the stepper motor used is implemented in the racing car. The racing car
used as educational kit mainly for engineering students. Furthermore, we built two
sets of racing car which is using bipolar and unipolar motor to see the differences
between these two motors.
In our proposed design, we used stepper motor is to compare the stepper motor
speed with DC motor. The car controlled by remote control using RF (radio
frequency) signal. When the car moves, encoder detect the rotation speed of
stepper motor and the information send to the microcontroller 1. This
microcontroller 1 calculates the speed and sends the information to the transmitter.
All these circuitry mechanisms are built in the racing car. The transmitter transmits
the information to the receiver which is embedded in the user’s car remote. The
speed of the car displayed to the user’s remote controller. The second mechanism
that we proposed is speed car controller. Variable resistance used as the speed car
controller which built in the remote controller. Information from the variable
resistance sent to the microcontroller 2 to calculate the speed of stepper motor that
should be. Microcontroller 2 is in the user’s remote controller. Transmitter transmits
the data to the receiver and receiver receives the signal and sends to the motor.
Stepper motor speed is controlled. In the proposed design, we used bidirectional of
signals which is from racing car to remote controller and vice versa.
2.2 Fast Diagram
The development of the mass capacitive sensor involves research, step by step.
The steps are affected by other factors, which cause some delay in certain cases. Each
of the steps was planned well before proceed and sometimes interfere between each
another occurred due to speed up the process especially in the cases where delay
happened. Table 1 shows the overall flow of the project. The steps involved are
elaborated briefly:
:
The first step that has been taken is the understanding of the title of the project.
Research has been carried out on the papers, journals, books and Internet resources to
create a strong background on the related topics involved in the project. The research
conducted about the definition of stepper motor, microcontroller technology, stepper
motor types (bipolar and unipolar specifically), motor performance characteristics, and
the application of the stepper motor. This step also involved the complete
understanding of the general view of the project’s scope.
After understanding the project topic, the next step taken is designing process of
the stepper motor test driver. Few designs have been discussed and come up with the
final idea of the design of the circuit. The limitation of the stepper motor usage is the
main aspect. Then, the proposed hardware design, sent to fabricate.
The designing process has been continued with the design and testing of the
circuit. The circuit tested using simulation software before practical test conducted. The
complete analysis carried on the fabricated circuit to find the sensitivity, accuracy and
the difference in between the theoretical and practical response of the circuit, besides
understanding the problems that could happen in circuit part. This step has been
conducted while waiting for the hardware part ( body of the car ) to be fabricated.
After finish testing the circuit part, a complete testing conducted on the mass
capacitive sensor. This testing is the most important element that determines the
performance of the whole system. Graphical analysis has been used as a major
component of the testing process.
2.4 Gantt Chart
The technical gantt chart was developed at the beginning of the project as a
project management plan for the team. At the beginning of the project, our team was
very slow in progress. We are lagging of a week as we should be. We are lack of ideas
and information on how to start the project. As developing the project, many ideas
came through as well as the problems. We manage go through the problem by doing
some modification to the design. At the end of the project, progress in our team is
satisfied. We are back to schedule as we expected should be. The conclusion is, we
manage to follow the management time plan even though, we lag by a week at the
beginning of the project.
Budgets are difficult but essential tools for project management. They permit
teams to identify the financial and other resources required, and to match those
requirements to the available resources. Budgets also require teams to account for
project monies. Finally, budgets serve to formalize the support of the larger
organization from which is drawn. Design project budgets normally include research
expenses, materials for prototypes and support expenses related to the project. The
table below is showing our estimated budgets:
3.1 Design
Building the control car consist of two main parts, hardware and software.
Hardware part includes the circuitry design and constructing the car body. Software
part includes developing a program to the microcontroller. Two cars was build in the
project, unipolar stepper motor and bipolar stepper motor.
3.1.1 Hardware
a) Power supply
The circuitry of the project design needs 5V power supply to work. The design
that we made is moveable racing car, so power supply from the adapter is not the
acceptable solution because the range of the racing car movement will be limited. In
the design, 12V battery is used. One of the batteries is for backup as the power decays
in the used battery. The batteries used are seal lead acid battery. Voltage from the
supplied battery will be regulated by voltage regulator to 5V and supplied to the
circuit. A LED indicator was placed in the circuit to indicate the required power supply,
supplies the amount of voltage needed. In the design, there are two voltage regulator
used, each for microcontrollers. The microcontrollers located at the racing car and
user’s remote controller. A large amount of power supply will burn the microcontroller.
b) Circuitry
c) Car body
Construction of the racing cars body is by using aluminum and plastics. There
are only three tyres to each of the design. One tyre is controlled by the stepper motor
and the others for balancing the car. Racing car using the unipolar stepper motor
constructed using plastics. The basement of the car was obtained from ordinary toy car.
We implemented the readymade basement to our design by doing some modification.
Circuitry of the design was placed on top the basement. The dimension of the car is
25cm in length and 10cm in width. Height of the car model is 6cm, without the circuit
install in the car design.
Body of the bipolar control car was build by using aluminium. It is constructed by
hand. Same concept as the unipolar motor, there are only three tyres in the design and
the circuit was placed on top of the basement. The car model gain power from 12V
battery source. The length of the model is 20cm and width is 10cm. Height of the car
model is 18cm.
3.1.2 Software
The software’s that we used in developing the project is MPLAB and Proteus.
MPLAB Integrated Development Environment (IDE) is an integrated toolset for the
development of embedded applications employing and PIC microcontrollers. MPLAB
IDE runs as a 32-bit application , is easy to use and includes a software components
for fast application development and super-charged debugging. MPLAB IDE also serves
as a single, unified graphical user interface for additional Microchip and third party
software and hardware development tools. Moving between tools is a snap, and
upgrading from the free software simulator to hardware debug and programming tools
is done in a flash because MPLAB IDE has the same user interface for all tools. The
codings in the microcontroller can be coded using C language or Assembly language.
Our group used C language to code the microcontroller instead of A. C language is
easier for us to use because we are more familiar to that language. The codings was
coded into the microcontroller using programmer. In the project, the codings plays an
important role as it functions as the ‘main brain’ in the circuit. If the codings is not
successfully done, the circuit will not function.
Proteus is a low-cost package offering facilities for schematic drawing, SPICE
simulation, and PCB layout. The ProSPICE simulation module also includes simulation of
the PIC16F877A microcontroller, and a range of interactive peripheral models such as
LCD displays, matrix keypads, and DC motors. Proteus is an easy-to-use application for
creating printed circuit-board layouts, and is good for students working on small
projects. Proteus creates simple PCBs with 16 copper layers, two silk screens, and four
user/mechanical layers. Completed designs are suitable for reports, tutorials, or
articles. During testing, we found we were forced to register the program before most
of the basic functions would work. Proteus is a great program for creating PCBs.
Simulations of our design cannot be done in Proteus because some of the components
that used are not in the Proteus library such as stepper motor. We only used the
software to design the PCB layout.
Figure 3.4: Design of PCB layout using Proteus ( Circuit inside the remote control)
Figure 3.5 : Design of PCB layout using Proteus ( Circuit inside the racing car)
The model of motor driver that we are using is SD02B. As we studied the circuit
in the driver, we found out that L298 dual full bridge driver is used to drive the bipolar
motor. The dual full bridge driver is embedded inside the motor driver. Operating
supply voltage is up to 46V and total DC current is 4A. The L298 is an integrated
monolithic circuit. It is a high voltage and high current dual full bridge driver design to
accept standard inductive load such as relay, solenoid, DC and stepping motor. Two
enable inputs and are provided to enable or disable the device independently of the
input signals. The emmiter of the lower transistor of each bridge are connected
together and the corresponding external terminal can be used for the connection of an
external sensing resistor. An additional supply input is provided so that the logic works
at a lower voltage. It is a full bridge motor driver intended for a wide range of
automotive applications. Experimentally, we can drive two stepper motors using it. We
can directly interface the input with microcontroller to select the motor direction velocity
and break condition.
Figure 3.6 : Pin connection of L298.
There are also 4 pairs of freewheeling diodes in the SD02B motor driver.
Freewheeling diode is put into the circuit to protect the switching device from being
damaged by the reverse current of an inductive load. It is normally placed in a circuit so
that it does not conduct when the current is being supplied to the inductive load. When
the current flow to an inductor is suddenly interrupted, the inductor tries to maintain
the current by reversing polarity and increasing the voltage. Without the "freewheeling
diode" the voltage can go high enough to damage the switching device. With it, the
reverse current is allowed to flow through the diode and dissipate.
3.2 Description
3.2.1 Stepping
In the real world, there are types of phase current waveform which is full step,
half step and microstep. Full stepping motor have 200 rotor teeth or 200 full steps per
revolution of the motor shaft. Dividing the 200 steps per revolution (360o), each full
step angle is 1.8o. Normally full step angle achieved by energizing both windings while
reversing the current alternatively. Essentially, one digital input from the driver is
equivalent to one step.
Figure 3.9 : Full step stepper motor revolution
Half step means that the motor is rotating 400 revolutions per minute. In this
mode, one winding is energized and the two windings is energized alternatively,
causing the rotor to rotate at half the distance (0.9o). Half stepping is more practical
solution. Although it provides less torque, half step motor reduces the amount
‘ jumpiness’ inherent in running in a full step mode.
Microstepping is relatively, new stepper motor that controls the current in the
motor windings to a degree that further subdivides the number of positions between
poles. Microsteppers are capable of rotating at 1/256 per step or over 50,000 steps per
revolution. Dividing the 50,000 steps per revolution (360o), each full step angle is
0.072o.. In our design, both our control car stepper motor driver is using microstepping
steps to generate the rotations. Microstepping stepper motor is used to achieve two
objectives that are, increase the position of resolution and achieve smoother operation
of the motor. Microsteppping is typically used in applications that require accurate
positioning and fine resolution over a wide range of speed. It limits noise and resonance
problems. Microstepping works on the principle of gradually transferring current from
one winding to the other. This is achieved by pulse width modulating (PWM) the
voltage across the windings of the motor. The duty cycle of the signal charging one
winding is decreased as the duty cycle of the signal charging of the next winding is
increased.
Analysis
Stepping motor move by rotating in steps of predetermined degrees called step angle.
The degree rotated and the speed of rotation are easily controlled using electrical signal
called pulses. A pulse is an electrical signal that repeats ON and OFF as shown in Figure
3.11. Each cycle of ON and OFF ( one cycle) is called a pulse. In our design, the ON
period illustrates when the circuit is supplied by +5V and OFF period when 0V voltage
supplied.
T is the time taken for each revolution. By dividing 60s ( a minute) with T obtained, the
revolution per minute value was find.
Microstepping analysis
Figure 3.12 : Output waveform for microstepping circuit using oscilloscope
Referring to the waveform produced in Figure 15, the length of each complete
waveform 1.4 of the box. As we set the oscilloscope, each box wavelength is 1ms per
box.
wavelength 1 .4 1ms 1 .4 ms
For each step, the time taken is 1.4ms. So, per revolution the numbers of steps
produced are:
60 s (1 .4 ms ) 42 ,857 steps
Approximately, the steps produced per revolution are 43,000. With the result obtained
each step angle is 0.00837o.
3.2.2 H- bridge
Analysis
S1 S2 S3 S4 RESULT
1 0 0 1 Motor moves right
0 1 1 0 Motor moves left
0 0 0 0 No movements
0 1 0 1 Motor brakes
1 0 1 0 Motor brakes
Flowchart of input signal
No
Turn ON
Motor rotates
Received Bit
10 to 100
3.3 Problem encountered
In the final design built, there are some features was modified or eliminated as
we encountered some problems. There are two features that we modified which are
radio frequency module (RF) and encoder.
The radio frequency signal is totally eliminated from our design. We are using
wire cables instead of wireless. The reasons we eliminate the feature is the signal in the
RF is interphasing with the other group frequency. Most of the other groups are using
the same model of RF with the same frequency (433MHz). Distortion of information
produced and consequently the data received or transmitted is not the acquired signal.
In the design, the functionality of RF is very important. If the RF is not working properly,
the design will become a big failure. As we discussed among the team members, we
are not willing to take any risk, so we change the RF to the wire cables. Furthermore,
the main purpose of the project is to build test board to stepper motor.
The second feature that we modified is the encoder, speed calculation. As we
proposed, the encoder should detect the speed of the stepper motor. Unfortunately, the
encoder that we are using was broke during the installation part. Because of time
limiting factor, we modified the calculation speed mechanism. Microcontroller itself
calculates the rotation of the stepper motor. Data collected from the test done in lab to
come out with speed and torque equation. This equation is programmed in the
microcontroller. Referring to this equation, the speed calculated.
We also encountered a problem during PCB layout. The PCB fabrication process
was perfectly done. But during troubleshooting after soldered the components , the PCB
circuit does not function as expected although the circuit is approved. Many tests have
been done throughout the project for the PCB. The failure of the circuit is because of
electromagnetic effect. Furthermore, the copper in the PCB board is being oxidized to
the surroundings. As a result, we use straight board instead of PCB board.
Chapter 4
We are using LCD type JDH162A for our product and we are using C
programming to interface the LCD with the microcontroller. The circuit design is built on
the Porteus 7 Professional program. The failure circuit is shown on the Figure 4.1a and
the successful circuit is shown in Figure 4.1b. The program is simulated on the MPLAB
IDE v8.1 and it is send to PIC by using Pickit2 v2.55. The result of the experiment for
the LCD is shown in Table 4.1.
This is a basic circuit diagram that controls the stepper motor speed with voltage
regulator 7805 and potential meter shown in Figure 4.2a. When vary the potential
meter will produce the analogue signal from 0.1V until 5V into microcontroller. In the
microcontroller, ADC converter will convert the analogue input to digital output in order
to decide the stepper motor speed. The output of the speed control circuit when varied
the potential meter.
The speed control circuit connected to PIN 2 of PIC16F877A that the analogue
signal 0-5V sends into microcontroller in order to convert to digital signal. The eight LED
connected from the PIN 33 until PIN 40 of PIC which will indicate the digital signal
changing from 00000000 to 11111111 when the potential meter was varied.
According the above circuit diagram, the digital signal changing from 00000000
to 11111111 when varied the variable resistor which the digital signal indicate the
voltage changed from the regulator IC 0 to 5V.
Below are the PCB layouts that using the Proteus software to design the circuit
track. Further more, printed the PCB layouts on the transparent and then etched it.
Then drilled the holes in order to put the components and soldered all the parts on the
PCB
Hardware:
RF-Module (433MHz)
i) RF Transmitter Module
Figure 4.4.1 RF Transmitter Module (433MHz)
There are 3 pins to connect in the RF Transmitter module. The DATA pin is
connected to the TX pin of the Microcontroller. VCC pin connect to the supply voltage
and GND connect to ground. The antenna can extend with any wire but for better result,
a 50 Ohm coaxial cable is used. The length of the wire as antenna is about 18cm long.
There are 5 pin to connect for the RF receiver module. The DATA pin of the RF
Receiver Module is connecting to the RX pin of microcontroller. The VCC pin connects to
the 5v supply and the GND pin to ground. The ANT is the antenna of the receiver and
can be extend with any wire. The length of the wire is 18cm for better result.
Microcontroller
i) PIC16F877A
PIC16F877A is an 8-bit microcontroller. It has 5 I/O port where each I/O port have 8
I/O pins. There is 8 A/D input and 15 interrupt. There also implemented with parallel
Slave port in this microcontroller. Table below shows the specification PIC16F877A.
Circuit Diagram
The connection for the microcontroller and voltage regulator is the same as the
circuit for the transmitter. The RF receiver is operating at 5 volt. The Vcc pin of the RF
receiver is connected to the 5 volt supply from the voltage regulator. The data pin of
the receiver is connected to the RX pin which is pin 26 for PIC16F877A. RX pin is for the
use of serial communication interface which will receive the 8 bit data from the
transmitter for further process. In this circuit, when the receiver receive correct data
transmitted from the transmitter, the 8 Led will light on same as the transmitter else
receiver receive the wrong data.
Software
RF-Module
In previous section, it is shown that the data pin of the transmitter module is
connected to the TX pin of the microcontroller. Seem TX pin normally used as a digital
I/O port, to enable the TX port as a serial port, SPEN which is bit 7 in RCSTA have to be
set. Bit six in TRISC of PIC16F877A have to be clear in order to make the TX pin as an
output pin. TXSTA is the transmit control register for the microcontroller. This register
has to be initializing correctly in order to make the transmission work. By referring to
the data sheet, the TXSTA is initialized as B'00100000' which mean that it transmit 8bit
data in asynchronous low speed mode. Figure 4.4.3 shows the representation of each
bit of the TXSTA register and Figure 4.4.4 show the setting of the register in the
program.
=
64( + 1)
Example:
20
2.4 =
64( + 1)
= 129.21
≈ 129
When a 1 byte digital data is being transmitted, it is transmit from the less
significant bit to the most significant bit. This means that the transmitter transmits
digital data bit by bit to the receiver. Figure 4.4.5 shows how the signal is transfer in
asynchronous mode.
Figure 4.4.8 Signal Transfer in Asynchronous mode
From Figure 4.4.5 the signal is high when no transmission (or reception) is in
progress and goes low when the transmission starts. The receiving device uses this low-
going transition to determine the timing for the bits that follow. The signal stays low for
the duration of the START bit, and is followed by the data bits, Least Significant bit first.
The USART can transmit and receive either eight or nine data bits. The STOP bit follows
the last data bit and is always high. The transmission therefore ends with the pin high.
After the STOP bit has completed, the START bit of the next transmission can occur as
shown by the dotted lines.
During transmitting data, the heart of the transmitter is the Transmit Shift
Register (TSR). This register obtain the data from the transmit buffer, TXREG. Hence,
to transmit a data to the receiver, first is to move the desire transmit data to the TXREG
then it will load to TSR to be transmitted. To check whether the data in TXREG had
been move to TSR, the flag bit TXIF which located in the PIR1 is checked. If TXREG is
empty (means the data already load to TSR) the flag bit TXIF will be set. Hence new
data can be load to TXREG to be transmitted next. The Bit TXEN in TXSTA show in
Figure 4.4.6 is always set so that all the data in TSR will be transmit.
Check TXIF False
True
RCSTA is the receive control register for the microcontroller. This register has to
be initializing correctly in order to make the receiver work. By referring to the data
sheet, the RCSTA is initialized as B'10010000' which mean that it continuously receive 8
bit data, asynchronous mode. The SPEN Flag bit in RCSTA have to be set to enable the
serial port. The baud rate for the receiver has to be the same with the transmitter.
Figure 1.7 shows the representation of each bit of the RCSTA register and Figure 1.4
show the setting of the register in the program.
Figure 4.4.10 Representation of Each Bit in RCSTA Register
When receiving data from the transmitter, the data is first stall in Receive Shift
Register (RSR). After that the received data is transferred to the RCREG register when it
is empty. Once the transferring process from the RSR to RCREG is complete, the flag bit
RCIF will be set. The RCREG is a double-buffered register which mean that it can store
two byte of data. When the 2nd data come in but the 1st data have not been read yet,
the data will store in the second slot of the RCREG. When the 1st data is read, the 2nd
data will move to the 1st slot and new data can be move into RCREG. However, when
the RCREG is full and the 3rd data is store in the RSR, the flag bit OERR will be set and
the data in RSR will lost. In addition, all the receive process will be stop. Hence it is a
must to clear the flag bit OERR in order to retrieve the receiving process. Flag bit OERR
can be clear by first clear the CREN and then set it again. Figure 1.8 shows how the
overrun error being detected and how it is solve.
A experiment is carried out at robocon lab, sktm to test the efficiency of Radio
frequency.
From the analysis above, the result can be concluded when the distance starts to
increase the efficiency start to decrease. From 15 m to 19 m, the data receive start to
corrupted by surrounding and after 20 m the radio frequency is out of the function.
Failure
However the Radio frequency in our project design will be replaced by the wires due to
reason below:
i) Interface by other radio frequency: Many groups are using the value of
frequency of radio frequency.
ii) Protocol : The pre-set method to transmitter and receiver cannot applied in
the the racing car because the value of speed time by time. Therefore, the
probability the receiver receive the wrong data is very high.
We are testing our product at two different surfaces that is at flat surface and
also at sliding surface. The car is tested by using bipolar and unipolar stepper motor.
The data of unipolar stepper motor is shown at Table 4.4a, Table 4.4b and also Table
4.4c. From the table it is shown that at the flat surface the RPM speed of the motor
decreases when the time increases and at the mount surface RPM speed is also
decreases when the time increases. The RPM speed reach at full-speed at 3 second.
The direction and the total load (1kg) remains as constant.
We calculate the speed of the stepper motor by using formula given below
2
=
60
60
=
2
= ( )
= ℎ ℎ
a)
Referring to the waveform produced in Figure 4.6.1, the length of each complete
waveform is 2.2 of the box. As we set the oscilloscope, each box wavelength is 1ms
per box.
wavelength 2 .2 1ms 2 .2 ms
f 454 .55 Hz
b)
Referring to the waveform produced in Figure 4.6.2, the length of each complete
waveform is 6.8 of the box. As we set the oscilloscope, each box wavelength is 0.1ms
per box.
1 1
f f
T ; 0.68ms
f 1470 .6 Hz
The tests were repeated for 20 times with different number of bits. The results are as
Table 4.6.
In this section, our group tested the motor by using the prototype that we had built.
We troubleshooted the design to find weather it is successfully worked or not. We test
the car in different speed (RPM) and also the road situation. The test runs data shown
at the table 4.7a.
Table 4.7a: Shows the result of the movement of the car at flat road.
Table 4.7b : Shows the car movement result when run up the 300 hill.
Distance Time Speed(RPM) Note
By comparing the results obtained, we can conclude that the car speed is
proportionally dependant on the road condition. Based on our observation in the Table
4.7b, when the car at low speed, the time taken is 13s but when the car is high speed,
the car only 3s to going up the hill. This conclude that when the motor in full speed
state , the torque is low while when the motor is in low speed , the torque produced is
high.
Chapter 5
SUMMARY
Total cost of
Cost of each
Quantit the
Part Type of component component(R
y component(R
M)
M)
Motor driver 1 135.00 135.00
Stepper motor 1 50.00 50.00
Radio frequency 2 55.00 110.00
Encoder 1 60.00 60.00
LCD(JHD162A) 2 30.00 60.00
PIC(16f877a) 5 25.00 125.00
Voltage regulator 5 6.00 6.00
Oscillator 2 3.50 7.00
IC socket 40 pin 2 0.70 1.40
Switch (push button) 4 0.50 2.00
Switch (toggle) 1 1.80 1.80
Circuit design
PCB connector
1 1.00 1.00
(4 ways)
PCB connector
1 0.50 0.50
(2 ways)
PCB connector
2 1.50 3.00
(12 ways)
Straight pin header
1 1.00 1.00
(1 x 40 ways)
Straight female
1 1.00 1.00
header (1 x 40 ways)
PCB board 1 22.00 22.00
Prototype Box 1 3.00 3.00
Total cost 589.70
5.3 Conclusion
Our product is successfully design and functioning as test board for stepper
motor for educational kit for university student. With controlled by one stepper motor it
can move backward and forward. However there is some changing followed to the
design process we have done but it still successfully works.
APPENDIX 1
I am as the lab coordinator task is to coordinate the lab and buy the components
needed of the project. Ordinary electronics components were bought from electronic
shop in Kota Kinabalu while the unipolar stepper motor was bought from Cytron
Technology via website. Mr. Liau had sponsored us a bipolar stepper motor. As the
objective of our project is to differentiate between unipolar and bipolar stepper motor.
My task was designing the encoder circuit to detect the speed of the stepper
motor. Encoder RE08A was used to detect the speed. The encoder detects the speed
and sends the information to the microcontroller. Microcontroller processes the
informations and calculates the speed. Via cascade microcontroller the information sent
to the microcontroller embedded inside the remote controller and display the speed at
the LCD screen. The encoder is connected to the motor driver. Unfortunately, during
the installation of the encoder, one of the shaft broken. The speed detection will be
disturbed without the shaft.
So, I modified the speed detection mechanism without using the encoder. It is
totally involving the programming part. The microcontroller itself will calculate the
speed of stepper motor. Research of the speed equation was done in the lab and using
the equation the microcontroller been programmed.
The stepper motor speed control is a basic circuit to convert analogue signal to
digital signal and control the stepper motor rotation speed. This circuit operates with
the PIC16F788A which the analogue signals from 0 to 5V to digital signals from
00000000 to 11111111. Basically, it needs one regulator 7805 IC, one potential meter
10Mohm, two 100µF capacitors, and one LED.
Firstly, construct the speed control circuit on test board in order to make sure
the output tested function vary from 0 to 5V when 12V input connected and potential
meter was varied. After tested, connect the output of speed control circuit to the pin 2
of PIC as well as write the program for PIC which can convert the analogue signal to
digital signal. Hence, the digital signal changing from 00000000 to 11111111 when
varied the potential meter in control part that the digital output signal shown from pin
33 until pin 40 by using LED in stepper motor part..
Furthermore, the MPLAB IDE V8.10 program used to simulate then transfers it to
the PIC using Pickit2 V2.55. This circuit construct in control part of stepper motor that
control the speed and two way direction in forward and backward direction. The two
way direction button connected to the pin 15 and 16 of PIC. The speed of stepper
motor would show on LCD when the potential varied.
This circuit design not so much difficulty to construct but what is important is the
programming of PIC that program convert the analogue signal to digital signal and
digital signal changed when the potential varied in order to make sure stepper motor
rotate increase or decrease and forward or backward.
Radio Frequency
Motor driver
The model of motor driver that we are using is SD02B. As we studied the circuit
in the driver, we found out that L298 dual full bridge driver is used to drive the bipolar
motor. The dual full bridge driver is embedded inside the motor driver. Operating
supply voltage is up to 46V and total DC current is 4A. The L298 is an integrated
monolithic circuit. It is a high voltage and high current dual full bridge driver design to
accept standard inductive load such as relay, solenoid, DC and stepping motor. Two
enable inputs and are provided to enable or disable the device independently of the
input signals. The emmiter of the lower transistor of each bridge are connected
together and the corresponding external terminal can be used for the connection of an
external sensing resistor. An additional supply input is provided so that the logic works
at a lower voltage. It is a full bridge motor driver intended for a wide range of
automotive applications. Experimentally, we can drive two stepper motors using it. We
can directly interface the input with microcontroller to select the motor direction velocity
and break condition.
There are also 4 pairs of freewheeling diodes in the SD02B motor driver.
Freewheeling diode is put into the circuit to protect the switching device from being
damaged by the reverse current of an inductive load. It is normally placed in a circuit so
that it does not conduct when the current is being supplied to the inductive load. When
the current flow to an inductor is suddenly interrupted, the inductor tries to maintain
the current by reversing polarity and increasing the voltage. Without the "freewheeling
diode" the voltage can go high enough to damage the switching device. With it, the
reverse current is allowed to flow through the diode and dissipate.
APPENDIX 2
Reference
R
Nigel Gardner PICmicro MCUC ○ (An introduction to programming; The
Microchip PIC in CCS C) (2000) Bluebird Electronics.
Tim Wilmshurst Designing Embedded Systems with PIC Microcontrollers
Principles and applications (2003) Elsevier Ltd.
Dogan Ibrahim PIC BASIC Projects 30 Projects Using PIC BASIC and PIC
BASIC PRO (2006) Newnes Ltd.
Chuck Hellebuyck Programming PIC Microcontrollers with PicBasic
(2004) Newnes Ltd.
MICROCHIP PIC16F87XA\ Data Sheet 28/40/44-Pin Enhanced Flash
Microcontrollers
JHD162A data sheet(cytron technologies)
PIC16F877A data sheet(cytron technologies)
www.wikipedia.com
www.cytron.com
GROUP MEMBERS PHOTOS
Referring to the first photo. From left : G. Tamil Selvam, Goai Teck Liang, Mohd. Faisal,
Siti Nor Nabilah. Not in the picture : Wong Jih Kian.
LEADER
WEB MASTER
PRESENTATION MASTER
SECRETARY
LAB COORDINATOR