1. Schedule

day28 — Gameplan for understanding sleep mode currents.

day29 — Final project specifications.

lab6 - Measuring and affecting power supply current.

2. Measuring MCU current

The obvious go-to device for measuring current is the ammeter function of a multimeter.

The Keysight 34450A benchtop multimeters are rather nice, and can even directly measure currents ranging from 10 A all the way down to 10 nA. Therefore, you can theoretically measure both the active mode current of a power-hungry system down to the tiny sleep currents of 100 μA and even far lower.

This problem is response time. The multimeters effectively measure DC, and can only show the average current and not the instantaneous supply current.

It is electronically tricky to sense (a.k.a. measure) currents without affecting the target’s situation. Consider using a series resistor of 0.1 Ω, which are in stock in GEM 166.

  • 1 mA → VR =

  • 400 mA → VR =

  • 1 mA → VR =

  • 1 μA → VR =

Remember that this voltage is in series with the power supply — it should be low enough to have no bad effects on the system!

According to ATtiny85 datasheet Table 22-1, page 177, the ADC uses a 340 μA when the supply voltage is 5 V with an 8 MHz system clock, dropping to 85 μA and 15 μA at lower voltage and clock frequencies.

  • For practical estimate, assume that we need at least 10 mV across the shunt resistor in order to make a reasonable measurement.

So, what shunt resistor is needed to accurately measure a 100 μA current?

What happens when the MCU wakes up and tries to connect to WiFi, which requires peaks of 400 mA for the ESP32?

2.1. Joulescope

The Joulescope solves this problem by quickly switching shunt resistors (order of  μs), to maintain enough shunt resistor voltage to make a good measurement.

When the load device suddenly starts to draw more current, the unit switches to a smaller value shunt resistor.

The net result is a "current oscilloscope"!

joulescope scope example
  • 2 MHz sample rate, 250 kHz signal bandwidth

3. Strategy to measure ATtiny85 currents

  • Which modes?

  • Turn peripherals on/off (power-reduction register)

  • CPU sleep modes