Switched off, not asleep.
Tinta does not sleep between updates. It disconnects itself from the battery. This page builds up the circuit that does it, one step at a time.
Step 1: A switch that needs no current to stay off
A P-channel MOSFET (Q1) sits between the battery (J3) and everything else. A 1 MΩ resistor (R1) pulls its gate up to the battery voltage, and that keeps it off. Pressing the button (SW1) pulls the gate to ground. Q1 conducts, and the load is powered. The load is the block labelled Pico: it stands for the Pico and the display and draws about 60 mA.
Click and hold SW1 in the simulation. Let go, and the circuit is off again: no current flows anywhere.
Step 2: The circuit keeps itself on
With step 1 alone, the device would run only while someone holds the button. So the device holds its own switch. As soon as it has power, the Pico sets its pin GP22 high. Through R2, that turns on the transistor Q2, which pulls the WAKE line to ground in place of the button. The button can be released, and the device stays on.
When the work is done, the firmware sets GP22 low. R3 makes sure that Q2 switches off, R1 pulls WAKE back up, and Q1 cuts the power, including the power of the Pico itself.
In the simulation, the switch at GP22, inside the block Pico, stands in for the firmware. Click SW1 once, and the current keeps flowing. Then click the GP22 switch to do what the firmware does when it has finished.
Step 3: More than one way to switch on
A button is one way to pull WAKE to ground. Tinta has two more. The real-time clock U4 pulls WAKE low when its alarm goes off, and that is how the sign wakes on a schedule. The NFC chip U5 does the same when a phone reads from it or writes a command to it.
All of them act on the same line, so any one of them switches the device on. From there, step 2 takes over: Q2 holds the line until the firmware has finished.
The diodes D2 and D10 keep the sources apart. Without D2, the firmware could not tell which button was pressed, because Q2 holds WAKE low for as long as the device is on. The clock needs no diode: its output can only pull down.
In the simulation, click SW1, the output of U4, or the output of U5. Each one starts the device. The GP22 switch in the block Pico ends the cycle, as before.
Step 4: RTC mode
Put together, the circuit runs without anyone touching it. The clock U4 raises its alarm at a set interval, and each alarm starts the same sequence:
- U4 switches. The clock pulls its output ~INT, and with it the WAKE line, to ground. Q1 turns on.
- The Pico starts. VSYS has power now, and the firmware begins to run.
- GP22 goes high. This is the first thing the firmware does, a moment after the Pico got power. Q2 now holds the WAKE line low, so the device keeps itself on.
- U4 lets go. The alarm pulse ends. Nothing changes, because Q2 is holding the line.
- GP22 goes low. The work is done. WAKE rises, Q1 cuts the power, and the Pico is off again.
In the block Pico, the GP22 switch now operates by itself, in place of your click. It stands for the firmware: it closes a quarter of a second after VSYS got power, stays closed for as long as the work takes, and then opens.
The clock is the one part that is always powered. It gets its supply straight from the battery, ahead of the switch Q1. The 100 nA in the simulation stand for everything that still flows while the device is off: measured on the real device, that is about 0.1 µA in total.
To make the cycle visible, the simulation uses short times: an alarm every 5 seconds, and 1 second of work. On a real sign, the two times are much further apart. With an update every 30 minutes that takes 20 seconds, the device is on for 20 seconds out of 1800, about 1 percent of the time. For the other 99 percent, only the clock is running.
The four traces below the circuit follow one cycle after the other. From top to bottom:
- Current through Q1: what the device draws. About 60 mA while it works, and nothing in between. The scale is 100 mA per division.
- Current into U4: the off-state current. A constant 100 nA, on a scale of 200 nA per division, 500,000 times finer than the trace above.
- ~INT: the alarm output of the clock. It dips low for a moment and switches the device on. This comes first.
- GP22: it rises a moment after ~INT falls, the time the Pico needs to start. It stays high after ~INT has gone back up, for the second the firmware needs, and then falls.
Step 5: NFC mode
The third way in needs neither the clock nor a button. The NFC chip U5 takes its power from the field of the phone that is held against it, not from the battery. When the phone reads from it or writes a command to it, U5 pulls its output GPO low, and with it, through D10, the WAKE line.
From there it is step 2 again. The Pico starts, holds itself on through GP22, reads from U5 what the phone did, acts on it, and switches off. Between taps, the device draws only its off-state current of about 100 nA.
In the simulation, the letter L in the block U5 is the phone. Click it and hold for a moment: that is the tap. The traces show the tap, GP22 taking over, and the current while the device works.
Part and net names are those of the Tinta schematic. The block labelled Pico stands in for the Pico and the display. It is a 75 Ω resistor that draws about 60 mA, and a switch at GP22. In steps 2 and 3 you operate the switch by hand. In steps 4 and 5 it closes by itself when VSYS comes up and opens again after one second, which plays the firmware. The real GP22 pin delivers 3.3 V, the simulation uses the battery voltage. The real board has four buttons, each with its own diode. Steps 4 and 5 each show one wake source and leave the others out, and all times are example values. While the device is off, only the clock keeps running.
The simulation shows the principle. It does not model leakage currents realistically. With Q1 off, the simulator still shows about 45 nA through it. That comes from its transistor model, which never lets the current fall to exactly zero. On the real board, the whole device draws 0.12 µA when it is off, measured at the battery terminals. That includes the clock and the leakage of Q1 and the diodes.
Simulator: CircuitJS1 by Paul Falstad and Iain Sharp, licensed under the GNU GPL, version 2 or later. Notes and source.