Need help with 24 bit adc PCB design - Page 1
Forum section: electronics / projects

author: mcstomach
author_rank: Newbie
timestamp: May 28, 2022, 01:15:57 pm
content: Hi,This is my first post here on EEVblog forums. I am a big fan of the youtube channel, and thought I might go here for some guidanceMy background is automation engineer, so yes .. I am a young player in this electronics worldMy goal is to be able to read AC (current) on a 16amp fuse in my house. I want the resolution to be very high, although accuracy is not that important.For instance, I want the analog readings to detect even if a USB phone charger gets plugged in on the AC mains.It doesn't matter that much if the current measured is not 100% accurate.The ADC I have selected is the Texas Instrument ADS1252. This ADC communicates with an arduino Uno over a simple serial interface.I am aware that I need a very clean power supply to be able to achieve high resolution on this device. At the moment I do not have a precision power supply, but for the sake of testing the PCB, I have powered the device using batteries.Key components:ADS1252 - ADC, setup as a differencial input of -4.096v to + 4.096v (to minimize EMI)REF5040 - voltage reference (4.096v)Oscillator - Clock Oscillators SMD 12MHz 50PPM 50pFThe PCB is a 4 layer board, stacked like this:L1: Signals (+GND flooding)L2: GNDL3: 5V PLANEL4: <EMPTY> (Doh! Next revision will probably be GND here........)Board thickness is 0.8mmTrace width: 0.150mmVia size: 0.62mm (drill diameter: 0.305mm)I tried to separate the oscillator and ADC according to the 20H rule, although I am not sure if the extra signal trace will cause problems..I have a really cheap oscilloscope that I do not trust for anything except timing the DOUT/DRDY serial comms, so I have not been able to see where my circuitry is unstable.I am managing to get a resolution of around 10mV, with some huge spikes every second or even more often.Attached you will see the raw data results gathered from the Arduino (data.txt), and also the plotter chart on the arduino IDE.Data attached is in raw counts, so the scale is:Min value: -8388608Zero: 0Max value: 8388607Test setup:I am powering the Arduino from Laptop USB, and from there serially connected to DOUT/SCKL pin. The ADC pcb is connected to battery power. Analog input pins are connected to a separate battery source.The Arduino and batteries share GND. (or else my serial comm. wont work)Batteries have no filtering, direct connection to PCB / AI+ AI-My own thoughts on this PCB design:- I need stiching GND vias close to all power vias.- Remove GND flooding on layer 1- Add GND plane on layer 4Any tips on where to go look for these spikes?And also, any suggestions on how to improve the PCB layout to reduce EMI, crosstalk etc.Circuitry might also be the problem, I don't know..Please help!

author: DavidAlfa
author_rank: Super Contributor
timestamp: May 28, 2022, 01:53:13 pm
content: Are AI+- connected to the fuse?If so, are you concious that it's directly connected to mains through 1K resistor?Strange how nothing is blowing out, as the computer GND is usually connected to Earth.What's the fuse resistance? What's the voltage drop at 10Amps? What's the max current You want to measure?You must know all that to properly scale the input voltage.The fuse won't drop anywhere close as 4V, 20A would make 80W of heat, it's more likely to drop few hundreds of mV at most.So, you must amplify that, so the signal going into the ADC is able to use most of it's range, up to +-4V.Anyways 24-bit is overkill, once you amplify and scale the signal, you could discard the 2-4LSB, giving less noisier 20-22bits, and still having plenty of resolution (1-4M steps)

author: mcstomach
author_rank: Newbie
timestamp: May 28, 2022, 02:01:36 pm
content: I am not planning to connect the Mains to the PCB directly no.AI+ and AI- is now connected to battery supply, just for testing the resolution of the device - using a low noise signal

author: Sauli
author_rank: Contributor
timestamp: May 28, 2022, 02:34:46 pm
content: Most of the AD readings are at about 0.7 x Vref, so the battery you measure is about 2.8V?In your raw data you have for instance:6596272-17923766595324-67395516595340-1665953The negative readings are up to -0.7 X Vref. No way can that be noise. Are you sure you are reading the serial data correctly?

author: mikerj
author_rank: Super Contributor
timestamp: May 28, 2022, 02:57:21 pm
content: Post your Arduino code. As Suali says those huge spikes are unlikely to be a simple noise problem, more likely data corruption due to e.g. bus timing issues.Aside from that how do you plan to measure the current through the 16A fuse, are you going to add a current transformer?

author: mcstomach
author_rank: Newbie
timestamp: May 28, 2022, 06:09:24 pm
content: Hi,You were absolutely right, the error was in the code. I had some math calculation in a specific sequence which delayed the arduino CLK and corrupted the timing! ThanksNow I have very stable reading at 1.6volts without those insane peaks..Attached data.txt file show output reading. (with 64sample averaging, recommended by TI)For this test, I powered the ADC directly from the arduino.I believe the resolution is around 10-12 bit maximum from that power source...

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 29, 2022, 09:40:20 am
content: A friend of mine taught me that it is good practice to separate ground plane and signals near the connection points. Especially the connection to the arduino can bring a lot of noise to the table.Use PI filters with ferrite beads like shown in these excerpts of a schematic and look at how the PCB is done. You may have to play with the values to filter more specific frequency ranges.