In this illustration we will going to wire the ESP8266 Module on Arduino but before we can proceed we need to setup the ESP8266 module using AT-COMMAND please refer to this link. As you can see the illustration below our host control is the Arduino MCU board that controls the ESP8266 and the 4 channel relay.

ESP8266 AT COMMAND

ESP8266-Arduin-Diagram-Pinout-Illustration-schematics-Logic-Converter-02

By removing the ATMEGA328P Chip we consider that were going to use the TTL UART of the Arduino.

Sometimes the size of the message from ESP8266 is big for Arduino, you need to change the buffer which is defined in “HardwareSerial.h” it is located in directory “\arduino\hardware\avr\cores\arduino\HardwareSerial.h” and see the
“ #define SERIAL_BUFFER_SIZE 64” the default size of the buffer is 64 you need to change to bigger number, for example 256 or more.

Internet-of-things-arduino-esp8266

Required Component

  • Arduino UNO
  • ESP8266 V1
  • 4 Channel Relay Board or Shield
  • Jumper Wires / DuPont Wires
  • Solder Less Breadboard
  • Home Appliance for Testing
  • Android Phone or Tablet

Wiring Diagram Schematics

HOME-AUTOMATIONS-ARDUINO-With-ESP8266

Arduino Sketch Code

Arduino Wifi with ESP8266 Code Library

  • Download The Arduino ESP8266 Code Library Here | Zip
  • Download UARTWIFIUNO Library Here | Zip
Wiring ESP8266 WiFi Transceiver on Arduino with Relay
Facebooktwittergoogle_plusredditpinterestmail

