Simplest ESP8266 Local Time Internet Clock With OLED

37,967

285

46

I was looking for a straightforward clock to use with a 128x64 OLED I got from Adafruit but found that a lot of the implementations were too cumbersome, involved a ton of code, weren't clear on what NTP servers to use and how, and basically offered very little in terms of making a clock with the LOCAL time (not UTC, which is easy enough to get). So I set about doing my own research and ended up with this simple clock that leverages already made libraries to minimize the code footprint, while offering some interesting tweaks in displaying the time (like AM/PM, 12-hour format, names for months, days, etc). This instructable assumes you have some experience programming ESP-01s but if not, there are a ton of wonderful tutorials available on Instructables! Enjoy!

Step 1: Components

For this instructable you will need:

  • ESP8266-01 module
  • 128x64 OLED with I2C interface
  • 3.3V power supply
  • A way to program the ESP-01

Step 2: Wire It Up!

The wiring is simple. Just follow the diagram above and connect the wires. Then get a 3.3V power supply (I used a step-down module to go from 12V to 3.3 but you can use whatever you have in your arsenal as long as it outputs 3.3V and at least 0.5 A).

Step 3: Program the ESP-01

This step can be frustrating if you haven't done it before, but once you get the hang of how the ESP boards work and have the correct drivers and libraries installed in Arduino, you can go ahead and use the following code. But first, you will need to download and install the following libraries:

You may need to modify some of the code according to what OLED you're using (as long as it's SSD1306 it'll work but you may need to update the hex I2C address) and then you may have to change some of the Timezone rules depending on your timezone and daylight savings time rules. Then upload the code attached and you should be done!

Step 4: See It Go!

Once you have programmed the ESP, plugged everything in, make sure you have 3.3V going into the setup and then power it on and see your correct time on the tiny display!

5 People Made This Project!

Recommendations

  • Plastics Contest

    Plastics Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • Optics Contest

    Optics Contest

46 Discussions

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

3 replies
0
None
karsten2meahdi

Reply 8 weeks ago

hey, you have to edit the line 94 and 95 to deposit your own difference to the utc-time.

0
None
wangzhenmeahdi

Reply 10 months ago

youcan do that: setTime(nettime + x * 3600);

Im in china so x = 8 setTime(nettime + 8 * 3600);

0
None
timg11

Question 4 months ago on Step 3

Compiler gives: "WARNING: library Timezone claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (esp8266) architecture(s)."

Does this mean anything?

1 more answer
0
None
giecuk

9 months ago

why my oled not showing anything...
i'm using LCD OLED 0.96" WHITE I2C, the OLED is not broken, because i have tested it with other library with my arduino uno.
seems the ESP8266 successfully uploading, because when i test serial monitor, it's working...
but my oled blank, no any display... and i have already try to changing 0x3C it's same...

10751189271388600327.jpggfjgfkj.PNG
1 reply
0
None
giecukgiecuk

Reply 9 months ago

Solved it by reflashing the esp8266 using newer firmware.

0
None
giecuk

Question 9 months ago on Step 3

please help me, my oled won't show screen, it's not broken oled... because if i have another sketch the oled works...

0
None
josefn1

1 year ago

Very nice and simple project.
Could you add sketch for 24-hour format?

3 replies
0
None
MichaelM1287TomK32

Reply 9 months ago

how to change this to BST.

I added like that, but don't work for me. didi I missed something

TimeChangeRule BST = {"BST", Last, Sun, Mar, 1, 60}; //British Summer Time

TimeChangeRule GMT = {"GMT", Last, Sun, Oct, 2, 0}; //Standard Time

Timezone UK(BST, GMT);

0
None
josefn1TomK32

Reply 1 year ago

Thanks, time is now displayed in a 24-hour format.

0
None
RomanL33

1 year ago

Dobrý den, poradí mi někdo jak změním časové pásmo? Děkuji Roman

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

0
None
meahdi

1 year ago

Hi

I like this project

How can i change time zone to my local time

0
None
meahdi

1 year ago

Hi

I like this Project and want to make it

How can i change time zone to my local time?