I'm looking to eventually build an energy monitoring circuit using a raspberryPi as the controller and some type of ADC as the collector. I'm generally following the architecture of the emonTx used at openenergymonitor, except instead of using an Arduino I'm planning to use some type of smaller, discrete ADC, such as the Adafruit 1015 breakout board, or some variant of the MPC3208. While looking at various ADC options I've come across a few questions that I can't seem to find simple answers to...

1) How do I optimize input range vs. accuracy? The initial current-transformer I plan to use has a range of +/- 333mv, but it's possible to find similar ones that have an output range of +/- 1V. Is it correct to assume that the one with the "larger" range will give more precision? If so, is there a way to know where it's a meaningful amount of additional precision? (Practical question: do I need to go through the hassle/expense of finding/ordering a 1V model CT?)

2) The 1015 breakout board has a built in ability to increase the gain - but I have to assume that increasing the gain will also increase the noise. Is there any way to know (explicitly or just "by experience"?) whether the noise/inaccuracy introduced by the gain setting will be better or worse than the error introduced by building a more complicated circuit to lift the voltage into an acceptable range for the ADC?

3) Assuming I have control over the reference voltage on the ADC, is there a meaningful difference between using the bottom end of the range vs the top end of the range? Or does the convenience of being able to use an existing rail (i.e. the 5V that already powers the raspberryPi) outweigh this?

4) Is the extra circuitry on the breakout board useful in this type of application? I can clearly see where the ferrite and capacitor logic helps reduce the noise, but I have no idea whether we're talking about meaningful changes for this type of circuit. ;-)

And I fully recognize that it's possible that the answer is "it doesn't really matter, because no matter which of these you choose the circuit is going to be XXX accurate anyway which is way more precise than you need to monitor home energy use" - if that is indeed the answer then that info is useful, but I'd still like to understand how the above questions would be taken into consideration if we assume that ultimate precision is required (which I realize it's not...)

  • \$\begingroup\$ You might find this useful. It's an Energy Monitor I built for the Arduino Yun: instructables.com/id/… It covers many of your questions about Transformer, filter etc.. In particular you might find the Digital Filter useful to reduce noise. Also info on measured accuracy with Arduino's ADC. \$\endgroup\$ – akellyirl Mar 2 '14 at 14:17

Is it correct to assume that the one with the "larger" range will give more precision? If so, is there a way to know where it's a meaningful amount of additional precision?

To calculate how much precision you get using different CTs and different ADC configurations, you need to know how much the CT voltage varies per amp and what proportion of the full-scale input range that corresponds to for your ADC

If you use a 50A, 1.0Vac CT, the peak voltage will be sqrt(2) * 1.0Vac = +/- 1.41Vdc. Note that you will need to map this to the range 0 .. 2.82Vdc (or similar) since the ADS1015 doesn't allow negative input voltages (check the absolute max ratings in the datasheet: no more than -0.3V on any input)

So your CT maps 0 .. 50A to 0 .. +/- 1.41Vdc, varying by 28mVdc per amp

Looking at the datasheet for the ADS1015, there's a table on page 10 which shows the full-scale voltage ranges for different gain settings. A gain of 1 with FS of 4.096V seems most appropriate here since you need a FS value larger than the 2.8V you want to read. Note that you won't be able to read voltages higher than the 3.3V provided by your RPi with any gain setting!

I'm not particularly familiar with the ADS1015 but I understand the reason those FS ranges are given as plus/minus 4.096V is that you can use it in differential mode and if the 'negative' (or inverting) side of the input is higher than the positive (non-inverting) side then your reading is considered to be negative. Both sides of the input still have to be positive, however - don't forget about the absolute maximum ratings of -0.3V to VDD+0.3V!

Anyway, if you have a measurement range of -4.096V to +4.096V and a resolution of 4096 (12bit) then you get a voltage resolution of 2 x 4.096V / 4096 = 2mV

So if the CT output voltage varies by 28mVdc per amp, and we can detect changes of 2mV with our ADC, then we can detect changes of 71mA to your house current draw (28/2 = 14 steps per amp, 1/14 = 0.071A). I suspect that's more than enough accuracy for your domestic purposes.

What if you use the 50A, 0.330Vac version?

  • Peak DC voltage is +/- 0.467Vdc
  • Gain setting should be 4, giving a FS value of +/- 1.024Vdc
  • ADC resolution is 0.5mVdc
  • CT varies by 9.3mVdc per amp
  • Minimum detectable current change is 54mA

So you actually get better precision using the 0.330Vac version and a higher ADC gain, however you will be more susceptible to noise. Will the noise be significant? I have no idea - you can only answer that empirically. However, you can be sure that the 1.0V version will be less noisy, so if a resolution of 0.071A is precise enough then the 1.0V option may be best


Any half decent cheap op-amp based amplifier will not add significantly to the signal-noise ratio meaning, that if the amplified signal is noisy then it is because the input is also noisy. However, amplifying gives more resolution so I'd go for an amplifier to maximize your range. Using the internal ADC amplifier shouldn't cause problems either.

On the noise side of things (and assuming you are trying to calculate RMS current or power), I doubt that anything other than a seriously noisy signal is going to give problems. Apart from that there is a fair chance that the noise will be out of band (high frequency stuff) and therefore can be filtered out. If it is high frequency noise then YOU MUST filter it out before it goes into the ADC or you will get aliasing and errors in your RMS or power calculation.

So, in summary, so far: -

  • Use an amplifier to maximize resolution of your ADC (the internal one is OK but...)
  • Use a filter to remove high unwanted frequencies to ADC prevent aliasing.

Assuming I have control over the reference voltage on the ADC, is there a meaningful difference between using the bottom end of the range vs the top end of the range?

Most ADCs can have their reference voltage tweaked a bit and some can have their reference voltage taken as much negative as positive but, in this example you are likely to get better performance marginally across a bigger input range and if more amplification is needed you should definitely use an external amplifier and/or the one internal to the ADS1015.

Another thing - you'll need to centre the signal between upper reference voltage and lower ref volts (usually 0V).

If you are going to filter the CT output then apply the same filter to the voltage input so there is no net phase delay - this will produce a small error in measured power.

  • \$\begingroup\$ Thanks Andy. For monitoring household mains power, is it safe to assume that the noise will be out of band? Or should I plan to build a filter into the circuit regardless? Any chance you have a pointer (or even a suggestion on what to google) for the filtering portion of the circuit? And for centering the circuit, I assume that I can just uplift (is "bias" the correct term?) the amplified AC waveform by adding a voltage-divided DC signal to that wave, and choose the resistor values to center the peak-to-peak waveform within the ADC range? \$\endgroup\$ – ljwobker Jan 31 '14 at 3:02
  • \$\begingroup\$ Upkift with bias is spot on and try searching for Sallen key low pass filter. There is a site by a guy called Okawa whose got some good filter circuits on inc. Sallen key. \$\endgroup\$ – Andy aka Jan 31 '14 at 10:29

Have you taken a good look at Microchip's IC lineup? There are a handful of chips that basically cover every problem you list. The MCP3914 is a front end with adjustable gain and built in adc. It also has controlled/parallel sampling, which something like the mcp3208 won't do. If you don't want to do the math/work, you can use the mcp3905A or better, which just gives you an output pulse. The advantage to using one of these options is that most of the hard work is done for you all in one IC.

The MCP3914 isn't a hobbyist friendly package, but I think can be done with solder paste and a hot air gun.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.