Ever wonder how long you've been married? Or maybe it's a day before the wedding, and you still haven't found a gift.
Look no more, the Marriage Clock is here for you.
This thing is a heart-shaped clock that will tell you how many years, months, and days you've been married.
It also always says "H+J" in honor of Heather and James' marriage.
Listen to Merge Conflict 165: IoT Gifts Make the Best Gifts for a complete overview of how this project came together.
- $19.95 Adafruit HUZZAH32 I love ESP32s and the Adafruit dev kit one of my favorites because it includes a USB connector and a battery management unit.
- $5.495 OLED Screen Small OLED modules are pretty cheap these days!
- $9.95 Battery I forgot which battery I used, but this one looks nice. The bigger the battery, the better the clock.
- $∞ 3D Printer to print the heart
I designed the heart clock using OpenJSCAD.org. It's great, you write code to make 3D objects.
Copy the contents of cad.js to OpenJSCAD to see the full box.
To print, change main()
to only be printBottom()
or printTop()
to export print STL files.
Yes it is! The main code (MarriageClock.ino) does these things:
- Gets the current time
- Stores that in the real time clock so it doesn't forget
- Figures out how long it's been since a certain date and time (say, a wedding)
- Displays that on its display
- Go to sleep for 10 minutes
- Go to #3
Technically the current time is in the ether and with the right antenna you can pull it out of thin air.
But I'm not that good of an engineer. Instead, this puppy connects to every open WiFi network it can find, starts making HTTP requests, and then hopes that server will be kind enough to tell it the time.
Sounds easy right? It is, but I had to hack the ESP32 HTTPClient to return the current date from the server. That's why you see MyHTTPClient.cpp.
The RTC is a little device that will keep track of the time so long as it has power and the ESP32 doesn't get reset.
It even keeps counting while the ESP32 is asleep.
I want to display the number of years and months since a certain date.
C does not include a time diff function that can do this, so I ended up including PHP's timelib. Go PHP!
The code in Display.cpp draws the time on the OLED screen using Adafruit's graphics libraries.
Infinite fun can be had here.
If you have an enhancement, please don't hesitate to send a PR!