A Bitcoin clock with five states, and the one that only fires below $50K
I wanted something on my desk that wasn't a red number going up and down. So I built a clock that reacts to Bitcoin the way a person would: it has moods, and one of those moods only happens when things get genuinely bad.
The interesting engineering part isn't the price feed. It's that I wrote a state into the firmware that sat unused for two weeks, and then fired for the first time last night.
The hardware
Deliberately boring, because the point is that it never needs attention:
- ESP32 (Wi-Fi, one core doing display work, the other fetching)
- 2.8" ILI9341, 320x240, SPI
- No touchscreen, no buttons, no speaker, no LED
- USB power, no battery
The screen shows four things and nothing else: BTC/USD with no decimals (pennies on a desk clock are noise), a 5-minute line chart, the day's change, and a pixel character named JT who occupies the rest of the frame. That last one is the whole product. Everything else is a dashboard.
The state machine is deliberately dumb
typedef enum { ST_IDLE , ST_DANCE , ST_LEAVE , ST_BRIDE , ST_CRASH } state_t ;
state_t resolve ( float price , float day_change_pct ) {
if ( price >= 1000000.0f ) return ST_BRIDE ; // she gets married
if ( price < 50000.0f ) return ST_CRASH ; // the island loses power
if ( day_change_pct >= 1.0f ) return ST_DANCE ; // she dances
if ( day_change_pct <= - 1.0f ) return ST_LEAVE ; // she packs and goes
return ST_IDLE ;
}
Three thresholds, strict comparisons, no smoothing and no hysteresis. I get asked about this constantly, so let me defend it. Hysteresis would make the device feel smarter and the data feel cleaner. But it would also mean the screen lies about the boundary.
If price oscillates around $50,000, I want the screen to oscillate, because that's what actually happened. Smoothed state transitions are how you end up with a device that says "everything is fine" forty seconds after it wasn't.
The cost is visible in the public log. On the night of 2026-12-05 the machine went crash at 02:00, back to leave at 02:30, and to crash again at 02:31. Three transitions in thirty-one minutes, all of them true.
The fifth state
Four states had fired since launch. The fifth hadn't, and I'd stopped expecting it to.
crash: price < $50,000 → the island's power goes out → JT sits on the bed with a candle → she does not come out
That's it. It was written as a joke about how the market treats people, and it stayed dormant for two weeks. First trigger: 2026-12-05 02:00, $49,988, -5.31%.
I have the whole history in a public JSONL - one line per state transition, not per tick, which is why fifteen days is only 1,143 lines:
{ "t" : "2026-12-05 02:00" , "state" : "crash" , "price" : 49988 , "change" : -5.31 }
Distribution over those 1,143 transitions: idle 565, dance 324, leave 247, crash 7, bride 0. That's the honest shape of a fortnight of Bitcoin: mostly nothing, a lot of small daily moves, seven minutes of the power being out, and no weddings.
The part that's actually hard: proving which machine you're holding
A screen with a mood is a nice object. A screen with a mood that can be tied to a specific physical unit is a different problem, and it's where most "phygital" projects hand-wave.
100 units. Each one is bound 1:1 to an ERC-721 on Polygon. Three things have to line up:
- Serial printed on the shell - #001 - #100, silkscreened, not a sticker
device_id = HMAC(secret, MAC)- computed at provisioning, burned into NVS. The MAC is readable but the HMAC isn't forgeable without the secret, and the secret never leaves the provisioning station.- 6-digit pairing code at boot - shown on screen at t+3s, then gone. It's the only handshake; there's no config UI.
The token's metadata carries device_hash. claim(tokenId, to) is a one-shot function; the contract is 0xD1b30B4A851745365BA728700f475AA7472F5440 with ERC-2981 at 5%.
What each token freezes is the day its tier first triggered - not the day you bought it:
- leave → 2026-11-20, $61,986
- dance → 2026-11-22, $59,947
- wedding → not yet (needs $1M)
Last night's $48,0xx does not rewrite any of those. The screen changes; the record doesn't. That distinction is the only thing that makes the object mean anything.
What it can't do
Worth stating plainly, because hardware posts tend to oversell:
- It is not an investment and there is no yield. It's a clock with a personality.
- The price feed is a single exchange's spot ticker (10s poll, one REST call). If that API changes shape, the screen shows an error state rather than a stale number.
- It needs Wi-Fi. No Wi-Fi, no mood - it falls back to a "no signal" frame, which is itself a state I had to design.
- The thresholds are hardcoded. No OTA update path for the numbers; that's a deliberate choice so a unit bought in 2026 behaves identically in 2030.
- The state can flip while you watch. That's not a bug, see above.
If you want to look
The transition log is public and the whole thing is inspectable: btcclock.shop. There's a status page that reads the same JSONL the firmware posts to.
If you're building something similar, the two decisions I'd carry over are: log transitions, not samples (1,143 lines beats 1.3 million), and make the state machine dumber than you want to. The dumb version is the one that can tell the truth on a bad night.
Comments
No comments yet. Start the discussion.