Sunteți pe pagina 1din 2

PIC16F873(A) based automatic voltage stabilizer Syed Tahmid Mahbub

7 the user wants to recalibrate at any time. This is what I initially meant when I mentioned that the final
product has no variable resistor in it.
RELAY AND TRANSFORMER CONFIGURATION, AND SWITCHING
The input switches between the 165V, 190V and 240V transformer tappings while the output switches
between 240V and 215V tappings. The transformer is a simple autotransformer with the turns ratio 165V:
190V: 215V: 240V along with an auxiliary winding for powering the circuitry.
PIC16F873(A) based automatic voltage stabilizer Syed Tahmid Mahbub
8
REST OF CIRCUIT
The microcontroller runs off of a 4MHz external crystal oscillator. An external crystal oscillator has been
used since the PIC 16F873A lacks an internal oscillator, which would have been sufficient since there is
no precise time-critical aspect to the automatic voltage stabilizer. The microcontroller is powered off of a
regulated 5V DC supply. The autotransformer has a 12.5V auxiliary winding. The voltage at this winding
will remain around 12.5V and not vary too much with the input voltage variation due to the switching of
the relays and the output voltage regulation which acts to regulate the voltage across this winding too.
This low voltage AC is rectified to DC using a bridge rectifier and then filtered with a bulk capacitance.
You will also find that decoupling/bypass capacitors have also been used. This filtered DC is fed to the
input of a 7805 linear voltage regulator. Since the current draw is not too high, a linear regulator such as
the dirt-cheap ubiquitous 7805 is sufficient and no fancy switching regulator is required (I still do
recommend switching regulators, cost permitting, especially with large current outputs and/or large inputoutput voltage differences). It is critical to use at least one decoupling capacitor (which should be placed
as close to the microcontroller as possible) and you can see that it has been used. The regulated filtered
DC voltage that is fed to the 7805 input is also used to power the relays. However, this voltage is not
directly provided as the voltage is a tee-bit higher than what the 12V rated relays would probably like.
Thus, the voltage is dropped by approximately 2.8V by passing this input voltage through four regular
rectifier diodes in series. Each relay switching is controlled by the microcontroller. However, since the
microcontroller cannot provide sufficient current to drive the relay coils, transistors are used to amplify
the current and drive the relays from the required signals provided by the microcontrollers. The
configuration is the simple common emitter mode. Each relay coil also has in parallel with it an antiparallel diode that is used to catch or rather bypass the inductive kickback that occurs whenever the
current flow through the relay coil is stopped, ie when the driving transistor is turned off. Now lets move
on to the seven segment display. As you may have already guessed (and it should be quite apparent, given
that Im using a 3-digit segment), the decimal points in the display are not used. Thus that leaves us with
seven LED segments (conventionally referenced as segments A through G) that needed to be driven.
Additionally, to minimize the number of pins required to drive the seven segment display, the three digits
are turned on one after the other. However, this is done so quickly that to our eyes, it seems that the three
digits are always turned on. I have chosen to use a 167Hz refresh rate
PIC16F873(A) based automatic voltage stabilizer Syed Tahmid Mahbub
9 meaning that the entire display is refreshed 167 times a second once every 6 milliseconds. Each digit
is turned on, kept on for 2 milliseconds and then turned off before the next display is turned on and so on.
Since the microcontroller output drive current is limited and we want optimum brightness (and thus drive
current) of the seven segment display, seven transistors were used in the common collector (also known
as emitter follower) mode to drive the seven LED segments in the display. Additionally, three transistors
were used to provide or disconnect the supply to the individual digits, as required for continuous
subsequent switching between the digits. Upon start-up, the microcontroller enters delay mode. This is
when, for a specified amount of time (that is pre-programmed), there is no output. There is a switch that
is used to select between short delay (default mode, when switch is open) and long delay (when switch is

closed/pressed). These delay times are pre-programmed, and I have chosen to use 2 seconds for the short
delay and 3 minutes for the long delay. These, as far as I know, are the standard times present in the
voltage stabilizers available in the market. The delays are set by simple software loops that do nothing
such delay functions are provided in the mikroC PRO for PIC library. There are three LEDs in the circuit
that are used to provide visual feedback, besides that already provided by the seven segment display.
These LEDs are used to indicate: 1.
When the delay mode is on 2.
When the microcontroller is operating in low-cut or high-cut mode 3.
When the microcontroller is operating in normal mode
PIC16F873(A) based automatic voltage stabilizer Syed Tahmid Mahbub
10
PICTURES (because nothing is complete without pictures): (The circuits on verroboard are from the test
stage. You can see the PCB at the end.)
PIC16F873(A) based automatic voltage stabilizer Syed Tahmid Mahbub
11

S-ar putea să vă placă și