Esp8266 Oled - Get Time And Date From Internet
About the project
In this tutorial we will learn how to get the date and time from NIST TIME server using ESP8266 OLED and Visuino,
Items used in this project
Story
In this tutorial we will learn how to get the date and time from NIST TIME server using ESP8266 OLED and Visuino,
Watch a demonstration video.
Step 1: What You Will Need
- ESP8266 OLED
- Visuino program: Download Visuino
Step 2: Start Visuino, and Select the Arduino WeMos D1 Mini Board Type
1 / 2
To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.
Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this tutorial will not work! If you have not done follow the steps in this tutorial to setup the Arduino IDE to program WeMos D1 Mini! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "WeMos D1 Mini" as shown on Picture 2
Step 3: WiFi Setup
1 / 2
- Select WeMos D1 Mini and in the editor Modules>WiFi>Access Points, click on [...] button, so that "Access points " window will open.In this editor drag the WiFi access point to the left side.
- In the properties window Under "SSID" put the name of your WiFi Network
- Under "Password" put the access password for your WiFi network
- Close the "Access points" window
- On the left in editor select Modules>Wifi>Sockets, click on [...] button, so that "Sockets" window will open Drag the TCP/IP Client from right to the left side, then Under Properties window set port: 37 and host: time-a-g.nist.gov
- Close the "Sockets" window
Step 4: In Visuino Add Components
1 / 3
- Add "Pulse Generator" component
- Add "Internet Time Protocol" component
- Add 2X "Delete Right Sub Text" component
- Add 2X "Delete Left Sub Text" component
- Add "SSD1306/SH1106 OLED Display (I2C)" component
Step 5: In Visuino Set Components
1 / 3
- Select "PulseGenerator1" and in the properties window set frequency to 0.1166667
- Select "DeleteRightText1" and in the properties window set Length to 13
- Select "DeleteRightText2" and in the properties window set Length to 5
- Select "DeleteLeftText2" and in the properties window set Length to 12
- Double click on the "DisplayOLED1" component
Elements Dialog will show
- In the Elements Dialog expand "Text" on the right side and drag "Draw Text" and drag 2X "Text Field" from the right side to the left
- In the Elements Dialog expand "Lines" on the right side and drag "Draw Line" from the right side to the left
- Select "Draw Text1" on the left side and in the properties window set "Text" to 'Time&Date' (or some other text) and set size to 2
- Select "Draw Line1" and in the properties window set "Width" to 120 and "Y" to 20
- Select "Text Field1" and in the properties window set "Size" to 2 and "Y" to 25
- Select "Text Field2" and in the properties window set "Size" to 2 and "Y" to 45
Close the Elements Dialog
Step 6: In Visuino Connect Components
- Connect "PulseGenerator1" pin [Out] to "InternetTime1" pin [In]
- Connect "InternetTime1" pin [Socket] to "WeMos D1 Mini" >TCP Client1 pin [In]
- Connect "InternetTime1" pin [Out] to "DeleteRightText1" pin [In] and "DeleteRightText2" pin [In]
- Connect "DeleteRightText1" pin [Out] to "DeleteLeftText1" pin [In]
- Connect "DeleteRightText2" pin [Out] to "DeleteLeftText2" pin [In]
- Connect "DeleteLeftText1" pin [Out] to "DisplayOLED1">Text Field1 pin[In]
- Connect "DeleteLeftText2" pin [Out] to "DisplayOLED1">Text Field2 pin[In]
Step 7: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Step 8: Play
If you power the ESP8266 OLED module, it will connect to the internet and the display should start showing the date and time from the NIST server
.You can also experiment with other servers that you can find here https://tf.nist.gov/tf-cgi/servers.cgi
Congratulations! You have completed your Internet Time project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it here. You can download and open it in Visuino: https://www.visuino.eu
Leave your feedback...