Voltage Sense Circuit not working (sure its my fault, but can anybody help?)

Can anybody help? Please :slight_smile:

First off – I am sure its something I am doing wrong!

I am unable to get voltage sensing to work based on the circuit and code from : Measuring AC Voltage with an AC to AC power adapter — OpenEnergyMonitor 0.0.1 documentation

The symptom is :

  • When I measure DC voltage in between R2 (1

00k) and R1 (10K) its always 1.579 volts with the transformer plugged in or not : I was expecting 1.579v + approx 1v from the stepped down 10v from the AC : thus 2.6v

  • When I measure across the transformer on the breadboard I get 10v ac
  • When I measure across the middle of the 100k/10k divider (R2/R1) to one leg of the transformer I get 0.9v ac
  • When I mesure across the breadboard 3v supply rails I get 3.3v (I stopped using an Arduino, simply using a 3.3volt power supply)

I started off with doing a PCB directly from circuit at that page ( I got the current sense to work but not the voltage)

So I tried on a breadboard - couldn’t get it to work (Meaning I got the above symptoms)

So I did a Frankenstein on the breadboard (see below pic) in case some of the connections into the breadboard were not working well (basically I twisted the 100k/10k resistors together, and used the same breadboard hold for multiple connection points to try and ensure a solid connection.

I know its ugly but could anybody spot what I am doing wrong – please :slight_smile:

I attached a PDF picture and some lables/arrows to try an d show you what I had (hope its attached!)

Voltage_Sense_Not_Working.pdf (1.2 MB)

Welcome back :+1:

Though the 1.579 V should be closer to 1.65 V (half of 3.3 V if you have 3.3 V supply, 2.5 V if you have a 5 V supply) - those voltages are certainly not that far off that you won’t read something.

You shouldn’t be - most DVMs will not see an alternating voltage sitting on top of a d.c. voltage when using the d.c. range. Or if they do, the value will jump about. Many DVMs will give the wrong answer if you use the a.c. range (i.e. they will read part of each component, not just the a.c. part), though some will read the a.c. component correctly.

One thing I can’t see is the 1µF or larger capacitor from the junction of the 330 kΩ resistors to GND, unless it’s a tantalum and the small fawn component. If so, is it the right way round? The omission of this will certainly harm the accuracy of the reading - when you get there.

I suggest you start from just the power supply (check it!) and do one step at a time, confirming by measuring.

  1. Connect the two 330 kΩ resistors and the electrolytic capacitor, measure the capacitor (midpoint) voltage (1.65 V d.c.)

  2. Separately, connect together the transformer and the 100 kΩ & 10 kΩ resistors and measure the voltage across the 10 kΩ (~ 1 V a.c. – 0.9 V a.c. is fine).

  3. Connect the bottom end of the 10 kΩ to the midpoint, check those voltages again. They should be the same. Also, I’d expect you to read the same d.c voltage at each end of the 10 kΩ and at the other end of the 100 kΩ, definitely with no mains on the transformer, and depending on your multimeter, probably also with the transformer energised.

  4. With no mains on the transformer, connect the junction of the 100 kΩ & 10 kΩ resistors to your Arduino input pin and check the same voltages again. They should still be the same.

  5. Finally, put mains on the transformer and check the voltages and your sketch - making sure you’ve got the correct input pins.

Thanks Robert - I was hoping you would respond :slight_smile:

This last two years away been dealing with multiple issues (no project) so not focused on my electric monitoring project :frowning: Though the help you gave back then was great!!

I did have an electrolytic cap in the circuit, the fawn (terribly British old bean!, here in the US I get used to saying 'brown or beige! but yes, the fawn color!! is the cap I substituted yesterday from the electrolytic - the fawn color cap is a 1uf cap - i had in a 10uf prior and prior to that I had 1uf electrolytic and prior to that I had a 10uf electrolytic)

The only common denominator is the transformer ( A 9v Jameco ac ac) - after working through your suggestions I was planning on swapping transformer)

I will follow your problem solving guidance to the letter tomorrow! (Sat)

I am pretty convinced I am messing something up and its going to be embarrassing when I find it!!

Once again - thanks for the suggestions!!

Meaning, I can’t see why it’s not working, so your problem is more likely to be elsewhere. Following what I wrote exactly, and not changing anything until we’ve proven a problem, will be the quickest way to get it solved. We don’t want multiple variables, all changing at the same time.

Thank you… :slight_smile:
Well, I need to fall on my sword…everything seems to be functioning now.

I wasn’t aware that my dvm wouldn’t read the ac signal + the bias ….so I was NEVER going to find the issue as I had stopped using the Arduino and was relying on testing with just my meter but was expecting to see the voltage on the output of my breadboard (that had previously been connected to the Arduino) to rise to 0.9ac + 1.6 dc…… and now that I type it like that I guess its obvious….

Anyway, Robert, I went through each of your steps, I got the results you expected  so plugged into my Arduino… and lo-and-behold- the standard Emon sketch worked :slight_smile:
The only problem is I cant find out exactly what I did wrong ( I wanted to reverse into my fault, then move forward etc).
I am going to assume I had messed-up some wiring.

So….THANK YOU V MUCH for forcing me to go back to basic steps!!

I am now looking at the two calibration values
emon1.voltage(A1, 133, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(A4, 90.1); // Current: input pin, calibration.

For voltage : I got 133 by
Rt = 120v (mains voltage I was just guestimating) / 10.5 (output from transformer whilst plugged into my circuit) = 11.42
Rd = (R1+R2) / R2 = (99.7.7 + 9.95) / 9.95 = 11.02
Calibration = Rd * RT = 11.42 * 11.02 = 125.8
But this didn’t quite get the voltage that I measured at the main breaker panel, (that being 121) so I moved up the calibration till I got 121volts for the Vrms value on my Arduino

I think I need to read the learn pages again (and again) as when I turn on my test heater blower (1500watts) with the same breadboard circuit (but after I have added the CT sense circuit - the Vrms starts at 125, then when I turn the blower on the Vrms drops to 119v according to the Arduino. I will read more :slight_smile:


My money would be on the wrong Arduino pin.
Join the club. The next time I do that won’t be the first - by a long way. My favourite? Edit one copy of a sketch and upload a different one, and spend 10 minutes trying to figure out why the change did nothing.

This is never a bad idea. It’s almost the same as explaining the problem to a Rubber Duck.

There’s nothing wrong with that.

What’s the betting your DMM shows the same thing happening?
I don’t think you’ll find this in ‘Learn’. I’m not experienced in US practice, but a 4.8% voltage drop for 1.5 kW at 120 V doesn’t sound unreasonable to me - you’re talking 12.5 A nominally, and it’s the voltage dropped by the resistance of the wiring, switches, fuses/breakers etc between the place where your 10 V transformer circuit joins the heater circuit and your local distribution transformer (and the impedance of the transformer), so about ½ Ω total in the loop of hot + neutral.
UK rules say a total voltage drop from the supply coming in must not exceed 2.5% (at 240 V), but all our currents are half yours for the same power.

Because it’s considered a performance issue vice a safety issue,
the US NEC (National Electrical Code) doesn’t mandate a voltage drop specificaton.
(there are a couple of special use exceptions to that rule)

12.5 Amps is only 0.5 A more than the current drawn by a typical US upright vacuum cleaner.

I was hoping you’d chip in here.

Obviously attitudes are different each side of the pond regarding performance. It’s still a performance matter in the UK, the regulation is in place to assure all appliances will function properly wherever they are connected - close by or a distance from the point of supply.

Keeping in mind we use branch circuits vice the ring main used in the UK,
adequate performance is achieved by keeping the number of loads on longer runs
to a number that takes into account the size of the conductor in use.