Header Ads

Header ADS

How to use Websocket in ESP8266

Here I am going to give example of ESP8266 websocket

1. What is websockets?

 WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. ... The WebSocket protocol enables interaction between a web client (such as a browser) and a web server with lower overheads, facilitating real-time data transfer from and to the server.

      2. Why we need websockets?

    • Full duplex communication
    • Lower latency interaction,
    • Enhances the efficiency of Client and Server Communication,
    • User-friendly API,
    • Opens complete Duplex Link over the Web.

    Bill of Materials
    1. Nodemcu v1.0 (ESP8266),
    2. DS32331 board with EEPROM 24C32,
    3. Jumper wires to connect the boards.
    Connection details:

    Connect 3v3 and Gnd to power up the DS3231 board and SDA & SCL connect to D1 & D2 pin as shown in figure above. now plug in to usb connection and upload the program. To download a program click here.
    Check here for one more example with code

    Features of this program:
    1. Send date time to web page from DS3231 RTC board,
    2. 24C32 EEPROM used to store the switch status and read back when we needed,
    3. Using JSON format for communication between web page and  ESP8266,
    4. CSS and JS file loaded to CSS & JS folder by ESP8266,
    5. EEPROM will recall the switch status after restart/startup.

    Screen short of the web page see below:



    See the below Video:



    No comments

    Powered by Blogger.