This project is an sophisticated take on the classic Light Jar.
The hardware is a single circular PCB designed to fit in a standard Mason jar, replacing the metal lid.
The system is fully integrated and can be recharged via USB.
The board was routed under an unusual set of constraints. To match the circular shape, traces and components are placed on a polar grid:
The half of the board underneath the tree has no traces or vias, to avoid disturbing the artwork. In the other half, the traces and vias share space with a set of stars that approximate constellations visible in the northern hemisphere.
The soldermask is selectively removed so that the leaves and stars shine.
Each moon is touch-sensitive. When touched, they adjust the jar's brightness.
Touch sensing is done by a CAP1203. It runs in standby mode with 140 ms sampling time, to maximize battery life.
The low-brightness moon doubles as a standby switch, which triggers when held for about a second. A hardware switch turns the system completely off for longer-term storage.
The board includes six high-brightness surface-mount LEDs. They're driven by a dedicated LED driver chip (the AP5724 boost converter), configured to source up to 30 mA of current.
LED brightness is controlled with a PWM channel from the microcontroller. At maximum brightness, they're clearly visible in daylight; at low brightness, they'll still light up a dark room.
The system uses an STM32L011 low-power microcontroller, running off its internal oscillator.
The microcontroller spends most of its time in a low-power mode:
- When LEDs are lit, it is in
- Otherwise, it is in
In both of these modes, the microcontroller is woken up by a pin-change interrupt coming from the touch-sensing chip. The firmware implements a small state machine to correctly handle edge cases (e.g. if you turn it on by pressing the low-power moon, it shouldn't turn off a second later if your finger is still on the button).
Firmware was initially generated using STM32CubeMX, which caused me to run out of flash immediately upon adding I2C communication. I switched to hand-rolled functions for I2C, and ended up with a whole 336 bytes to spare.
The system is powered by a 400 mAh lithium polymer battery. The battery's output voltage starts at 4.2V and drops down to about 3.2V.
The ICs are powered through a 3.0V LDO regulator; the LED driver runs directly from the battery.
I measured the current in various states with a multimeter, to estimate lifetime (using the rated battery capacity of 400 mAh):
Here are the lifetime results:
- Small faceted jars are from Amazon.
- Larger frosted jars are manufactured by BarConic Glassware
- PCBs are sourced from Smart Prototyping.
- Batteries are from Sparkfun.
- All other components are bought from Digi-Key.
For the BOM or firmware files, please send me an email.
Other design files aren't released to the public, because this was a small-batch gift for groomsmen in my wedding.