Inspiration

Every alarm we've ever owned has the same flaw: the off button is within arm's reach. The opening of our video is real: one of us silenced his phone and was asleep again within ten seconds. The classic fix, putting the phone across the room, fails too: you walk over, hit snooze, and walk back to bed. We wanted an alarm you can't beat on autopilot, so we split it in two and gave it a sloth as a mascot, since that's who it's built for.

What it does

DuoWake is two alarm clocks that act as one. You place them apart (16.5 m in our demo), and the alarm only stops once you've beaten that morning's wake-up game across both boxes:

  • Flash Tag: hit the button when the light flashes.
  • Lighthouse: catch the spinning light on the arrow.
  • Dash: run between the clocks before time runs out.
  • Or let Random / Surprise me pick.

Everything is set from a phone web app: alarm time, game, the distance between the clocks (which sets the time allowed for each run), and the tune. Pick a built-in tune like Phantom Beeps or Wasp Nest, or type a mood like "spooky" and Gemini composes a fresh melody for the next morning.

How we built it

Electronics (×2). Each box has an ESP32 dev board, a 12-LED WS2812B ring, a buzzer and a big momentary pushbutton, hand-soldered on a half-size perma-proto board.

The buzzer is switched by a 2N3904. We sized the base resistor so the transistor saturates even at worst-case gain, using a forced gain of 10 and about 30 mA of buzzer current:

$$R_B=\frac{V_{OH}-V_{BE,\mathrm{sat}}}{I_C/10}\approx\frac{3.3\ \mathrm{V}-0.75\ \mathrm{V}}{30\ \mathrm{mA}/10}\approx 850\ \Omega$$

where $V_{OH}$ is the ESP32's output-high voltage, $V_{BE,\mathrm{sat}}$ the base-emitter voltage in saturation, and $I_C$ the buzzer current. A 10 kΩ pull-down keeps the buzzer silent while the ESP32 boots, and a flyback diode protects the transistor.

Firmware. One non-blocking loop runs the alarm state machine, the games and the melody player, so the buttons and lights never freeze while a tune plays. Each note is converted to a buzzer frequency with equal temperament:

$$f(n)=440\ \mathrm{Hz}\cdot 2^{(n-69)/12}$$

where $n$ is the MIDI note number and 69 is A4. Tunes are written around 1 to 3 kHz, close to the buzzer's mechanical resonance, where it is loudest.

Comms. The two boxes coordinate over ESP-NOW, Espressif's peer-to-peer protocol, while the master also stays on Wi-Fi to serve the app and call Gemini. That combination is harder than it sounds: the ESP32 has one radio, so ESP-NOW is forced onto whatever channel the router picked, and ESP-NOW has no application-level retries. A packet either lands or it doesn't, and the sender only learns which from a callback. We wrote a small resend protocol on top: every message carries a sequence number, the receiver acknowledges it, and the sender retransmits with backoff until the ack arrives or it gives up and flags the link. Game events like "button pressed on box B" travel over this link, so a dropped packet can't silently let you win or lose.

App. A web app served straight from the box at duowake.local, so there's nothing to install. Gemini runs on the microcontroller with no backend: the ESP32 calls the Gemini API directly, over HTTPS, from a 240 MHz chip with 320 KB of RAM. Most teams put a server between a microcontroller and an LLM. We skipped it, and used structured output with a response schema so the model returns a melody as a fixed JSON shape the firmware can parse without guessing.

Gemini is the composer, not a chatbot. The prompt gives it a constrained vocabulary of notes and durations chosen to match what the buzzer can physically play well, roughly the 1 to 3 kHz band above. When the model drifts outside that range anyway, the firmware repairs the output instead of rejecting it, transposing stray notes by octaves until they fit and clamping durations. You always get a playable tune, even from a slightly disobedient model.

Composition happens when you save the alarm, not when it fires. Gemini writes the next morning's melody the night before, the firmware stores it in flash, and the 7 am alarm never touches the network. If the Wi-Fi is down overnight, you still wake up, just to the built-in tune.

Enclosure. 3D-printed cases, one white and one black, each with a laser-cut plywood plaque. The logo is cut through the plaque as a stencil.

Challenges we ran into

Two radios' worth of work on one radio. Getting ESP-NOW and Wi-Fi to coexist meant chasing a channel mismatch that made the boxes stop hearing each other whenever the master reconnected to the router. Locking ESP-NOW to the Wi-Fi channel at runtime fixed it, and the resend protocol covers the drops that remain.

Getting an LLM to respect a buzzer. Early melodies came back with notes far below the buzzer's range, where it's nearly silent, or with rhythms the loop couldn't time. Tightening the schema helped; the repair step in firmware is what made it reliable.

A broken button, and no spares left. Partway through the build, one of our pushbuttons broke, and there were no replacements available, so we had to work around it.

A button holder that didn't fit. The holder for the button came out the wrong size. Rather than start the enclosure over, we did some mechanical hacking on the inside of the box to make it work.

What we learned

Buy spares and test-fit early. One broken button and one wrongly sized part cost us more time than any of the electronics did.

Design for the moment of failure. Deciding the melody at save time, and treating every ESP-NOW packet as lost until acknowledged, meant the alarm still works when the network or the link doesn't. The parts of the system we trusted least are the parts we now trust most.

What's next

Batteries instead of a power bank so the second box can go anywhere, wake-up stats in the app.

Built With

  • arduino
  • arduinojson
  • asynctcp
  • c++
  • canvas
  • css3
  • esp-now
  • esp32
  • espasyncwebserver
  • fastled
  • gemini-api
  • gemini-flash
  • google-ai-studio
  • html5
  • javascript
  • ledc-pwm
  • littlefs
  • mdns
  • ntp
  • nvs
  • platformio
  • structured-output
  • web-audio-api
  • wifi
  • ws2812b
Share this project:

Updates

Submission history