MarkBryanMilligan / LanternPowerMonitor

The Lantern Power Monitor is a Raspberry Pi service, Java Web Service, and Android application that allow you to monitor every electrical breaker in your house, regardless of how many panels or breakers you have.
GNU General Public License v3.0
80 stars 26 forks source link

Bypass (decoupling) capacitors for ADC #29

Open LukeSkaff opened 2 years ago

LukeSkaff commented 2 years ago

This is a cool project and excited to try it out, thanks for all your hard word. I noticed the PCB design does not have bypass capacitors (decoupling capacitors) which is standard practice. This will help the noise floor of the design. You can also read page 4 of the ADC design guide which discusses this. https://ww1.microchip.com/downloads/en/Appnotes/00688b.pdf

I also noticed there are not individual filtering capacitors to ground for the current transformers inputs which are on other designs, was a benefit not seen from these?

MarkBryanMilligan commented 2 years ago

There are basically two halves to the pcb, one for doing the voltage monitoring and one for doing the current monitoring.

The voltage monitoring half is run off the 5V rail from the raspberry pi. That 5V is run through a 68kΩ resistor and then a 33kΩ resistor before going to ground. That makes the midpoint ~1.63V which puts the AC signal from the 12VAC transformer close enough to the middle of the 3.3V range of the ADC. That 1.63V DC offset voltage does have a 10uF decoupling capacitor to ground. So I'm pretty confident that the voltage monitoring side of the board is in good shape.

The current monitoring side is run off of the 3.3V regulated rail of the Pi. I used the 3.3V rail to run the ADCs and the CT offset because the 3.3V is regulated and regardless of what power supply you use for your Pi, the default CT calibration will be pretty close since the regulator seems to be decent and always gives 3.3V. I did run that 3.3V directly into the ADCs without any decoupling capacitor because there's not really any other variable load on that side of the board. The 3.3V signal gets split off to a couple of resistors to get an offset voltage for the CTs, and there is a decoupling capacitor at the midpoint of those resistors. So that load is very constant and I didn't think I'd need to have a decoupling capacitor after a regulator and before a constant load. You could try adding one on the 3.3V side of the board right at the power source and see if it makes a difference, but I kind of doubt that it would.

You are correct that I only have one capacitor to ground for all of the CTs. I didn't think it would make much of a difference and wanted to keep the number of components on the board to a minimum. The DC offset plane is pretty large and I'd be surprised if adding multiple capacitors to ground would make a difference, but I guess you never know until you try.

I guess the bottom line is, the board is super simple and gives very accurate readings as-is (within 1%), so I figured shrug good enough.

KodinLanewave commented 1 year ago

Realized this probably belongs here instead of in it's own separate issue:

Per the conclusions found in the following analysis for popular CT's: https://www.casler.org/wordpress/low-current-measurement-performance-of-the-sct013/ Adding a low-value ceramic capacitor on the input of each CT lowers the noise floor significantly; Is it possible to add pad provisions to the PCB for users to add their own filter caps? 0603 provisions seem doable to fit in whatever real-estate is left on the board. Going a step further, I'd also love a revision of the board where one can modify the ring/shield connections to allow proper grounding of the shield and input from the ring contact for each CT. This would require re-soldering of each CT's connector, however further improve the noise-floor of these devices. Obviously this would mean the wiring is fully incompatible with un-modified CT's, unless there were also headers/jumpers of some kind added to switch input contacts as needed. Just a few thoughts, and something I'd appreciate having the option for.

KodinLanewave commented 1 year ago

Looking at your PCB files, I'd like to work with your existing schematic; do you have a copy of your schematic design file(s) I might be able to import into kicad for modification?

MarkBryanMilligan commented 1 year ago

It's in the repo here: https://github.com/MarkBryanMilligan/LanternPowerMonitor/tree/main/pcb/EasyEDA

I designed it in EasyEDA, but there are format converters out there to get it into kicad.