Draft - Mfusi INTERIM REPORT Final
Draft - Mfusi INTERIM REPORT Final
Group Names
1. Trevor Mkhize 215013055 – Motor Control
2. Sihle Mfusi 217018441 – Speed Measurement
3. Isaac Mongali 217007942 – Light Dimming
4. Skusele Nkonzo 217017873- Power Supply and GUI
Abstract
This report contains a project approach which is sub-divided into four parts. Every sub-topic is handled by
individual group member out of four members. The report has schematic and simulation snipped shots
(screenshots) for the based design to be conducted. Each section out of four has its own schematic and
simulation screenshots followed by a brief description of what is happening based on the results found during
simulation. The proposed solutions were simulated using proteus software, multisim, java as well as C
programming, the simulation results are shown and are discussed in greater depth. It has an additional
information than phase 1 report of group 10 which was submitted early July 2019. The light diming circuit uses
the implementation of microcontroller-based firing angle control, using ATmega-16 MCU and associated
hardware circuitry is discussed here, like the zero crossing and triac circuit. The system’s power supply will be
connected to any 230V ac electrical source and with the help of the transformer the output voltage of the power
supply should be 5V so that micro components will be sufficiently energized. It is shown how a full, half steps
sequences are implemented for controlling a stepper motor. Serial communication is incorporated via a computer
that will make use of HyperTerminal. The computer will be used to control the speed and direction to which the
motor will run at. At a point the user can also stop the running of a motor.
Table of Contents
Abstract.......................................................................................................................................................3
1. Introduction.........................................................................................................................................6
2. Power supply and GUI design (Skusele Nkonzo 217017873).............................................................7
I. Transformer.....................................................................................................................................7
II. Rectification....................................................................................................................................8
III. Filtering.......................................................................................................................................8
IV. Voltage Regulation......................................................................................................................9
V. Graphical User Interface (GUI).....................................................................................................10
VI. Serial Communication (Relationship between microcontroller and PC)....................................11
3. Motor Control Circuit (Trevor Mkhize 215013055)..........................................................................12
I. Specification and Considerations...................................................................................................12
II. Functional Specifications...............................................................................................................12
III. Some of the Non-Functional Specification................................................................................12
IV. Flow diagram of how motor functions.......................................................................................13
V. Explanation of the Above Flow Diagram......................................................................................13
VI. The Actual Driving of the Stepper Motor..................................................................................13
VII. The Driver Circuit......................................................................................................................14
4. Speed Measuring Circuit (Sihle Mfusi 217018441)...........................................................................17
I. IR sensor module...........................................................................................................................17
II. IR Transmitter and Receiver..........................................................................................................18
III. Op-Amp LM358........................................................................................................................19
IV. Stepper Motor Driver Circuit.....................................................................................................19
V. Advantages of a stepper motor driver............................................................................................20
VI. The Results from the Simulation................................................................................................21
5. Light dimming Circuit (Isaac Mongali 217007942)..........................................................................22
I. Principle of Phase Angle Control...................................................................................................22
II. Zero Crossing Detector Circuit......................................................................................................23
III. Microcontroller..........................................................................................................................24
a. Schematic Diagram of Selected Solution.......................................................................................24
IV. Delay Calculations.....................................................................................................................25
V. Firing Angle Calculation...............................................................................................................25
VI. Triac and Opto-Coupler.............................................................................................................26
6. Conclusion.........................................................................................................................................27
References.................................................................................................................................................28
List of Figures
Figure 1: Block diagram of the power supply..............................................................................................6
Figure 2: Multism simulation for power supply...........................................................................................6
Figure 3: Displaying results of Primary side and Secondary side of a transformer......................................6
Figure 4: Results of rectified voltage displaying DC voltage only..............................................................7
Figure 5: Results of output voltage after adding filter capacitor..................................................................7
Figure 6: Final DC voltage required after regulation...................................................................................8
Figure 7: Graphical user interface for group 10...........................................................................................9
Figure 8: Block diagram of GUI system....................................................................................................10
Figure 9: Flow diagram of how motor functions.......................................................................................12
Figure 10: illustration of the driver circuit explained.................................................................................13
Figure 11: Full step sequence diagram......................................................................................................14
Figure 12: implementation of half step sequence.......................................................................................15
Figure 13: Block diagram of implementing the speed measuring circuit of a stepper motor.....................16
Figure 14: IR sensor circuit.......................................................................................................................17
Figure 15: The transmitted and reflected incident of light [9]...................................................................18
Figure 16: Motor driver circuit..................................................................................................................18
Figure 17: block diagram of a speed measurement circuit.........................................................................19
Figure 18: Full system functioning............................................................................................................20
Figure19: Measuring the speed of the stepper motor.................................................................................20
List of Tables
1. Introduction
Power supply and GUI, Stepper motor, Speed measuring circuit and Dimming light bulb. A dimmer is a device
that is originally created to control the brightness of the lamp, this is achieved by altering the power delivered to
the lamp, thus the brightness. The brightness of a 60W bulb will be controlled by a GUI, this will be entered by
the user to change the brightness at their own specification, the brightness will range from 0-100%. A
microcontroller will grant automatic features to the circuit, it will then send a signal to the opto-coupler which is
used to electrically connect two isolated circuit and it also prevent high voltage from destroying the circuit this
will then be sent to a TRIAC that will be used as a switch to transmit that specified brightness that the user has
entered. These are the sub-divided sections that we concentrate on. Power supply and GUI are two different parts
that are to be conducted by one member, each and every devices nowadays requires power to operate, power
supply will be in a form of DC supply given an AC voltage which pushes us to use a transformer which converts
one voltage rating to another a step-down transformer is used since we have to convert 230V AC to
approximately 5V supply DC.
Graphical user interface is an interface that is used by a person in order to interact with the system using a
computer. Motor is a machine that is used to convert one energy form to another electrical to mechanically
energy. Motor is specially used for rotating objects in most cases. Stepper motor needs a DC power supply based
on its forename DC motor. Speed of motor is measured in rotation per minute, provided you want to determine a
speed of a motor speed measurement circuit can be used to measure speed of a motor. Speed measurement
circuit will be able to measure the speed of the motor it is measured on velocity feedback concept where a direct
current generator is hooked to the rotating shaft so that the voltage induced across the generator’s terminals is
proportional to the speed of the shaft and a programmable microcontroller chip will be calculating the speed
measured and display it at the GUI. This will interface with motor for starting, stopping and bidirectional
rotation.
A speed measuring unit was used to determine the speed of the motor and ensure the motor was running at the
speed entered by the user. It is then sent to a microcontroller which will process the data according a specific
algorithm and this will allow for the stepper motor to be controlled in a manner which is required by the user
who input the data into the computer. The microcontroller provided can only output a maximum current of
20mAmps and the motor which will be utilized operates with a rated current of 500mAmps and thus it is
necessary to ensure that the current output by the microcontroller be amplified. The driver circuits need to be
protected from these large back currents and this needs to be incorporated into the circuit design. The
microcontroller also needs to be protected from any form of failure which may occur in the driver circuit. The
system that to be conducted must allow each of the four parts have mutual connection. Mutual connection is
whereby each part can communicate with other part using same connection.
2. Power supply and GUI design (Skusele Nkonzo 217017873)
The specifications of the project require a 5V dc supply, which will be able to supply other components of the
design which need a dc voltage for an example dc stepper motor. The AC power supply input voltage is 230 V
and frequency of 50Hz and output 5V dc volts and the current can be controlled by including a resistor at the
load and control the output current. This design consists steps and components for stepping down voltage in the
transformer, full wave bridge rectifier, filter capacitors and a voltage regulator.
I. Transformer
II. Rectification
A Full wave rectifier is used in this design, full wave rectifier is a circuit arrangement which makes use of both
half cycles of input alternating current (AC) and converts them to direct current (DC). The residual ac ripples
(before filtering) is very low in the output of a bridge rectifier. The same ripple percentage is very high in half
wave rectifier. A simple filter is enough to get a constant dc voltage from bridge rectifier [1]. Diodes are used
which allow current to move in one direction only. Because of the alternating nature of the input AC sine wave,
the process of rectification alone produces a DC current that, though unidirectional, consists of pulses of current.
III. Filtering
The output of a rectifier is thus smoothened as the signal contains a larger ripple component which is unstable, a
smoothing capacitor stabilizes the DC voltage to be constant. In this design the dc power supply desired must
have a constant output voltage. A constant output voltage from the DC power supply is very important as it
directly affects the reliability of the electronic device connected to the power supply [1].
A voltage regulator generates a fixed output voltage of a pre-set magnitude that remains constant regardless of
changes to its input voltage or load conditions. The voltage from rectification and smoothing capacitor fluctuates
which can damage some components, the 7805 also ensures that the output voltage is 5V. The LM7805 is a very
important part of this design as it also has thermal overload protection and short circuit protection [2]. The value
of the capacitance connected after the voltage regulator is smaller compared to the value of the capacitor
connected just after rectification. The reason for this is because the peak to peak ripple voltage just after
rectification is larger than the ripple voltage after the voltage regulation. The simulation results showed a voltage
of 5.003V.
The Graphical User Interface (GUI) allows the user to interact with the system from the PC. It is the GUI that
ensures that communication is effective between the user and the system’s microcontroller. The user enters data
on the GUI which in turn sends the information to the microcontroller which acts as the “brain” of the system.
The GUI also allows the user to view the feedback from the microcontroller via a display.
It also enables the user to:
1. Send commands to the microcontroller.
2. Start the motor.
3. Stop the motor.
4. Change the speed of the motor.
5. Change the direction of rotation of the motor.
6. Allow the user to manually set the dimming level within an acceptable range. Display the level of dimming
from the slider that will allow a user to adjust the dimming level.
The GUI will have specific buttons for adjusting the functionality of the stepper motor. These consist of start or
stop the motor, change the speed and select the direction of rotation of the stepper motor and the graphical user
interface will be programmed in such a way that a person cannot be able to select both directions at the same
time. To vary the speed of the motor and to manually set the dimming level within an acceptable range the user
will have to adjust the dot on a slider then text box shows you the value which you wish to adjust to. The values
of a threshold dimming level and speed that is measured using speed measurement circuit shall be clear when
you press the clear buttons respectively to which value you want to clear either speed display or threshold value
or both including port setting. The aim of our design is that the system should gradually fluctuate the brightness
level of the 60 W incandescent lamp based on the speed of the stepper motor if the speed of the stepper motor
exceeds the threshold to be set the light bulb should start dimming. Another way of dimming the bulb is to slide
the slider checking the dimness. Data logging capabilities will be recorded to the text area box when button save
last record is pressed the results shall be printed to the text area box using appending for writing values which
will allow several values to be written to.
The summary of the relationship and communication between the interface and the microcontroller, for receiving
and sending data to and from the microcontroller.
3. Motor Control Circuit (Trevor Mkhize 215013055)
Stepper motors are used in many applications which require rotational movement. The performance of stepper
motor is strongly guided by the driver circuit. The basic arrangements in two phase stepper motor are the
unipolar and the bipolar. The stepper motors can be regarded as DC motors that move in discreet steps.
[ CITATION RBB01 \l 7177 ]
Unlike the DC motor that is driven by continuous flow of current, stepper motors are driven by pulses of
electricity. Each pulse moves the shaft of the motor a step further thus, they are known as digital devices.
As the digital pulses increase in frequency, the step motion varies into a more continuous rotation with the speed
of rotation directly proportional to the frequency of the pulses. Stepper motors are used every day in both
industrial and commercial application due to their low cost, high reliability, high torque at low speeds and a
simple, rugged construction that operates in almost any environment. [ CITATION RBB01 \l 7177 ]
This brushless DC motor is controlled by series of electromagnetic coils. The center shaft has a series of magnets
mounted on it, and the coils surrounding the shaft are alternatively given current, creating magnetic fields which
repulse or attracts the magnets on the shaft, causing the motor to rotate one step at a time.
Power Supply
Q1 Q3 Q2 Q4 Hex
1 1 0 0 0C0C
0 1 1 0 0C06
0 0 1 1 0C03
1 0 0 1 0C09
From the table, the sequence that would be output to turn the motor 4 steps in a certain direction would be:
Q1 Q2 Q3 Q4 Hex
1 1 0 0 0X0C
0 1 1 0 0X06
0 0 1 1 0X03
1 0 0 1 0X09
0 0 1 1 0X03
0 0 0 1 0X01
1 0 0 1 0X09
1 0 0 0 0X08
The diagram below shows how a half step sequence is implemented for 90º per step stepper motor. To direct the
motor in clockwise direction the sequence shown in the table is used in that order. For anticlockwise direction
the order is reversed.
Figure 12: implementation of half step sequence
4. Speed Measuring Circuit (Sihle Mfusi 217018441)
The aim of the speed measuring circuit is to be able to accurately measure the speed of the stepper motor and
display the reading on a graphical user interface through integration in revolutions per minute (rpm) or
alternatively on an LCD screen. The speed measuring circuit is to work hand in hand with system of controlling
steeper motor. The speed of the motor will be measured on velocity feedback concept where a direct current
generator is hooked to the rotating shaft so that the voltage induced across the generator’s terminals is
proportional to the speed of the shaft and a programmable microcontroller chip will be calculating the speed
measured and display it at the Graphical User Interface (GUI).
Specification
1. Microcontroller (atmega16)
2. IR sensor module
3. GUI for displaying
4. Stepper Motor Driver Circuit
Figure 133: Block diagram of implementing the speed measuring circuit of a stepper motor
I. IR sensor module
The IR sensor was chosen because of the following advantages:
Their low power requirements make them suitable for most electronic devices such as laptops,
telephones, PDAs.
They can detect motion in presence/ absence of light almost with same reliability.
They do not require contact with object to for detection.
There is no leakage of data due to beam directionality IR radiation.
They are not affected by corrosion or oxidation.
They have very strong noise immunity.
Figure 14: IR sensor circuit
The IR transmitter and receiver are used for emitting and sensing the IR beam. The Op Amp LM358 is used as a
comparator which in turn switches the output level as either logic 1 or logic 0. The Variable resistor RV1 used to
tune the sensitivity of the detector by altering the reference voltage to the comparator and at last LED D3 was
meant as an indicator in case an IR beam is detected or reflected[ CITATION Don17 \l 1033 ].
When the circuit is powered photo transistor emits Infra-red beam. The receiver was connected in a reverse
biased manner along with a resistor R3 in series. When there is no IR beam incident in the photodiode no current
passes through it which in turn leads to no drop in voltage and inverting terminal of the Op Amp is fed with max
voltage that is 5V [ CITATION Cir17 \l 1033 ]. The voltage in the inverting terminal is more than the reference
voltage at the positive terminal of op amp the output stays LOW or logic 0 [ CITATION Don17 \l 1033 ].
When IR beam is reflected by any object which makes the beam to incident on receiver, current passes through it
and in turn a drop of voltage occurs between the terminals. The reference voltage at the positive terminal of Op
amp is more than the negative terminal. The output of Op amp switches to high or Logic 1 state [ CITATION
Coo11 \l 1033 ].
The power device used in phase angle controllers is a thyristor – mostly triacs or SCRs. The power flow to the
load is controlled by delaying the firing angle (firing time each half-cycle) to the power device [ CITATION
Sha12 \l 1033 ].
The thyristor is a latching device – when the thyristor is turned on by a gating signal and the current is higher
than the holding current and the latching current, the thyristor stays on, until the current through it becomes
sufficiently low (very close to zero). The thyristor turns off when current through it becomes zero, as happens at
the AC mains zero crossing. This is the natural line commutation. (Another method of turning the thyristor off is
by forced commutation. I will not go into that now.) The assumption here is that the load is resistive and has
little to no inductance[ CITATION Sha12 \l 1033 ].
In phase angle control, a gate pulse is sent to the triac. This is sent at a time between one zero crossing and the
next. Without the gate pulse sent to the triac, right after zero crossing, the triac is off and no current flows
through it. After a certain time, the gating signal is given to the triac and it turns on. The triac then stays on until
the current through it becomes zero (natural line commutation). This is at the next zero crossing. For simplicity’s
sake and as usually should be, assume that the current through the triac (when on) is larger than the latching
current and the holding current. If you did not already know this, the latching current is the current that must
pass through the triac right after it is turned on to ensure that it latches. The holding current is the current level
through the triac below which the triac will turn off. So, the assumption that current through the triac is higher
than the latching current and the holding current means that the triac stays on once it is fired on. It stays on until
the current through it is zero.
This means that the voltage is supplied to the load for a fraction of the cycle, determined by how long the triac is
on. How long the triac is on, is, in turn, determined by the delay time between the zero crossing and the applying
of the triac gating signal[ CITATION Sha12 \l 1033 ].
II. Zero Crossing Detector Circuit
The Zero-crossing circuit detects a zero voltage across the mains voltage as soon as a zero form in the sine wave
is detected. It significant is to achieve a smooth dimming without the lamp flickering, which can happen due to
the fact of the lamp turning ON and OFF when the wave voltage comes across a zero point. This information is
transmitted to a microcontroller in a form of a pulse, the microcontroller needs to know the zero-crossing
detection point of the waveform; it then can calculate the angle offset to send the trigger pulse to the gate of the
1
TRIAC. The AC power oscillates in a 50Hz cycle T = =20 mSec this is the time it takes to complete a full
50
cycle. During this time, the waveform will cross the zero point two times. One at the middle of a cycle and the
second one at full cycle (2* π ), this will be after10 mSec . If we want to dim the lamp 50% the microcontroller
will send a pulse in the middle of each semi-cycle, thus after the pulse is sent after 5mSec after each time the
waveform passes a zero point, the microcontroller will watch the ZCD (zero crossing detection) circuit for a
pulse. When this pulse is sent, the Microcontroller will count 5ms and then will trigger the gate of the TRIAC.
6. Conclusion
In this report types of solutions have been generated on how to approach the design in order to meet the
mentioned specifications of the design. The simulated results allow the group to go through with an
implementation of the design. This document presented the four tasks of this design project and how they
interface with each other. Best chosen solutions for each individual task were presented and stated the reasons as
to why they were chosen. Everything is good with the motor control circuit and light dimming circuit, but the
speed measuring circuit was still having some issues with the code as the circuit simulation was still
misbehaving a bit, but rest assured it will be working accurately. Another challenge facing the group is the
integration of the project which has not been done as the design specifications cannot be put together into one
simulation environment and see how the design performs. The report details further information from the phase
1 proposal. Further investigations and research were conducted to follow up from the previous report. Each
member clearly specifies their modules with appropriate simulation where needed with different simulating
tools. The efficiency of the project rests on the interface with each of the modules. Based on the information
provided in this report the hopes are to build successfully without any errors stopping the progress. In-case of
meeting up with the difficulties during progress it will lead to improvement of the ideas for the above approach.
References
[1] R. Bonanza, "working with stepper motors," robotoid, new york, 2001.
[2] C. J., "How to use stepper motor," Instructables, Cape Town, 2016.
[3] M. M., "Micro Stepping, Full stepping and half Stepping.," Mitsumi Engineers, Miami, 2017.
[4] L. G., "Simply Smart Circuitry," Circuit Specialists, New York, 2012.
[13] R. Ravindran and A. Kumar, A DC Motor Speed Controller using LABVIEW and Visual Basic, vol. 3, no.
1, 2012.
[15] R. Gupta, Ruchika Lamba and Subhransu Padhee, speed control techniques of dc motor: a comparative
analysis.