Skip to content

Add Raspberry Pi Pico W ESPHome port - #8

Open
aquarat wants to merge 2 commits into
veebch:mainfrom
aquarat:esphome-pico-w
Open

aquarat wants to merge 2 commits into
veebch:mainfrom
aquarat:esphome-pico-w

Conversation

@aquarat

@aquarat aquarat commented Oct 31, 2026 •

Copy link
Copy Markdown

Hey there

I purchased a 1960s "Adelheid" Inducta clock from you on the 19th of August. It works well and I'm very happy with it 😊

The clock was supplied with your driver, which intermittently stopped working a few times. A few days ago it stopped working entirely, power cycling the device and swapping the PSU did nothing.

I opened up the enclosure and found your configuration. I then asked Claude to inspect the firmware, take a backup and then re-implement the firmware using ESPHome.

I love MicroPython and I'm using it for a fairly complex project at the moment - but for someone like me with an existing ESPHome system/Home Assistant instance and several MCUs hanging around the house, running the Veeb clock controller on ESPhome is a nice way of managing the device, loading updates and keeping control in a handily accessible location.

I'm sure you're aware that the original device firmware has a bug in it which can cause wifi credentials to be erased in certain scenarios. There's also seemingly potentially a flash wear issue, but I didn't look into this properly.

I thought I'd give this code to you as a PR in case you want it.

It is almost entirely vibe coded, but it does work quite nicely.

Feel free to close/reject this PR if you're not keen, no problem ❤️

All the best 😊

P.S. "192.168.0.21" here is an NTP stratum 1 local time server... which is a bit silly, but why not. NTPPool likes it 😆
P.P.S. the RLCD device you mentioned turned out to be perfect as an AI quota usage dashboard 😅 🫠

Screenshot 2026-10-31 at 15 52 59

AI description follows (Claude Opus 5.5):

This adds esphome/pico-w/, an ESPHome firmware for the Pico W: for DIY Pico W builds
and for the VEEB Clock Driver, which is a Pico W. It sits next to the ESP32 port from #7
and uses the same GP13/GP14 wiring and the same movement rules as webtime.py: alternating
pulses, catch up when behind, wait when up to an hour ahead. The pulse width is adjustable;
it defaults to 1 s like webtime.py, main.py and the ESP32 port (the VEEB Clock Driver's
shipped firmware uses 0.4 s).

Tested on a VEEB Clock Driver driving a secondary clock (ESPHome 2026.10). For
one-pulse-a-minute movements and the Pico W (RP2040) only.

Why not just retarget the ESP32 YAML?

On the RP2040, ESPHome keeps all preferences in a single 4 KB flash sector and erases it on
every sync that changed something (components/rp2/preferences.cpp). Saving the hand position once a minute
with globals: restore_value would wear that sector out in about 70 days. So this port keeps
its state in LittleFS, which spreads the writes and is safe against power loss.

What else is different

  • The state is saved after each pulse. A power cut at any moment leaves the record and the
    hands consistent: the next pulse repeats the same polarity, which the movement ignores if it
    had already stepped.
  • Time from SNTP, with the server settable at runtime from the web page or Home Assistant
    (checked on the device, kept across reboots). Home Assistant isn't required.
  • Face time (one time picker), Synchronise, pause, manual steps (only while paused), pulse
    width, a state sensor, and a time-server reachability sensor. Nothing moves until Face time
    has been entered. Setting it while a pulse is energised is refused, because there's no way to
    know whether the hands were read before or after that step.
  • Robustness:
    • api: reboot_timeout: 0s: no reboot when HA is away, which matters with no RTC.
    • ESPHome OTA stops pulses before uploading.
    • OTA is encrypted with the API key; the web page takes no firmware uploads on the LAN
      (only ESPHome's captive-portal recovery path on the fallback hotspot does).
  • The VEEB board's small button (GP0) is exposed as a sensor with no action.
  • A host unit test for the dial maths (12:00 wrap, both DST changes) and the state record.

The existing ESP32 README gets a one-line pointer to the new folder; nothing else outside
esphome/pico-w/ changes.

aquarat and others added 2 commits October 30, 2026 21:54
An ESPHome firmware for the Pico W, for DIY Pico W builds and for the VEEB
Clock Driver. Same GP13/GP14 wiring as webtime.py and the ESP32 port.

- Hand position, polarity and run state are persisted in LittleFS, not
  ESPHome preferences: on RP2040 those live in one 4 KB flash sector that
  is erased on every changed save, which one save per minute would wear
  out in about 70 days.
- The record is saved after each pulse, so a power cut at any moment
  leaves the hands and the record consistent.
- SNTP time from a server settable at runtime (validated, persisted; set
  in both lwIP slots), so Home Assistant is optional.
- Face time, Synchronise, pause, manual steps, pulse width, state and
  time-server reachability entities. Face time is refused while a pulse is
  energised.
- api reboot_timeout 0s, OTA stops pulses first, web-page firmware upload
  disabled, OTA encrypted with the API key.
- Host unit test for the dial maths and state record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Default pulse width 1000 ms like webtime.py, main.py and the ESP32 port;
  note that the VEEB Clock Driver's shipped firmware uses 400 ms
- Describe the captive-portal firmware upload path on the fallback hotspot
  instead of claiming the web page takes no uploads at all
- Note that the status LED blinks while no API client is connected
- Time server: hostname or IPv4 only (IPv6 is off on rp2); correct the
  lwIP server-slot explanation
- README: Pico W and one-pulse-a-minute scope, dashboard UF2 download,
  catch-up speed, neutral wording about the shipped firmware
- Tests: DST cases in local-time terms rather than GMT/BST

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aquarat aquarat changed the title [WIP] Add Raspberry Pi Pico W ESPHome port Add Raspberry Pi Pico W ESPHome port Oct 31, 2026
@aquarat
aquarat marked this pull request as ready for review October 31, 2026 16:05
@veebch

veebch commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Brilliant, this is beefy enough that I'll need to take a proper look at it. I may come back with questions :)

@aquarat

aquarat commented Oct 31, 2026

Copy link
Copy Markdown
Author

Of course 😊 no rush 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants