Excessive noise, or my inexperience?

Started by Brian Davis, August 05, 2022, 01:06:27 PM

Brian Davis

I'm working with 328p-based dataloggers and finally got a CR as well as a proper digital 'scope (Siglent SDS1202X-E). But i'm not sure if what I'm doing is right or not. First, the safety... EVERYTHING I've done has only had the 'scope plugged to mains. The CR is running off a small flat-pack lithium battery, and the only time it has been plugged to mains via the USB connector is when disconnected AND turned off for battery charging. I've never hooked the CR up to anything via USB except for that. Likewise my DUT is powered from 3xAA alkalines. But as I tried to measure things, generally manually, I seem to be getting a lot of noise. So I stepped back to the simplest test I could think of.

Using a resistance substitution box and 3xAA battery pack, I measured with a cheap ($40?) DMM the current:
R = 1k --> I = 4.26 mA
R = 100k --> I = 42.7 uA
R = 300k --> I = 14.3 uA
I swapped out the DMM for the CR with OLED and tried again:
R = 1k --> I = 3.2 to 4.0 mA, constantly varying
R = 100k --> I = 41.5 - 42.3 uA, constantly varying
R = 300k --> I = 12.9 to 14.1 uA, constantly varying
Then I hooked the CR output to the 'scope to see what was going on. I physically switched the switch to get both the "zero" voltage (battery box off) and the "on" position (and I didn't bother with the 1k resistor):
R = 100k --> scope shows delta of 41 mV --> 41 uA
R = 300k --> scope shows delta of 14.2 mV --> 14.2 uA, but with an apparent depression *below* 0 V for the "off" position

I've also tried this with just the 328p on a board, having the 328p simply go in to sleep mode, wake up, and cycle that repeatedly (to see what the current draw actually is under a 'wake' vs 'sleep' state). The OLED display on the CR alternates between 0.0 mA and 4.4 mA (it's in manual mode, I didn't want to overload it). When I look at the CR output in the scope, I can see the system initialize and start oscillating, but it looks, to Me, like there huge scatter in the signal... triggering doesn't seem to work because little tiny random spikes keep triggering it in all sorts of odd places (the noise is larger than the signal).

Ultimately I'm trying to track down better ways of running the dataloggers, so I'm looking for results like the last graph (the 328p is sleeping then pinging at BME280 as well as a SCD30 CO2 sensor which is a power-hog that runs on it's own internal timing, no single-shot mode, ugh). If you look closely there's a Lot of vertical scatter making it sort of a "guess the middle of the band" exercise.

I'm quite prepared for me just not knowing what I'm doing... but I'm running out of ideas. I've only had the CR built for about a week, and I'm more confused now than when I started. I take the "don't exceed range / avoid ground loops like the plague" advice very strongly but I simply am at a loss as to if what i'm seeing is normal.

Felix

Hi Brian,
The way you're describing using the CR is safe. You could also attach to USB if you needed to, through a USB isolator that doesn't need to be expensive, see the guide.
If you use the OLED, the accuracy and especially the resolution of the OLED(ADC) readings will not be as high as the raw output, and this is especially true at the low end where a single ADC digit change can make a big overall difference (0.8mA/digit out of 3-4mA is very significant) and seem the unit is jumping up to a few mA back/forth. Add to that any noise picked up from the environment or through a noise prone circuit, and the problem can even be worse.
Also, the CR's calibration can be tuned a little (see MENU over serial with '?') to get even closer to what you'd expect or if you feel it is going out of calibration.

I would assume you have turned on the LPF function, which does help a lot with noise.
Also, as a side note, at 10mV per division the noise will be much more evident than at 50mV as can be seen in your screenshots.
Turning ON into a resistive load, you see a OLED reading of ~42.7mV, vs ~41mV on the scope, this is normal, and I'd pick the scope/DMM for closest accurate reading of the CR output, it's about one ADC digit reading away from each other.
For the 300k load, again they are close to each other, and the theoretical correct one is the 14.2, but measuring mV on the scope at 50mV/dev is not going to be very accurate either. So the more you approach measuring limits, the more any inaccuracies and will become evident. With a floating instrument like the CR we only care about the delta between the two scope cursors. I'd suggest the 20mV/div where the noise should be acceptable and allow more accuracy if you're using the cursors to measure.

The last 2 screenshots I'd say are normal, the 3rd being 10mV, that looks OK, just make sure you have the LPF on if you're in manual mode. The last one looks OK as well, and it clearly shows the response of the CR depending on what the DUT is doing.

I hope this helps.

Brian Davis

Thank you, that does help (or at least reassures) a good deal. I have played with turning LPF on and off, and at least in this case it doesn't seem to have an effect, but I'll have to experiment some more. The biggest problem right now is I have to trigger the 'scope manually due to all the noise, and I'd like to move to the uA range to figure out what's going on but don't want to overload it either. One sensor draws 60 mA when active, while the sleep currents are of course in the few mA to uA range, so the autoranging is going to be necessary... once I figure it out and trust what I'm doing (ad learn the 'scope better).

Felix

The LPF should definitely have a very visible effect on noise.
I would combine different measuring techniques to characterize your device in various sleeping modes. Sometimes it's easier to have a dedicated sketch/firmware for this purpose, to help you characterize the DUT in its various states, rather than chase it with the live firmware. The scope is useful to see what the current waveforms look like, but I rarely use that unless I have some special need to measure the ON-time of a specific type of wake/sleep/transmit cycle, usually I am more interested in average current draws in sleep modes and such, I most often just look at a mode using a true RMS DMM. But each project has its own needs.