19 thoughts on “Wiring ESP8266 WiFi Transceiver on Arduino with Relay

  • at
    Permalink

    webserver_uno.ino:6:65: fatal error: uartWIFIUNO.h: No such file or directory
    compilation terminated.
    Error compiling.

    hello sir i am getting this error
    i am using same code as you given above
    My IDE is ARDUINO 1.6.5

    Reply
    • at
      Permalink

      Hi! Yogi,

      Download the Code Library named
      uartWIFIUNO.h <----- and placed it into your Arduino Library located at My Documents/ Arduino / Libraries just copy the whole directory and phase. Let me know if you still having an error compiling the code above.

      Reply
  • at
    Permalink

    Hi Yogi,

    I guess there some issue with the library it think it is absolute….
    #include “ESP8266.h >
    Use this library > https://github.com/itead/ITEADLIB_Arduino_WeeESP8266

    1. Make it sure, you have complete library as required for the sketch code,
    #include “ESP8266.h > Download it Here “Use this library > https://github.com/itead/ITEADLIB_Arduino_WeeESP8266
    You don’t need to download this library.
    2. Make it sure you place a 200uf capacitor between GND and VCC to stabilize the logic voltage going to ESP8266.
    3. Try fist using USB Serial Communication by placing the pin to ESP TX and RX to pin 0,& 1, Test the communication between the ESP8266 to Arduino by using AT Command.
    ———

    Reply
  • at
    Permalink

    hello, my code’re error when checking
    ‘Exit status 1
    compiling error.
    how can I fix

    Reply
  • at
    Permalink

    Error compiling.
    Dear sir I am getting this error……..
    ………………………………………………………………………………………………………………………………………………
    Arduino: 1.6.8 (Windows 7), Board: “Arduino/Genuino Uno”

    C:\Users\Chinmay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-947-g39819f0\libraries\ESP8266WiFi\examples\WiFiScan\WiFiScan.ino:23:65: fatal error: uartWIFIUNO.h: No such file or directory

    #include “uartWIFIUNO.h” // Can be downloaded below on this page

    ^

    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Reply
  • at
    Permalink

    where is uartWIFIUNO.h sir….? I cannot find it in your page and code library on your post…
    please help me to solve the error
    include “uartWIFIUNO.h” // Can be downloaded below on this page

    ^

    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Reply
      • at
        Permalink

        sir i succes to added library to Arduino IDE, and succes to compile and upload sketch to arduino UNO. But i find in serial monitor, that ”
        AT+RST
        Module have no response
        Begin error
        Init error
        please tell me about this error..
        my email : [email protected]

        Reply
        • at
          Permalink

          There are two possible error in your case first is your serial communication is busy, second is if your using Arduino or the code below try to shift your serial communication RX = 0; & TX = 1; add 100uf capacitor to GND and VCC to your ESP8266 module, then use coolterm serial tool to verify that your ESP8266 module is connected in a proper way.

          Regards

          Reply
  • at
    Permalink

    Hi,
    i like your instruction and got it to work…
    I have some issues with the schematics. It would be great when the pinout of the esp8266-01 would be like its on the pc board.
    Sorry for the bad english but i hope you know what i mean.

    Reply
  • at
    Permalink

    how to know the ip address of esp8266 wifi module

    Reply
    • at
      Permalink

      Serial or software serial, open your serial monitor then connect to the port.
      you can used Arduino Serial Monitor, Putty, TermCool any Serial tools or Use LCD to print the IP Address of ESP82XX | lcd.println(IP Address: ); lcd.print(ipstring);
      ———————————————————
      String ipstring = wifi.showIP();
      DebugSerial.println(ipstring);
      ——————————————————–

      Reply
  • at
    Permalink

    sir one doubt the library pasting is in rar format or in extract file format

    Reply
    • at
      Permalink

      ?????? you need to extract the file which is in the rar file then then upload the code using your IDE. don’t forget the code libraries to place in your code library directory. :)

      Reply
  • at
    Permalink

    Hi sir,

    “Wiring ESP8266 WiFi Transceiver on Arduino with Relay” program run but actually,

    when can i firmware in esp8266-01?
    when can i use “at cammad “?

    i am reading but no any idea firmware and at cammand.

    please explain me.

    Reply
  • at
    Permalink

    I am getting this error
    In file included from C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:22:0:

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:67:0: warning: “OPEN” redefined

    #define OPEN 1

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:55:0: note: this is the location of the previous definition

    #define OPEN 0

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:75:0: warning: “SERIAL_TX_BUFFER_SIZE” redefined

    #define SERIAL_TX_BUFFER_SIZE 128

    ^

    In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232:0,

    from sketch\sketch_mar29a.ino.cpp:1:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:46:0: note: this is the location of the previous definition

    #define SERIAL_TX_BUFFER_SIZE 64

    ^

    In file included from C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:22:0:

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:76:0: warning: “SERIAL_RX_BUFFER_SIZE” redefined

    #define SERIAL_RX_BUFFER_SIZE 128

    ^

    In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232:0,

    from sketch\sketch_mar29a.ino.cpp:1:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:53:0: note: this is the location of the previous definition

    #define SERIAL_RX_BUFFER_SIZE 64

    ^

    C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:27:12: warning: type of ‘chlID’ does not match original declaration

    extern int chlID;

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO\uartWIFIUNO.cpp:19:8: note: previously declared here

    int8_t chlID; //client id(0-4)

    ^

    Reply
  • at
    Permalink

    Getting this error even after adding prescribed files to library
    In file included from C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:22:0:

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:67:0: warning: “OPEN” redefined

    #define OPEN 1

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:55:0: note: this is the location of the previous definition

    #define OPEN 0

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:75:0: warning: “SERIAL_TX_BUFFER_SIZE” redefined

    #define SERIAL_TX_BUFFER_SIZE 128

    ^

    In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232:0,

    from sketch\sketch_mar29a.ino.cpp:1:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:46:0: note: this is the location of the previous definition

    #define SERIAL_TX_BUFFER_SIZE 64

    ^

    In file included from C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:22:0:

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO/uartWIFIUNO.h:76:0: warning: “SERIAL_RX_BUFFER_SIZE” redefined

    #define SERIAL_RX_BUFFER_SIZE 128

    ^

    In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232:0,

    from sketch\sketch_mar29a.ino.cpp:1:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:53:0: note: this is the location of the previous definition

    #define SERIAL_RX_BUFFER_SIZE 64

    ^

    C:\Users\NEXUS\OneDrive\Documents\Arduino\sketch_mar29a\sketch_mar29a.ino:27:12: warning: type of ‘chlID’ does not match original declaration

    extern int chlID;

    ^

    C:\Program Files (x86)\Arduino\libraries\ESP8266UNO\uartWIFIUNO.cpp:19:8: note: previously declared here

    int8_t chlID; //client id(0-4)

    ^

    Reply
  • at
    Permalink

    Did we need to replace back the atmega328 after the set up of at-command??

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *