The linked video below will take you through the process of designing, assembling, and testing the ChocoVault. Explore the inner workings of the device, from its motorized lock assembly to its custom PCB based on an ESP32-S3 microcontroller. Learn how the system synchronizes with activity data from the Apple Watch via Apple Health using the “Health Auto Export” app, ensuring your sweet rewards are unlocked when you hit your daily activity goal.
Mechanical Design
The heart of the ChocoVault is a 3D-printed motorized lock assembly. It consists of two spring loaded latches which are designed to engage with the two strikers, which are symmetrically arranged on the lid of the device.
To unlock the vault, these latches can be retracted by racks which are driven by a small, geared DC motor and a pinion gear.
For position feedback, magnets on the racks are detected by hall effect sensors, which are located on the control PCB. The PCB is directly attached to the lock assembly.
The mechanical design was created with robust and resource efficient additive manufacturing in mind. Some of my design constraints were:
- avoid support structures during printing as much as possible
- design components with high mechanical loads (such as hinges, strikers and latches) in a way, that the direction of the tensile stress is directed along the layer lines
- no visible screws when the box is closed
- in general, limited use of fasteners

Functional requirements (mechanical):
- lid can be closed, even when the lock is in locked state (adds some complexity to the lock and latching mechanism)
- reliable lock/latch mechanism, which can withstand hundreds/thousands of cycles
- lid pops open automatically, once unlocked (requires a spring-loaded pusher mechanism for the lid)
- robust hinge design, reinforced with a metal pin
- modular design of lock assembly with electronics, so it can be assembled and tested separately (and maybe reused in a future project...)

Electrical Design
The integrated electronics are built around an ESP32-S3 microcontroller, which simplifies running a web server, performing over-the-air firmware updates, and playing wave or MP3 files. The system is powered by a standard 5V DC supply, with an onboard voltage regulator providing the required 3.3V rail.
A dedicated motor driver IC streamlines motor control, while a mono class D audio amplifier with digital I2S input handles audio playback. Three small Hall effect sensors on the PCB detect the end-stop positions of the locking mechanism. Additionally, a ring of 12 addressable RGB LEDs serves as the status display. The web server on the ESP32 receives activity data from Apple Health as a JSON record, which is then used to display the current active energy status on the LED ring—mirroring the Apple Watch display—while also managing the locking mechanism.
Functional requirements (electrical):
- communication via WiFi
- stationary device, power supply via 5V DC input
- enough onboard FLASH to store sound samples and to enable seamless OTA firmware update
- crisp and powerful playback of audio samples (WAV or MP3)
- very minimal user interface
- on-board hall effect sensors to avoid unnecessary cable routing
Communication
As to my knowledge, there is no direct way for the Apple Watch to automatically transmit activity data to another device. A 3rd party app needs to be used on the iPhone to access the relevant Apple Health data and synchronize it with the ChocoVault. This app can be found in the App Store and is called “Health Auto Export”. It offers various options for exporting all sorts of Apple Health related data and send it to web services like generic REST APIs, Home Assistant, MQTT, Dropbox etc. For the ChocoVault, I provided a simple REST API which accepts the Apple Health data as a JSON...
Read more »