Automatic voltage stabilizer (AC-AC) with PIC16F873A - circuit, explanation, PCB, source code, videos and loads of pictures!
Download links for the article:
Google docs (go to the link, click File in the PDF window, then click Download):
https://docs.google.com/file/d/0B4SoPFPRNziHb3VrX3JhWko3d1E/edit
Scribd link: http://www.scribd.com/doc/207498741/Automatic-Voltage-Stabilizer-with-PIC16F873A
4shared download link: http://www.4shared.com/office/ktU0k9dqba/Voltage_Stabilizer.html
You can download all the files related to the voltage stabilizer:
Google docs (go to the link, click File in the PDF window, then click Download):
PCB images:
Schematic (2 parts):
Parts list:
Youtube videos of the automatic voltage stabilizer (in Bangla and in English):
Youtube link: http://www.youtube.com/watch?v=C84hwaacdfo
Youtube link: http://www.youtube.com/watch?v=Ds7M1bBSyEU
nice post sir plz do a project on z source ac to ac boost voltage regulator (transformer less stabilizer)
ReplyDeleteGreat effort as usual thanks for the knowledge shared. please can you give a circuit of the input Voltage sensing especially the resistors. I guess u finally used the 47k resistors in series which gives 282k (47kx6) and in parallel with 3k3 resistor. Am i rite?
ReplyDeleteDoing a little calculation:
230v Ac = 325v Dc (after rectification and filtering.)
using voltage divider rule
vout = vin x r2/(r1+r2)
r1 = 282k, r2 = 3k3, vin = 325vDC
then vout will be ~ 3 to 3.5v Dc.
1. is this how you come about the input voltage conversion and sensing? and please what re the power rating of the resistors.
2. the filtering cap after the rectifier, is it polarised or non-polarised
3. what is voltage rating of the capacitor after the rectifier.
thanks
Yes, that's how I got there. Except, for the AC to DC, I didn't use 1.4142 but 1.3836.
DeleteThe bulk filtering capacitor is polarised. The one on the voltage sense section (high voltage section) - C1 - is to be rated for at least 450V.
Regards,
Tahmid.
Hello Tahmid,
DeleteThe code is not working. First I compile with MikroC Pro, it compile with errors. I've corrected the errors it compile but no reactions at all. No display, no blinking or even a spark.
please what can I do
Hi again, I was going through the code and i must say you ve really done a very good job in creating a good algorithm within a short time.
ReplyDeleteBut i just want to be clear about the something in the code.
You said 6 X 47k ohms resistor in series and 3k3 ohm were your final selection for the voltage divider. but this portion of the code says otherwise.
//Voltage_FLOAT = Voltage_FLOAT + 1.5;
/* Use 100k and 1k resistors for voltage division
* Divide by 1.3836 to convert from DC voltage to AC
*/
2. please can you throw more light on this (Voltage_FLOAT = (float)((float)ADC_Get_Sample(Vin_CHANNEL) * 5.0 * 101.0 * Kc) / (1.3836 * 1023.0);)
3. how did you get the value of 1.3836
thanks
1) Sorry for the confusion. The code should be updated. I initially used 100k and 1k for the voltage divider. That is almost the same as using 6x 47k resistors and a 3.3k resistor (in series). Using 6x 47k and a 3.3k resistor instead helps reduce the power consumption. You'll get more information about this in the article I wrote.
Delete2) and 3) ADC_Get_Sample gets the ADC digital output (10-bit: 0 to 1023). The *5.0 and / 1023.0 scale the ADC result to a 0.0 to a 5.0 (a little less actually) level that represents the actual voltage present at the ADC input pin. 101 is the multiplication factor to get to the actual DC voltage level. Kc is the scaling factor (as saved previously in the EEPROM as the calibration value). 1.3836 is my measured AC to DC conversion ratio. I noticed (upon measurement) that my DC voltage was 1.3836 times the AC RMS value and not 1.414. So I just used that.
Hope that helps.
Tahmid.
thanks for your candid explanation, i am very grateful.
Deletebut please can you explain this too.
//Voltage_FLOAT = Voltage_FLOAT + 1.5;
thanks
That was just for my testing - to test for an "offset". You can ignore that - that's why I commented it out.
DeleteRegards,
Tahmid.
Have you built the circuit and tested it?
DeleteTo be candid i might not really make this circuit, but i am going to use a lot from the code and part of the circuit in making my next inverter. Particularly the calibration part of the code, the AC measuremaent for feedback (i ve been having issues with these for a long time). Now i know how to measure the AC voltage and display a correct value using your code and following your explanation. Well maybe i cud include tapping on the xformer and make the inverter also behave like a regulator. But truly i m going to copy a lot from the code.
DeleteI am a very huge fan of proton basic. I have to convert all your code to basic so it takes a while due to syntax differences. But I am learning Mikro C already so i might migrate fully to using C to develop my code.
thanks for your help everytime.
ABM
Thanks for sharing the knowledge.
ReplyDelete1) Kindly tell where the calibration pot is located ? Is it a part of voltage sense section ? or it is separately connected to the micro-controller.
2) whats the value of calibration pot?
3) whats the value of capacitor connected at the output of voltage sense section (that was referred in the article as being parallel to the adc input capacitance)
1. According to the article and the code writeup, the calibration pot is on one of the ADC pin of the micro
Delete(const unsigned char CalibratePot_CHANNEL = 1;) which means AN1 of the micro check the datasheet of the micro search for the pin that has AN1 then u wil get the pin number
2. He mentioned 5k if i am correct
3. he said between 10uf to 33uf but he said he chose 22uf.
hope it helps
According to the article "To ensure that the ADC measured the low-voltage DC level properly, a capacitor was placed at the output of the voltage divider section such that this would act as a parallel capacitance to the internal one (of the ADC)." I am referring to this capacitor value. I think the 22uf capacitor is used as a high voltage (450dc) filter capacitor (to convert AC to DC) in the voltage sense section. Moreover, the article does not mention the value of calibration pot. I am confused whether this 5k pot is part of sense resistors or it is separate. The schematics can clearly show this.
Deletehope u understand my point
Thanks
The parallel capacitance is 0.1uF (100nF).
DeleteThe calibration pot is a 5k pot.
Regards,
Tahmid.
i my possible we can show input voltage value , output voltage value , output current in amp & output power in watt or kwatt ?
ReplyDeleteYes it is, but then modifications need to be made since the PIC does not have enough pins left.
DeleteAdditionally, it may be better to switch to an LCD screen if all those parameters are to be shown.
Regards,
Tahmid.
its PIC16F873A Pin Configuration
Delete*
* O = Output
* I = Input
*
* ________
* MCLR | 1 28 | RB7 --> (O) == DIGIT1 CC H CA
* ADC1(I) --> AN0 | 2 27 | RB6 --> (O) == G CA
* ADC2(I) --> AN1 | 3 26 | RB5 --> (O) == F CA
* DIGIT2 CC == (O) <-- RA2 | 4 25 | RB4 --> (O) == E CA
* ADC3(I) --> AN3 | 5 24 | RB3 --> (O) == D CA
* Delay_SW (I) --> RA4 | 6 23 | RB2 --> (O) == C CA
* DIGIT3 CC == (O) <-- RA5 | 7 22 | RB1 --> (O) == B CA
* Vss | 8 21 | RB0 --> (O) == A CA
* OSC1 | 9 20 | Vdd
* OSC2 |10 19 | Vss
* RL4 == (O) <-- RC0 |11 18 | RC7 --> (O) == LED_HILO
* RL3 == (O) <-- RC1 |12 17 | RC6 --> (O) == LED_NORMAL
* RL2 == (O) <-- RC2 |13 16 | RC5 --> (0) == LED_DELAY
* RL1 == (O) <-- RC3 |14 15 | RC4 --> (0) ==
* ---------
I'm right ?
why u 3 ADC ?
where its Schematic diagram ?
ReplyDeleteI haven't yet completed drawing the schematic on the computer. I have it drawn by hand. I'll upload it soon when I finish drawing it.
DeleteRegards,
Tahmid.
how can open PCB_v9.LYT ?
Deleteu can use ExpressSCH for draw Schematic diagram .it is very easy for Schematic diagram
ReplyDeleteThis comment has been removed by the author.
ReplyDeletepl tell me
ReplyDeletehow can open PCB_v9.LYT ?
or give the link its PDF ver.
pl up load drawn by hand Schematic diagram .
ReplyDeletehi Mr.. Tahmid.pl post or mail me its sch diagram .
Deleteshivendrakumarsahu@gmail.com
Schematic has been uploaded.
DeleteHello Thamid. I have a question about a PWM Full Bridge Primary Current waveform. I read a lot about it. Nobody could give me an answer. Please, where can I find you? Thks! ALU
ReplyDeletehi tahmid
ReplyDeletei've been reading your blog and i got interested in your projects concerning sinewave inverters
for commercial affairs.
if you wish, please don't hesitate to contact me
rafaelholguin@yahoo.com
hi tahmid
ReplyDeletei've been reading your blog and i got interested in your projects concerning sinewave inverters
for commercial affairs.
if you wish, please don't hesitate to contact me
rafaelholguin0288@yahoo.com
pls give me parts list
ReplyDeleteTahmid Sir, thanks for creativity, I love Technology, Your post & video is most useful & helpful for Bangladeshi electronics hobbyist, now you will publish circuit diagram for complete lesson
ReplyDeleteMr Tahmid, please make tutorial dc-dc converter.
ReplyDeleteHi,TAHMID
ReplyDeleteI compile your given .c file and got hex.
And check with proteus all is fine except,adc module become inactive during start up delay.
Either delay is 2000ms or 3 minutes.
Adc module did not work and relays are off during delay time.
I hope you will think about it
Hi sir I will need your help in the same product which you had made...Automatic Voltage Stabilizer...
ReplyDeletePreviously I have one of the kit..Please see
http://www.solarindianproducts.com/automatic-voltage-stabilizer-kit.html#automatic-voltage-stabilizer-kit
I want to make prototype of this kit but not able to program the IC because I am not able to get correct algorithm..I will send you more Visible pictures..can you help me regarding this means programming the IC...yours...Lucky
WHERE IS PART LIST AND SCHEMATIC?
ReplyDeleteWill be available within the next week.
DeleteThank you soo much for the fast answer !!! :)
Deletehow we design automatic voltage stabilizer for any range of input and tell us formula for calculation, please help me,
ReplyDeleteThank you very much, greetings from Serbia
ReplyDeleteplease post Fuse bit ...
ReplyDeleteOscillator = HS
DeleteWatchdog timer = Off
Power up timer = On
Brown out detect = On
Low voltage program = Disabled
Background debug = Disabled
Code protect is up to you.
Hi boss, Which software can I use to open lyt file?
ReplyDeleteProteus ARES. I've added image versions of the file so if you don't have Proteus you can use the image version.
Deletedear tahmid sir
ReplyDeletei am aneesh, i like your tutorial, i gained too much knowledge from you
i have 1 doubt sir,i am making 700va high frequency inverter using sg3525, in that circuit (CT-3.3nf,,,RT-6.8k and RD-47E)are used, then what will be the frequency,,if 66khz HF transformer frequency will be half of that, please help me sir,
which core better ETD 55 or EE55 please replay me
thanks@regards
Hi bhai, ami apnar c file dia hex compile korar chesta korsi kintu ekhane error dekhasse. Ami mikroc pro use korsi. Apni ki kindly hex kore dite paren. hex file ti dite parle upokar hoto. Thanks
ReplyDeleteHi boss, can you post pcb and parts list without led display?
ReplyDeleteThe 7 segment display is used to calibrate the unit. So, it should be added. However, if you feel like skipping it, you can just omit it once calibration is done.
DeleteHi bhai, ami 16f873a id ta dhaka er market a passi na. Ami akhon ai ic er alternate kon ic use korte pari kindly janaben.
ReplyDeleteYou should be able to find the 16F873A easily. Did you look for it at Patuatoly?
DeleteHi boss, Make another voltage stabilizer using pic without display. I think this is very hard to make it for me.
ReplyDeletehi, sir i am rajeev from patna, i am making 90v-280v ,16f676 based,relay voltage stabiliser kit,with lo,hi,cut,&timer,with 7 segment voltage display,extra facility- lo cut on off switch,quick start switch with LT supply.
ReplyDeletethanks
hi, dear brother that u done is great,,,but i need some help about programing that ic i also need its programing data ( Hex ) & how can i program in ic,,,& thanks a lot....
ReplyDeletedo u have a skype to talk my skype marcony641
ReplyDeleteHi Mr. Tahmid can I have ur email
ReplyDeleteBoth files CODE and hex gives the same .c file for download. Is a hex file available anywhere for download?
ReplyDeleteOk..the link doesnt work for hex file. Copying the text and pasting in a new browser window gives the hex fle. Correct it if possible.
ReplyDeletehello sir, i am a new student of microcontroller.... i want to use PIC16F877A & proton Ide coading. will u help me?? and i want your ready-mate pcb board.....please sent me your instruction....this is my email: arifmishba@gmail.com & contuct number is: 01824294744
ReplyDeleteI have not used Proton and will likely not be able to help you in that.
DeleteIf you have any general PIC questions, feel free to email me at inferno (hyphen) rage (at) hotmail (dot) com
dear Tahmid , its work very nice .have some problem in code .
ReplyDeletewhen mcu intered in delay mode adc not work , its then , when mcu exit form delay mode .
pl guide us .
it possible Automatic voltage stabilizer (AC-AC) with with out relay ,we can use IGBT for AC-AC regulation ?
if yes pl do something .i konw u complet this task before telling me .
if u cont post here due to commersicail rigion ,pl mail me those source cost.
Hello Tahmid I need 10 volt step not 25 volt and also 12 and 24 volt battery charging feature in it if possible then plz help me thanks
ReplyDeleteIf you want to reduce the voltage step, you will have to increase the number of tappings on the transformer.
DeleteI am no longer developing voltage stabilizers and so will not further implement battery charging.
Always test your health with better ways ,contact us :- The Pcb test San Diego will try to gauge just what quantity of the contaminant has gotten into the soil. PCB soil contamination can be stalled if enough effort is given in the identification of the sources. It goes without saying that the pcb lawsuit California can be initiated if some company or business or enterprise is found to be responsible. Free pcb test will allow the people to know which are the problematic zones.
ReplyDeleteHello sir,
ReplyDeleteTell me about load rating which is already you connect in this project...
Thank u
It is running a standard refrigerator.
DeleteGive me current rating of the transformer.
ReplyDeletethank you
That depends on how much load you want to drive. What type of load are you driving?
Deletethank you
ReplyDeletehave you tested it the generator? I had made one servo controlled stabilizer, it worked well with line voltage but when generator is on it does not work well. Output voltage increases 10V. I think there is some problem with the sensing circuit. Do let me know if you face this problem
ReplyDeleteInteresting.
DeleteI have not. If the generator generates 220V (standard rated) 50Hz sinusoidal AC, I don't see why there should be an issue. What type of generator was it? Do you have a model no.?
Hi Tahmid it's me Derrick from Uganda am trying to build your automatic stabiliser based on the PIC 16F873A.I have finished the PCB but I have one question and it's on the 3 digit 7 segment display.1-i want to know what is its inches? 2-Is it a common Anode or a common cathode 3 digit 7 segment display? Thanks for your help and work you do to help us learn electronics you are a teacher to many.
ReplyDeleteHi Tahmid am trying to build your automatic stabiliser based on the PIC 16F873A.I have finished the PCB but I have one question and it's on the 3 digit 7 segment display.1-i want to know what is its inches? 2-Is it a common Anode or a common cathode 3 digit 7 segment display? Thanks for your help and work you do to help us learn electronics you are a teacher to many.
ReplyDeleteHi Tahmid, Can u through some light on the following lines of code. I am unable to understand the logic behind the calculation of Kc
ReplyDeleteCPot = ADC_Get_Sample(CalibratePOT_CHANNEL)/2 + 128;
Kc = (float)(CPot * 2.0)/1023.0;
Thanks
Hi i designed the same circuit with atmega8 the mcu checks the input for every 22ms.......i'm using lcd instead of 7 seg..the delay bet enable pin of lcd is 600us i cant reduce it as it's not displaying properly if i reduced it............. is this normal to measure 20ms (50Hz) sine wave at every 22ms and change o/p depending on it.......will it cause damage to load within this time period.......i increased the crystal frequency but i noticed that only time consuming element is lcd..and got 16ms sampling rate
ReplyDeleteI built this circuit but when i switch on the power, transistor Q8 (2N2222) immediately burns up and smoke is seen coming out of it even if i replace with a brand new one same thing happens please help.
ReplyDeleteIs the 7 segment display used is common anode or common cathode type?
DeleteIs the 7 segment display used is common anode or common cathode type?
DeleteI have done this project and burnt the HEX code you provided but the circuit does not do anything at-all and when i short the calibration switch then the delay led goes on but without doing that the circuit just sits there doing nothing.Pliz help what do you think is the problem i have checked the circuit many times and i dont see any problem i think its in the code which i cant check.
ReplyDeletemy mail refatct@hotmail.com.... pls send ur cell no. it's 911
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAsalaamOAliakum
ReplyDeleteTahmid plz tell me wht is the pcb size in inch Y and X .
Thankyou.Mine email yasiralikhi2@gmail.com
hi tahmid brother can give me proteous simulation files or any other software filw that you used for simulation i saw you use proteous please share these file. i have on objection in your schematic part a in microcontroller circuit vrelay that is connected to diodes and vdd are act as input but on relay circuit in part b vrelat is a power source
ReplyDeleteAsalaamOAliakum
ReplyDeleteTahmid plz send me display actual size pcb.Thankyou
Email yasiralikhi2@gmail.com
great job, but still don't understand about auto transfmormator make me confuse. it's the common transformator step down type (0,110,220 for primary winding, and 0, 12.5,25,....,165,195,etc),or anything type, i'm waited for the answer, tx
ReplyDeleteThis is fantastic brother .... speechless ... m hobbyist and i'll make this as my 2nd semester project m using jwm programmer ... u didnt shared proteus isis file , if u do i'll be too much thankful... may God give u more success in serving people , www.creativeeagle.blogspot.com
ReplyDeletevfdghdfghcc
ReplyDeletesir
ReplyDeletei am new student in microcontroller.i want to make a voltage stabilizer.how to sense input voltage in micro c.to switch output relay.
please help me.
would you tell me about the primary voltage range and turn ratio and amperes. because i want to run 2000 watt load.. please tell me as soon as possible.. and you designed a nice circuit. My email is "allahhooooo@gmail.com".
ReplyDeleteplease tell me whole specification about transformer. from primary to secondary...
Deleteis it necessary to use an auto transformer with a particular tap voltage ratio or any kind of auto transformer of 120v-270v will work?
ReplyDeletegood job. i have used the code and as well redesigned it to suit my needs. welcome
ReplyDeletegood job, Did you made the proteus schematic to work?
DeleteDear Tahmid, thank you very much for a well designed circuit ! I am beginning to learn little bit of electronics from you blog.
ReplyDeleteHere we have power supply problems, anything between 100v to 290v ! Would you be kind enough to modify your Stablizer circuit and program to address this issue? I plan to use a 2KvA Transformer to feed my house wiring as per output voltage(s)designed from your end(if possible). Thank you very much in advance.
With kind regards
Imsa Naga
imsayuba@gmail.com
Can I further request you to modify your code/circuit to use 16x2 LCD in place of 7 segment display ? I am new to PIC programming but can transfer codes to PIC!
ReplyDeleteThanks again.
Imsa Naga
hi sir,
ReplyDeletePlease give your mail id and contact no. my mail id vasuvit@gmail.com 8838899551.
http://acecct.blogspot.com.ng/2015/11/microcontroller-based-avr.html?m=1
ReplyDeletecan u upload c code for avr chip?
ReplyDeleteThanks for this interesting project. Please I want to know the type of 7segment display you used. Is it common anode or common cathode.
ReplyDeletePlease I did the circuit pcb and all works but when I power after calibration it shows the High/low led and nothing happens. The calibration seems working well and have been set properly. I need help urgently.
ReplyDeleteVery nice and informative blog. I like reading your blog regularly. Keep sharing such amazing information.
ReplyDeletehello bro,
ReplyDeleteI open the source code in MPlab IDE. but it show compile error. can you tel me the IDE you used please....
Regards
Partho
Hello Syed Tahmid Mahbub.
ReplyDeleteI open the source code in MPlab IDE or PICC, and it shows compile error. In which compiler you have compiled your source code.
Hugs,
He mentioned Mikro C pro
DeleteHi sir I'm intrusting in programming pic can you help me sir.
ReplyDeleteI really enjoyed reading your post. We at Enertech also brings Voltage Stabilizers for the clients that are widely accepted for providing constant voltage even under unbalanced electric conditions. Our stabilizers are appreciated for their salient attributes like reasonable prices, stable output and free warranty. We make sure that our clients are provided with the stabilizers that are stringently tested on various parameters.
ReplyDeleteFor more information - Visit today.
Hello Tahmid,
ReplyDeletePlease, I just assembled your PCB as it is and load the Hex file onto the ship as it is but there's no response at all. Power to the chip is ok at 5.0V and any other points received supply.
Please, is there any issue with the Hex for I've troubleshoot a lot even the code could not compile on MikroC pro.
a certain portion of the code ""while (ADC_Get_Sample(CalibrateSW_CHANNEL) < 512){ // While Calibrate switch is PRESSED""
Please kindly help.
Thanks.
what this code does
ReplyDeleteCPot = ADC_Get_Sample(CalibratePOT_CHANNEL)/2 + 128;
why u mtlply kc by 10000 if it btwn 0.00 to 2.00 why not mltbly by 100
Congratulations
ReplyDeleteNice information
ReplyDeleteDear sir,
ReplyDeleteI want to make the same automatic voltage stabilizer for my project but i don't know how to make the pcb. So could you help me out. What is circuit diagram and pcb layout for this project.
Dear sir,
ReplyDeleteI want to make the same automatic voltage stabilizer for my project but i don't know how to make the pcb. So could you help me out. What is circuit diagram and pcb layout for this project.
9870128641 my no.