Mission
Build this
Build a measured wake–sense–publish–listen–stretch–sleep cycle whose sensor and servo are electrically off when their evidence is not needed.
Borrowed parts are labelled below and have a fallback. The registered device ID is fixed; sensing and behaviour decisions remain yours.
Bill of materials
Parts
| Source | Part | Fallback |
|---|---|---|
| ● kit | Photoresistor and 10 kΩ resistor | Use another low-power kit sensor only after measuring its awake and sleeping load |
| ● kit | SG90 servo | — |
| ○ fablab | Approved load-switch module, regulated pack, and current meter | Use supervised USB power and compare state budgets without claiming battery runtime |
Disconnect USB before rewiring. Motors, the relay, and the servo need appropriate power and a shared ground. Never drive an actuator from the ESP32 3V3 pin.
Backup assignment · your invitation
Make every awake second justify its cost
The Sleepy Bug wakes, powers one simple sensor, takes evidence, joins the garden, publishes, checks Frost Sentinel, stretches once, and returns to deep sleep. Its main product is not the light reading or the gesture. It is a measured energy budget.
This charter begins on USB or a supervised bench supply. Battery operation is earned only after the wiring, current measurement, prediction, and safe regulated source have been reviewed.
Use only the approved regulated pack and measurement setup supplied by the lab. Do not open power banks, handle bare cells, improvise chargers, or place a current meter across a battery.
The central idea
Long life is mostly the arithmetic of time
Usually the longest state; tiny current still matters here.
Power the sensor only long enough to settle and sample.
Wi-Fi often dominates the wake budget.
A servo can briefly draw far more current than the sleeping board.
Average current ≈ total current-time across one cycle ÷ cycle duration
Predicted runtime then uses the pack’s measured usable capacity divided by average current. The result is an estimate, not a promise: regulator loss, temperature, retries, self-discharge, and power-bank auto-shutoff can all move reality away from the arithmetic.
A sleeping device is genuinely absent
It cannot listen while deep sleep has turned the radio off
Wake and mark the reset reason.
Power and sample the local sensor.
Connect, publish battery estimate and status.
Read the newest Frost Sentinel status during a short listening window.
Stretch, switch the servo rail off, and sleep.
Frost Sentinel cannot wake this device through MQTT. The Sleepy Bug learns its status only after a scheduled wake. If frost warning changes the next interval, document the worst-case delay.
Wiring
Remove sleeping loads instead of asking them to behave
The reference sensor is a photoresistor divider powered from a GPIO only while sampling. The servo uses an approved switched 5 V rail so its electronics draw no power during deep sleep.
The power rule: The sensor divider is powered briefly from GPIO 25 and draws less than one milliamp through 10 kΩ. The servo uses an approved regulated 5 V source through a reviewed load-switch module. Join all grounds.
Bench referenceOpen the exact wiring map
| ESP32 pin | Part | Part marking | Carries |
|---|---|---|---|
GPIO 25 | Photoresistor | one leg | Digital in/out — HIGH only while sampling |
GPIO 34 | Photoresistor | other leg | Analog voltage — divider junction |
GPIO 34 | 10 kΩ resistor | one leg | Analog voltage — same divider junction |
GND | 10 kΩ resistor | other leg | Ground |
regulated external 5 V | Approved load-switch module | IN | 5V power — source must be approved for the ESP32 and servo load |
GPIO 26 | Approved load-switch module | EN | Digital in/out — HIGH only for the wake gesture |
GND | Approved load-switch module | GND | Ground |
GPIO 18 | SG90 servo | signal (orange) | PWM to actuator — one wake stretch |
switched 5 V | SG90 servo | power (red) | 5V power — load-switch OUT |
GND | SG90 servo | ground (brown) | Ground — join all grounds |
A lab supervisor must approve the source, current-meter placement, and load-switch module before battery testing. Never power the servo from ESP32 3V3 and never connect an ammeter directly across a source.
- Digital in/out
- Analog voltage
- Ground
- 5V power
- PWM to actuator
Load-switch modules differ. Treat IN, OUT, EN, and GND as functional labels and follow the supplied module’s verified wiring. The USB-only fallback may omit the switched servo and must not claim battery runtime.
Spend energy where it improves evidence
Every feature competes with another wake cycle
Fresher shared context
More time for MQTT messages, but more radio energy on every wake.
Calmer local reading
Potentially better evidence, but sensor and CPU remain active longer.
More visible life
More actuator energy for no additional measurement.
Your team decides:
- What minimum evidence makes one wake worthwhile?
- Which interval balances freshness against energy?
- What happens after Wi-Fi fails—retry briefly, skip, or stay awake?
- How is battery percentage estimated, and how uncertain is that estimate?
Your energy-budget experiment
Measure states first, predict second, discharge third
- Measure one cycle on supervised bench power.
Record current and duration for deep sleep, sensing, connecting, publishing, listening, and stretching.
- Compare at least three firmware versions.
For example: always awake, deep sleep with servo still powered, and deep sleep with sensor and servo rails off.
- Calculate energy per cycle and predicted runtime.
Use documented usable capacity and include the wake interval, retries, and load-switch current.
- Run a controlled timed discharge.
With the approved pack, start from the same full condition and compare measured energy loss or operating time with the prediction.
| State | Current | Duration | mA·s per cycle | Measurement setup |
|---|---|---|---|---|
| deep sleep | ___ mA | ___ s | ___ | ___ |
| Wi-Fi + publish | ___ mA | ___ s | ___ | ___ |
| servo stretch | ___ mA | ___ s | ___ | ___ |
When the budget refuses to balance
The missing energy is usually attached to an assumption
Deep-sleep current remains surprisingly high
The servo, sensor divider, regulator, indicator LED, or measurement adapter may still be powered. Remove loads one at a time and remeasure.
Wi-Fi connection time varies wildly
Signal quality and retries are part of the real budget. Record a distribution across many wakes rather than using the fastest example.
The USB power bank turns itself off
Many banks interpret low sleep current as no device. This source is unsuitable unless the lab provides a safe, documented solution; do not defeat its protection.
Battery percentage falls smoothly but runtime prediction fails
The percentage mapping or usable-capacity assumption may be wrong. State whether the estimate comes from voltage, accumulated energy, or timed discharge.
Frost warning is discovered too late
The device was asleep. Report the maximum response delay and decide whether the energy cost of more frequent waking is justified.
Choose your survival question
What kind of low-power team will you become?
The state accountants
Build the most complete current-time budget and chase the difference between calculated and measured energy.
The wake strategists
Compare fixed, frost-aware, and retry-limited schedules while making response delay part of the cost.
The load detectives
Remove sensor, servo, regulator, and indicator loads one at a time to discover what “sleeping” hardware still consumes.
A calm way through the build
Collect four small wins
sl-01says hello on USB.Publish once before attempting sleep or battery work.
- One timed wake senses, publishes, and sleeps again.
Keep the servo disconnected and inspect reset reasons.
- Each operating state has measured current and duration.
Use the supervised meter setup and calculate the first budget.
- The stretch rail turns fully off before sleep.
Add the approved switch, then earn the controlled battery test.
The garden handshake
Share what you found
These names are the rigid part of the project. They let another team find your work without knowing what you called the variables in your code.
Estimated remaining energy
garden/outdoor-1/sleepy-node/sl-01/batteryUnit: percent
Wake-cycle state
garden/outdoor-1/sleepy-node/sl-01/statusUnit: enum
Listen beyond your own device.
garden/outdoor-1/frost-node/fs-01/statusThe device can read Frost Sentinel only during its awake listening window. Use the newest valid status to choose a later wake interval, and report the maximum delay while asleep.
Finish line
Ready to introduce to the garden
sl-01 wakes, stays online long enough to publish a documented battery estimate and registered status, then returns to deep sleep.
The reject feed stays clear during repeated wake cycles.
The device reads Frost Sentinel status while awake and never claims MQTT can wake it from deep sleep.
The sensor and servo draw no intentional current during sleep; one wake produces one bounded stretch without blocking the publish window.
The build log contains current and duration for every state, three firmware budgets, usable-capacity assumptions, predicted runtime, a controlled timed discharge, prediction error, and worst-case frost-response delay.
The regulated source, meter placement, and load switch were approved by the lab; there are no loose cells or improvised chargers; outdoor joints and the device label are protected.
The Sleepy Bug succeeds when its runtime claim is no longer a guess. Every milliamp has a state, every state has a duration, and every missing hour has an assumption the team can inspect.