Maker Pro
Maker Pro

Building a power monitor

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
That's a lot better.

However I notice a slow drift in the results. Any idea why that is happening?
 

jgauthier

Mar 22, 2013
53
Joined
Mar 22, 2013
Messages
53
I didn't even notice that. I will run a much longer sample and see if the trend continues. I'm using a hair dryer to create load, and it seems to create some noise. But the drift... odd.
 

jgauthier

Mar 22, 2013
53
Joined
Mar 22, 2013
Messages
53
The drift is because the DC offset is dropping. It starts at 1.65V, and dips to 1.61V and stays there. But it happens in the first few full waves. This being caused by the capacitor, which is a 10uF. When I remove it, the DC offset drops instantly. The source voltage never waivers from 3.3. I'm looking for a replacement cap.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,782
Joined
Nov 17, 2011
Messages
12,782
Alternatively add a hardware zero crossing detector and connect it to a capture/timer input of the µC. You then only have to register the time between two zero crossings as counted by the timer. this count will give you the period of the signal and hence the frequency.
 

jgauthier

Mar 22, 2013
53
Joined
Mar 22, 2013
Messages
53
I've solved the drift. My DC offset resistors were too high. The ADC wants little to no impedance on it's input. I read this can be solved by using an op-amp, but reducing the resistors in the voltage divider was enough that after constant readings, I experience 1/1000th of a volt drop. So, that is perfectly acceptable.

With my measurements, I am also recording the time in ns. I will use this after the readings to calculate frequency using my own algorithm, and it will not slow down my readings at all.
 
Top