Network Time Digital Clock Using the ESP8266

5,999

47

7

Introduction: Network Time Digital Clock Using the ESP8266

About: #BnBe is a platform to help teach electronics no matter what the age or skill level. We’re currently designing a wide range of products from beginner level kits to industry-standard microcontroller platforms.

We learn how to build a cute little digital clock that communicates with NTP servers and displays network or internet time. We use the WeMos D1 mini to connect to a WiFi network, obtain the NTP time and display it on an OLED module.

The video above talks you through the entire process of building this project.

Step 1: Gather the Electronics

To build this project, you will need a WeMos D1 mini or compatible board that uses the ESP8266 chipset along with an OLED module. The sketch should also work with the ESP32 boards but I haven’t tested this.

Step 2: Edit and Upload the Sketch

Download the sketch using the following link: https://github.com/bnbe-club/network-time-using-esp8266-diy-12

Start by adding your network credentials as we need to connect to a WiFi network. Then, make sure you add the correct time zone information. You can visit the following link to obtain the relevant time zone string for your region: https://remotemonitoringsystems.ca/time-zone-abbreviations.php

Before you can upload the sketch, make sure that you have installed the U8g2 library along with the board support package for the ESP8266 boards. Check the images for further information or watch the video for detailed instructions. Once completed, plug in the board and make sure you have selected the right board settings as seen in the image. Then, hit the upload and wait for it to complete.

Once uploaded, open up the serial monitor and make sure that the correct time is being displayed. If not, make sure you have selected the right time zone for your region.

Step 3: Connect the OLED Module

Use the wiring diagram above to connect the OLED module to the microcontroller board. Power on the board and you should see the time displayed on the module.

Step 4: Add the Modules to the Enclosure

Once you're happy with the results, download and 3D print the model from the following link: https://www.thingiverse.com/thing:857858

The board sits on the back cover while the OLED module sits at the end of the enclosure. You can use double-sided tape to hold the OLED module in place and you can also add a bit of hot glue near the wires to keep it in place. Solder the wires from the OLED module to the microcontroller board and then seal the unit by using some glue to hold it together. Plugin the microUSB cable and it should work as expected.

If you've liked this post, then don't forget to follow us using the links below as we will be building many more projects like this one:

Be the First to Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Automation Contest

      Automation Contest
    • Make it Glow Contest

      Make it Glow Contest

    7 Comments

    0
    LexhoyaL11
    LexhoyaL11

    9 months ago

    Hi, I made your project and it is indeed well designed. I saw only one thing in the code, and it might be mentioned already, but Sunday is , so it is like this (with me at least this is working):

    {
    switch(tm_wday)
    {
    case 0:
    return "Sun";
    break;
    Also, what I did was tinker around a bit with the fonts. I've noticed that the larger 128x64 screen I have (0.96 and 0.91) can handle Day (in 3 char) and then the date with u8x8_font_8x13_1x2_r:
    Mon - 18/05/20
    The only thing I will try now is to add my DHT22 to it, and let this project Temp/Humidity also. Very nice project (although I didn't print the case) :)

    0
    josefn1
    josefn1

    1 year ago

    Instead of day of the week i will see "error", what is wrong?

    Today I tried again and it's ok.

    0
    Bnbe_club
    Bnbe_club

    Reply 1 year ago

    Thanks for the update. Sorry I didn't see this comment as I don't get notifications for some reason.

    0
    AnnaMai
    AnnaMai

    1 year ago

    nice, keep up your works :)

    0
    Bnbe_club
    Bnbe_club

    Reply 1 year ago

    Thank you!

    0
    Scotthus2
    Scotthus2

    1 year ago

    dont work.. I get errors saying esp not declared in this scope. it shows up at the esp.restart()

    0
    Bnbe_club
    Bnbe_club

    Reply 1 year ago

    Have you used the same board configuration as shown in the video/top of the sketch? This was tested using the WeMos D1 mini board.