Projects / EasyPill pillbox

Biomedical · 2026

EasyPill V0

A seven-lid pillbox that looks like a plain plastic box but logs every lid opening with hidden hall sensors and an ESP32-C3, shown on a dashboard on the local network.

Working prototype. A phone app for family notifications and detecting whether pills were actually taken are planned for V1.

Sensing
7× AH1912 hall switches
MCU
Seeed XIAO ESP32-C3
Dashboard
Local web UI, LAN only
Schedule
Up to 4 doses per day
Time
NTP sync, no RTC
Wake
OR-gate wake on any lid
PCB
Long, thin 4-layer
The finished pillbox lying on the notebook with the original sketches

How it works

Each of the seven lids, one per weekday, carries a small magnet. Behind a thin plastic wall under each lid sits an omnipolar hall-effect switch, so the electronics stay hidden and magnet orientation does not matter. The design aims for minimal visible electronics, no required interaction, and nothing that tells the user what to take.

The case is FDM-printed PLA. The clear lids are cut from 4 mm polycarbonate and share one metal hinge pin. The 3×7 compartment insert drops into the shell, so a different number of daily slots only needs a different insert.

The main shell with the lids open
The main shell with the lids open

Electronics

The XIAO ESP32-C3 has few pins, so three 8:1 analogue multiplexers on shared address lines read the hall switches, read the analogue signals (battery, USB and wireless-coil voltage, button and charger status), and drive the RGB LED and buzzer. Two 74LV32A OR-gate ICs combine the hall switches, the button and the charger signal into one wake-up line for the sleeping ESP32. The board latches its own power: the button pulls the buck-boost enable high, and firmware holds it there through a diode-OR. A TPS63021 buck-boost provides 3.3 V as the cell discharges, an MCP73831 charges from USB or a 5 V wireless-charging coil, and an AP9101C protects the cell. The hall switches sit on the underside of the long, thin PCB, one under each lid.

Firmware and dashboard

The firmware is a PlatformIO (Arduino) project with the web dashboard packed into the same image. The dashboard shows live lid states, the next dose and recent activity; sets a schedule of up to four doses a day, each with a time window; keeps a history of doses on time, late or missed; and holds settings such as Wi-Fi, time zone, sleep and the lid-to-sensor mapping. Time comes from NTP whenever Wi-Fi is connected. The firmware can also send notifications through ntfy, Pushover or a webhook, set up from the dashboard, but this version concentrates on the local dashboard. Without a network the box opens its own setup access point. A bring-up firmware tests a freshly soldered board one subsystem at a time, and a Python simulator serves the dashboard without hardware. The firmware and dashboard were written with Claude.

The dashboard with Monday's lid open
The dashboard with Monday's lid open

Known issues

  • Battery protection circuit error: wire VBAT_NEG to GND.
  • R36 should be 3k3 to lower the charging current.
  • Without the backup LDO fitted there is a GND break; wire its GND pin to its GND pad.
  • The external button needs a 33 k series resistor, or the ESP32 can be damaged.
  • Wrong footprints for the LED MOSFETs, and the JST connectors are too large for the enclosure.