How to debug high sleep current?

I'm working on a bee hive scale that I would like to run off of an 18650 for a year or more. The scale works but has higher sleep current than it should, drawing about 250 uA, much higher than the 6.5 uA reported on Nick Gammon's brilliant page:

https://www.gammon.com.au/power

My main problem is that I'm not really sure how to debug this issue. Normally I can isolate one part of a circuit, but I can't breadboard the entire circuit out because a lot of the parts are SMD. My next step is to populate the board a bit at a time, but I'm wondering if there are better ways to figure out what is going on?

While this is a general question of how to debug low level current leakage in sleep mode, I've provided as much information about my specifics as I can below in case there is something obvious.

On the hardware side, the scale is controlled by an ATmega328p connected to 6 HX711 load cell amplifiers, with a SSM3J327R P-Channel MOSFET switching a MCP1825S LDO to create a 3.3 V supply line. The switched 3.3 V line turns on an HTU21D temperature and humidity sensor, SFH3710 phototransistor, and RFM95W LoRa module. Logic level shifting is done with BSS138s and 10k resistors as shown here:

The full schematic is attached although it does not include the small HX711 boards which are essentially the HX711 reference schematic connected by a USB-C cable. They don't seem to be the problem because I can unplug all HX711s and the current draw during sleep is the same.

On the software side, sleep is set up essentially per Sketch H in Nick Gammon's power page cited above and the draw during sleep is 600 uA. The pins to the SSM3J327R and HX711 clocks are kept high, which keeps them off. Changing pin 10 (SPI SS) to LOW (INPUT or OUTPUT) right before sleep changes the sleep current to 250 uA. Changing the rest to LOW (other than the two cited above which need to stay high) doesn't drop it further.

Running the script on a breadboard DIP ATmega328p does show the expected single digit uA current draw during sleep, so at least the sleep code and my cheap multimeter are working as should be expected. I've attached the full code in case it is helpful.

My understanding of electronics is decent at the high level (ie a MOSFET is an on/off switch) but is extremely shallow in terms of the real world variations (ie what are the implications of IGSS leakage). Since transistors are sort of black magic to me, my instinct is to assume I don't have those set up right and my current draw is due to the BSS138s not behaving as I expect them to when the 3.3V line is switched off, but I really don't know.

Any help would be appreciated. Thanks to you all.

hive_scale_remote_hub_v2_1.pdf (83.2 KB)

Hive_Scale_v2_Remote.ino (18.2 KB)

In your schematic, what is Vcc - 5V or 3.3V?

For example, if you are holding PD4 high (to keep SSM3J327R off) you also have it pulled High through a 10k resistor. If you put that pin input INPUT mode, it will neither sink/source any current since there could easily be a slight voltage difference between Vcc and the pin voltage.

brianucsf:
I can't breadboard the entire circuit out because a lot of the parts are SMD. My next step is to populate the board a bit at a time, but I'm wondering if there are better ways to figure out what is going on?

I have spent a fair while testing Arduino stuff for very low sleep current.

Whilst you may assume you cannot 'breadboard the entire circuit out because a lot of the parts are SMD' I would not agree. True some parts may only be available in SMT versions, but that just means you need to find ways to breadboard them, its almost always possible.

You do need to build a project, where low sleep current is a major requirement, step by step, devices can interact in ways you might not plan for, so measuring sleep current as you add componets is the essential part of the process.

You might assume that power only leaks through VCC\GND pins, but power some devices down and current (and large amounts of it) can leak through IO pins.

Wow, thanks for the quick responses.

blh64: Vcc is the battery voltage, nominally 3.7V from the li-ion. When measuring sleep current that is the only power source that is hooked up. I did try changing PD4 to INPUT, LOW and saw no change. I think I still need to hold the HX711 clock high since there are no external pull ups.

smet: Yes, you are correct I can breadboard it with a bit more work. I was thinking I would use one of my unpopulated boards and just add to it bit by bit but I guess that if I am going to need to probe individual IO pins, it would be better to have it on a breadboard.

I will work through it step by step and see if I can figure it out. Thanks.

From my experience, a messy soldering job (lots of flux residue) can cause a leakage current that is difficult to find. Also, moisture that has seeped into parts (ie, on the surface of the pcb, under a smd component, or inside a tact switch) can also lead to a higher than expected sleep current.

I'm finding your schematic a little difficult to follow. Usually Vcc is at the top, and Gnd is at the bottom of the page. However, I am wondering if it would be simpler to just use a 3V source (eg, 2xAA) because that would eliminate the LDO, the level shifting, ect. Although, at this point, it might be too late if you already have the pcbs made.

John_S:
I am wondering if it would be simpler to just use a 3V source (eg, 2xAA) because that would eliminate the LDO, the level shifting, ect.

If your talking about Alkaline AAs, do remember they will be down to around 1.2V each halfway through their life and a 2.4V supply might be too low for some devices.