drjohsmith
- Joined Dec 13, 2021
- 1,614
looks like a good circuit to me ,measuring voltage accurately is certainly nice but... in this application i don't think it makes any difference (True RMS, average, peak...). all that matters is reading that changes proportionally with mains voltage. more over, low values are not important - if the voltage drops from 220 to 5V or 15V, or 60V, it makes no difference - all of them are too low. and that means that puny 0.6V drop due to diode makes no significant difference.
so idea in the very first post to measure peak voltage can work but ... it could (and should) use transformer for isolation.
in fact it should be good enough even without dedicated transformer. one could use same transformer that powers Arduino and relays. the key is measuring DC bus voltage before regulator(s). after all load is constant - most of the time. the only change is at the moment you are switching to another relay and - it is always just one relay that needs to be on (so constant load).
i did a little test:
View attachment 362130
as you can see voltages at nodes marked ADC0 and ADC1 track changes in V1 voltage.
at first it was voltage divider R2/R3 with smoothing cap C2. D5 was added to clamp voltage to safe value to analog input does not get harmed. R4 and C3 are added for extra filtering.
View attachment 362131
and the above graphs are after i introduced a bit of disturbance (I1 to simulate some change in load).
zoomed in it is something like this:
View attachment 362132
schematics could look something like this:
View attachment 362133
the red lines are for high current. TR1 should produce high enough voltage for relays even when mains voltage is down. due to large swing in unregulated voltage across C2, 12V regulator should be switching type and the simplest option here is to use ready made unit.
I like U3 in place of diodes / fets . neat.
when the relays switch, will the 12v stay up or glitch. U1 is a dcdc ? does it need a specific minimum output capacitance ?
Last edited: