Hi everyone, my apologies if this has been discussed already, but I could not find any suitable solutions so far for the following:
Main purpose is to measure grid voltage with arduino.
Easiest way is to go with any power supply transformers (not impulse one) which transforms 220V to suitable low voltages, I found one with 11.5 volt output in my electronics trash, and then with help of 2 resistors divided voltage down to suitable range of arduino's analog inputs i.e. 5v. But the problem is size of transformer itself.Smalest one I could dig out from net (available and relatively chip to instant order) is roughly 2x2x2cm in size, which would take a lot of space on my circboard.
So i did a little research, experimented with LEDs, burned couple optocouplers and after some calculations came up with transformerless solution (have not implemented neither tested yet)
What do you think would this circuit work and how accurate would be the measurements?
as per EL817 datasheet the following graph represents relations between forward current and transfer ration, which is more or less linear between 1 to 6mA currents:
I've used electrodroid's LED resistor calculator and found that 56K (disregard drawing showings) resistor would give circuit current between 1-5mA if power voltage changed from 80-300V, so looks like then optocoupler's readings should be linear too within this range?
First thing that happens is that capacitor explodes - 300+ volts feeding a 100v capacitor is not a good idea
Second thing is diodes explode since 1N4001 are only rated at 50V
Third thing is that opto explodes due to failure of diodes
Fourth thing that is that 56ohm resistor explodes due to excess current and voltage - and before you say it's meant to read 56k it's unlikely that a standard resistor will be suitable for 300+ volts applied
I suggest you go back to the drawing board and seriously consider the use of a miniature transformer to reduce the 220v down to say 2 volts. Much safer and less likely to kill you.
Then you need a precision rectifier circuit to eliminate the diode bridge voltage drop followed by a suitable smoothing circuit to eliminate ripple, but also including a drain resistor so that the measured voltage doesn't "hold up" in the capacitor
Hi, you are right, that was quick drawing without any typo checks, here is the real one.
Note!:
I've tested the circuit on white 3mm LED with 0.25W 220K resistor hooked to it and it works flowless, here is the pic of it:
So I assume if white LED works, then should Infrared LED in the optocoupler also working? yes currents and voltages are different, but principle is basically the same?
Here is the corrected drawing:
I've used electrodroid's LED resistor calculator and found that 56K (disregard drawing showings) resistor would give circuit current between 1-5mA if power voltage changed from 80-300V, so looks like then optocoupler's readings should be linear too within this range?
Once you get this working, you can calibrate it with a multimeter (assuming you have a variac available) and then put a calibration table in software.
And unless you live somewhere where you have horrible power problems, you can ditch the full-wave rectifier, use a single diode, and assume the positive & negative halves of the power voltage are equal. This will also cut the power dissipated in half.
DVDdoug:
Once you get this working, you can calibrate it with a multimeter (assuming you have a variac available) and then put a calibration table in software.
And unless you live somewhere where you have horrible power problems, you can ditch the full-wave rectifier, use a single diode, and assume the positive & negative halves of the power voltage are equal. This will also cut the power dissipated in half.
Thanks, that is the plan! simply was interested, may be someone else has assembled something like this...
elik745i:
Thanks, that is the plan! simply was interested, may be someone else has assembled something like this...
I did. I wanted to isolate the control pin for a three terminal variable voltage regulator and use the analog-out Arduino pin to control it. It turned out that the accuracy was horrible which was caused by the opto-isolator chip. If I even waved my hand near that chip the infrared radiation was enough to cause a large change in the output current and really messed with my control.
mstanley:
I did. I wanted to isolate the control pin for a three terminal variable voltage regulator and use the analog-out Arduino pin to control it. It turned out that the accuracy was horrible which was caused by the opto-isolator chip. If I even waved my hand near that chip the infrared radiation was enough to cause a large change in the output current and really messed with my control.
Isn't the opto-isolator a sealed chip assembly. That being the case then infrared emitted by your body surely couldn't be seen by the opto. perhaps it was capacitance effect on high impedance circuits or your body acting as a mains frequency "transmitter" that was the problem.
elik745i:
So how to get transformerless power supply to arduino board and the same time measure grid voltage within 1% accuracy?
and what does that mean,
That cap backwards and ready to go bang (still)?
which cap? not good with sleng
what does coconut to do with comments above
???
The software translation table is going to be a must if you have any hope of it working. I think you'll have a real hard time getting the accuracy to 1% using this method, but it might work. You'll also have to play around with the resistor value, most likely, to get the regime of interest onto the best part of the curve for measuring.
As a totally different approach, you could also divide the output of the rectifier way down, and try to measure that, but that's a somewhat scary setup - I'd be a little nervous working with it without an opto.
If you have that wired the way we're assuming you do, the cap (cap=capacitor) is backwards - you have the - connected to what I think is the positive side of the bridge rectifier. In any event, if it's backwards, you'll find out soon enough - electrolytics connected backwards will usually fail with a pop and a spray of foul-smelling electrolyte (though they don't fail as spectacularly as tantalum caps)
I'm not sure what he's going on about the coconut either.
Reference to a coconut is a metaphor from an old fun-fair expression where one was given a coconut as a prize when winning one of their stall competitions.
Well the rectifier/capacitor/opto coupler circuit only gives you the peak voltage, which isn't
particularly accurate when there are complex loads on the mains like lots of SMPS's.
Maybe its better to use a dual opto coupler, no capacitor, and route each half-cycle through a different
opto channel (protecting the emitter with a diode backwards across it otherwise the leakage
currents of the rectifier diode could damage the LED). That takes 4 separate diodes. For
resistors use 2 separate resistors in series (no single point of failure that could short the thing)
for each side.
Then you read the outputs frequently enough to be able to do proper rms and phase measurements.
Perhaps someone already has an IC to do this sort of thing?
I looked up a circuit for monitoring the voltage of electric fences (~8000 volts) a while back that used several 1Mohm resistors for a voltage divider.
How about doing it on the cheap (and dangerously?) by using four 1N4004 or above in a bridge configuration to rectify the voltage to something like 310 volts DC. Add a high voltage cap to smooth the output. Then use a few (4-5?) high value resistors in series with a low value one on the end of the chain to act as a voltage divider for your arduino to measure the voltage across. Using several resistors in series rather than one big one spreads the voltage and and wattage across all of them rather than concentrated in one.
Hi,
The use of a capacitor to drop the necessary volts has one big thing against it.
It is not isolated from the mains voltage.
I would steer well clear of it.
That thread has an image in it using protoboard to drop some high AC voltage down to LED levels.
Again not good, the protoboard is not rated for even 110Vac, and if its a cheap ebay one then it could flash over at any voltage.