Introduction: ESP32 Based Clock

Picture of ESP32 Based Clock

Tutorial how to build a clock based on an esp32 with a built-in oled display, with a touch button, without any other parts, no wiring/soldering required.

Step 1: Parts & Libraries

Picture of Parts & Libraries

Parts

  • An ESP32 module with a built in OLED display (Amazon)
  • A micro USB cable

Libraries

      Step 2: Code

      First of all make sure you have the esp32 package added to your board manager (follow instructions here if you don't).

      The code is on github, link here.

      Download it or paste it in an arduino sketch. Make sure to change the ssid, password and timezone.

      Select wemos lolin32 as your board and upload your code (might need to hold boot and press en buttons before uploading).

      Step 3: Done

      Picture of Done

      Now the clock should be done. To toggle date view, just touch the T1 or 0 pin on the esp.

      Improvements

      If you want to make it cooler, you can solder a wire on pin GPIO0, then attach a metal small plate/coin on the other end. Insulate the metal cover of the esp and fix the plate/coin there (with some hot glue).

      Issues

      The only problem is that if the esp starts without a serial communication on, it won't work.

      If you know how to fix that, please leave a response in the comments, thanks!!

      If you have any other issues don't hesitate to leave them in the comments.

      Step 4: References

      Comments

      AmielN (author)2017-11-10

      Hey DanielM953,

      really cool clock you made!! :)

      I've tried to set it up, like you write above, but I get this error:

      ------

      In file included from C:\Users\P50092\Documents\Arduino\esp\esp.ino:3:0:

      C:\Users\P50092\Documents\Arduino\libraries\NTPtimeESP/NTPtimeESP.h:16:25: fatal error: ESP8266WiFi.h: No such file or directory

      ------

      What ESP8266-lib are you using?

      I think, the NTPtimeESP-lib is pointing at ESP8266WiFi.h, that he can't find, even if I've installed this lib: https://github.com/esp8266/Arduino

      Do you have an idea, what to do, to get the code to work?

      Thanks in Advance :)

      DanielM953 (author)AmielN2017-11-15

      Yeah, sorry for that and the delay.

      The esp32 doesn't have the ESP8266WiFi.h library, it is replaced with WiFi.h.

      Download this ntp library, it should work.

      https://github.com/marcudanf/esp-ntp

      AmielN (author)DanielM9532017-11-18

      Thanks a lot !! Now it works like a charm :)

      DanielM953 (author)2017-11-15

      Also I changed the code, sorry for the past error.

      About This Instructable

      752views

      3favorites

      License:

      Bio: Passionate programmer, mainly in arduino/ESP/raspberry pi
      More by DanielM953:ESP32 Based ClockAutomated Solar Heating for Pools
      Add instructable to: