About

This project is an sophisticated take on the classic Light Jar.

Dimly lit glowing picture

Demo

Design

The hardware is a single circular PCB designed to fit in a standard Mason jar, replacing the metal lid.

Picture in jar

The system is fully integrated and can be recharged via USB.

Underside of the PCB

The board was routed under an unusual set of constraints. To match the circular shape, traces and components are placed on a polar grid:

Polar coordinates

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.

Constellations

The soldermask is selectively removed so that the leaves and stars shine.

Shining gold plating

Touch sensing

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.

LED control

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.

Microcontroller

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:

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.

Power

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):

Picture of power measurement

Here are the lifetime results:

ModeCurrent (mA)Lifetime
Standby0.2567 days
Dim12.51.3 days
Medium37.710.6 hours
Bright178.52.25 hours

Sourcing

Design files

Schematics (PDF)

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.