DEV Community

Cover image for Daybreak: a phone box that only opens after you've touched grass, offline on an Arduino UNO Q
Abhinav krishna N
Abhinav krishna N

Posted on

Daybreak: a phone box that only opens after you've touched grass, offline on an Arduino UNO Q

Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built

I snooze, then I scroll. The phone is the last thing I see at night and the first thing I grab in the morning, and my alarm can't fix that, because the alarm lives on the device I'm trying to get away from.

Daybreak is a bedside box that keeps my phone overnight and only gives it back after I've carried the box outside, walked, and stood in daylight. "Touch grass" is literally the unlock condition. While I'm out there, the phone is still in the box, so those minutes are screen-free too.

The box has a voice: Jarvis, a dry-witted butler that runs fully offline on an Arduino UNO Q. Jarvis wakes me up, takes tomorrow's plan by voice the night before, reads me today's plan while I'm standing outside in the sunlight waiting for the box to unlock, and talks me through a short rest session when I can't sleep.

A day with Daybreak:

  1. Evening: an hour before bedtime, Jarvis nudges me: "An hour to bedtime, sir. Shall we plan tomorrow?" I say "Hey Jarvis, tomorrow I have a lab at 9:30 and lunch with Amal at noon." Jarvis repeats back the checked plan and writes tomorrow's briefing overnight.
  2. To-do list: "Hey Jarvis, add buy filament to my list." Β· "What's on my to-do list?" Β· "Mark buy filament done."
  3. Bedtime: phone into its little bed, blanket shut. "Hey Jarvis, sleep time." β†’ "Locked. Alarm at 6:30, sir. Sleep well."
  4. Can't sleep: "Hey Jarvis, I can't sleep." β†’ Jarvis offers a guided rest session (10 or 20 minutes, NSDR-style), a 5-minute wind-down or a 2-minute breathing reset, all in his calm voice and ending in silence. After bedtime he speaks quieter and slower, and skips the chime.
  5. Morning: Jarvis wakes me. The blanket stays locked.
  6. The gate: I carry the box outside. It checks that the steps are real walking (steady cadence, carried upright, so shaking it in bed doesn't count), then that I'm actually outside in real daylight.
  7. While I wait in the sun: Jarvis reads me today's plan (the briefing, written the night before), and I can keep talking: "How long left?", "What's next?", "Add buy filament to my list."
  8. Unlock: "Daylight confirmed. Releasing your phone, sir."

It's for anyone whose phone wins the first ten minutes of the day. That's me.


Everything inside: Arduino UNO Q, light and UV sensors, motion sensor, RTC, two N20 gear motors, mic, speaker.


The 3D-printed parts: a little bed for the phone, with a blanket that locks over it.

Demo

"Hey Jarvis" β†’ chime β†’ I speak β†’ Whisper transcribes β†’ Jarvis answers in his own voice, all on the board with Wi-Fi off.

Code

GitHub logo Abhinavkrishna3211 / Daybreak

A box that keeps your phone until you've been outside in real daylight, then tells you your day, and talks you down at night, all offline.

Daybreak

A bedside box that keeps your phone until you've stood in real daylight, then tells you your day. Fully offline on an Arduino UNO Q.

  • Night: put the phone in and say "Hey Jarvis, sleep time". The box locks and stays locked until morning (override button always works).
  • Morning: one alarm, snooze off by default. The lid stays shut until you carry the box outside, walk, and stand in daylight for long enough. A UV-to-visible ratio (plus optional mains-flicker detection) separates sunlight from lamps and phone torches.
  • Unlock: the lid releases and an offline voice reads your plan: what, when and where.
  • Evening: press talk and say tomorrow's plan. Speech to text β†’ rules extract the times and places β†’ a validator rejects anything that wasn't actually said. The plan is built by rules alone, never by the language model: on this board the model got the structure wrong…

The repo is a proper App Lab app (importable as a zip) with a full build guide (TUTORIAL.md), every benchmark in docs/measurements.md, and the raw CSVs in data/bench/.

What I Used

Hardware

Part What it does
Arduino UNO Q (4 GB) Linux side (Qualcomm QRB2210): speech, Gemma, voice, dashboard. STM32U585 side: sensors, lock, alarm, safety
BH1750 ambient light sensor Measures lux for the daylight check
GUVA-S12SD UV sensor UV level, to tell real sunlight from lamps and phone torches
MPU6050 (GY-521) Counts steps, checks walking cadence and that the box is carried upright
DS3231 RTC + coin cell Keeps the alarm on time through power cuts, with no internet
2Γ— N20 gear motors Roll the 3D-printed blanket shutter over the phone
DRV8833 dual motor driver Drives the two lock motors
Microswitch + reed switch Phone in the bed / blanket shut
Active 5 V buzzer Alarm, run by the MCU alone
2 push buttons Override (always opens) and talk
USB microphone + USB speaker Jarvis's ears and voice
Powered USB-C hub + 30 W+ USB-C charger Power and audio through the UNO Q's single port
10,000 mAh power bank Runs the box on the walk outside
3D-printed enclosure (PLA) The phone's bed, blanket shutter and sensor window

Software and models (all open, all offline)

Tool Role
Arduino App Lab + bricks (keyword_spotting, web_ui) App structure, wake word, dashboard
Edge Impulse Trained my own "Hey Jarvis" wake-word model
Whisper (whisper.cpp / pywhispercpp) Speech to text
Gemma 3 1B QAT Q4_0 via llama.cpp llama-server Morning briefing and open questions
Piper TTS Jarvis's voice
Python + pytest Planner, gate, assistant logic and 200+ tests
Arduino (STM32 sketch) Sensors, motors, alarm, watchdog
KiCad Schematic

Schematic


KiCad schematic: UNO Q with the IΒ²C sensors (BH1750, DS3231, MPU6050), GUVA-S12SD UV, DRV8833 driving the two N20 motors, buzzer, buttons, and the phone and lid switches.

How I Built It

The UNO Q fits this project because it's two computers in one. The STM32 handles everything that must never fail (sensors, the blanket lock, alarm, safety timers). Linux on the Qualcomm QRB2210 handles everything smart.

Layer Open tech Runs on
Wake word My own Edge Impulse "Hey Jarvis" model, App Lab keyword_spotting brick Linux
Speech to text Whisper (whisper.cpp via pywhispercpp), base.en, audio_ctx=512 Linux
Language Gemma 3 1B QAT Q4_0 via a supervised llama-server Linux
Voice Piper, British male voice Linux
Dashboard App Lab web_ui brick, port 7000 Linux
Sensing and safety BH1750 light, GUVA-S12SD UV, MPU6050 motion, DS3231 clock, phone/lid switches, buzzer STM32
The lock 2Γ— N20 gear motors on a DRV8833 driver, rolling the 3D-printed blanket shutter over the phone STM32

The most useful thing I measured: where Gemma does not belong

My first design had Gemma turn "tomorrow I have a lab at 9:30 and lunch with Amal at noon" into a structured plan. Before trusting it, I benchmarked every Gemma variant that fits the 4 GB board on 20 hand-labelled transcripts.

  • Best Gemma score: 5/20. The fastest model that could hold a JSON schema missed my latency limit by 5Γ— (p90 108 s against a 20 s limit).
  • Plain Python rules: 20/20, in under a millisecond.

So the measurement changed the architecture. Python owns the facts (times, places, your alarm). Gemma owns the words: it writes the morning briefing and answers open questions, and every draft goes through a deterministic check (every plan time present, no invented times or places, ≀ 45 words) before Jarvis says it.

Briefing setup (full load: wake word + Whisper + Piper + LLM all running) Score
Stock Gemma 3 1B Q4_0 8/10
+ QAT weights 9/10
+ check and retry (≀ 3 drafts) 10/10, 1.2 attempts on average

A full-load briefing takes about 39 s (median), which is far too slow for the morning. So it's written at night, when the plan is saved, and the morning only waits on Piper. Open questions (ask) score 10/10 at a p90 of 11.3 s.

Other numbers from the board:

  • Gemma 270m vs 1B: 270m is 3Γ— faster (60 prompt / 18 generation tok/s) but scores 1–4/10 on the briefing. It can't hold the voice and the constraint at once.
  • Threads: prompt speed scales linearly up to 4 cores (15.8 β†’ 61.2 tok/s), but 4 threads under full load reset the board twice, so it ships with 3.
  • Wake word: threshold 0.75 gives 0.90–1.00 recall at 1–3 m (even with a fan running) and one false wake in ten minutes of continuous speech.
  • Whisper: tiny.en is 1.6 s per command; base.en costs +1.9 s and is noticeably more accurate on times, so it won.

Bugs I only found by running it on the real board

  • Every spoken reply was silently failing: the Piper voice path pointed at a host folder that App Lab doesn't mount into the app container.
  • The night lock reused the morning's flat 90-minute limit, so it would have released my phone at 11:30 pm. No test caught it, so I wrote dispatcher tests for main.py.
  • A missing light sensor reads as 0xFFFFFFFF = 4.29 billion lux, brighter than the sun, which would have opened the gate indoors. The gate now rejects anything above 200,000 lux.

Safety (it holds your phone all night)

  • The blanket opens if the power goes. The N20 gearing is backdrivable and the motors are only driven for a moment to move the shutter, so an unpowered box never traps the phone.
  • Override button on the MCU opens it instantly, any time. Emergency calls are one press away.
  • Hard-release timer (alarm + 90 min) and a watchdog (Linux silent for 30 s β†’ open).
  • The alarm runs on the STM32 off a DS3231 RTC, so it still rings if the AI side crashes.

The science behind it (and where Andrew Huberman comes in)

The idea for Daybreak came from Andrew Huberman's Toolkit for Sleep. He pulls a set of findings into one practical routine: get outside into daylight soon after waking, keep a fixed wake time, and keep bright light (screens) away at night. I kept failing at the first step, because my phone always won. So I built a box that makes the routine the default.

Why morning sunlight, and why the cortisol timing matters. Your body clock is set mainly by light hitting your eyes. Cortisol is meant to be high in the morning, when it peaks shortly after waking to get you alert and moving, and low at night, so melatonin can rise and you can fall asleep. Bright morning light lines that rhythm up with the actual day. Bright light late at night pushes it the wrong way. Daybreak attacks both ends: daylight in the morning, the phone in bed at night.

The studies behind each feature:

Feature What the research says Source
Daylight gate Bright light in the morning produces an acute rise in cortisol, part of how light signals "daytime" to the body Jung CM et al., J Biol Rhythms 2010
Daylight gate A week of camping with only natural light shifted people's internal clocks about 2 hours earlier, lining sleep up with sunrise Wright KP Jr et al., Curr Biol 2013 (n=8); Stothard ER et al., Curr Biol 2017
Daylight gate People with brighter days and darker nights had lower mortality risk and fewer psychiatric disorders (wrist light sensors, ~86–88k people) Windred DP et al., PNAS Nexus 2024; Burns AC et al., Nature Mental Health 2023
Phone in bed at night Reading on a light-emitting screen before bed suppressed melatonin, delayed its onset and pushed the body clock later, compared with a printed book, in the same people Chang AM et al., PNAS 2015
One fixed wake time Sleep regularity predicted mortality risk better than sleep duration (~61,000 people) Windred DP et al., Sleep 2024
Planning tomorrow before bed Writing tomorrow's to-do list helped people fall asleep faster (n=57) Scullin MK et al., J Exp Psychol Gen 2018
Plan says when and where "When-then" plans make people far more likely to follow through (meta-analysis of 94 studies, d = 0.65) Gollwitzer & Sheeran, 2006
2-minute breathing reset 5 minutes a day of cyclic sighing gave the biggest mood gain of the breathing patterns tested (RCT, 111 adults) Balban MY et al., Cell Reports Medicine 2023
Rest sessions (NSDR-style) Yoga nidra lowered salivary cortisol and improved sleep in chronic insomnia (RCT); an 11-minute session lowered stress and improved sleep quality in 341 people Datta K et al., Natl Med J India 2021; Moszeik EN et al., Psychol Res 2022
No snooze (configurable) The evidence on snoozing is mixed, so no-snooze is my choice, not a rule Sundelin T et al., J Sleep Res 2023

How Huberman's numbers map to the gate. His toolkit suggests going outside within 30–60 minutes of waking for about 10 minutes on a clear day, 20 when cloudy, and 30–60 when very overcast. Daybreak uses these as adjustable defaults: the brighter the light it measures, the shorter you need to stay out. "NSDR" (non-sleep deep rest) is also his term. Jarvis's sessions are my own original scripts in that style, not his recordings or words.

I treat this research as the reason for the design, not proof that the box works. Several of these studies are observational or small. Daybreak is not affiliated with or endorsed by Andrew Huberman or Huberman Lab, isn't a medical device, and the rest sessions are relaxation audio, not treatment.

Why Does Open Innovation Matter?

This device sits in my bedroom, listens for its name, and knows when I sleep and wake. A cloud version would mean always-on bedroom audio leaving the house. Open models make the private version possible:

  • Nothing leaves the box. No cloud, no camera, no accounts. Audio is transcribed, then deleted.
  • It works at 6 AM with the router off. An alarm that needs the internet isn't an alarm.
  • It costs nothing to run. No API keys, no subscription.
  • I could measure it and change it. Because the weights run locally, I could benchmark every Gemma variant, quantisation and thread count on my own board, find out it shouldn't extract plans, and redesign around that. With a closed API I'd just have shipped the 5/20 version.
  • Anyone can rebuild it from the repo, retrain the wake word, or swap the voice.

Prize Categories

  • Best Use of Arduino: three open models (Whisper, Gemma, Piper) plus an Edge Impulse wake word running on the UNO Q, in a proper App Lab app with three bricks, using the STM32 for safety and the QRB2210 for intelligence.
  • Best Use of Gemma: Gemma 3 1B QAT doing checked, real work on a 4 GB board, with every variant benchmarked and the results (including where it failed) published.

The daylight durations are adjustable defaults inspired by Andrew Huberman's published guideline; not affiliated with or endorsed by him. Daybreak isn't a medical device and makes no health claims.

Top comments (0)