6

Hi I am trying to make Arduino Uno on local network with the help of ESP8266 wifi module.

I tried to search on internet, found mostly they are making ESP8266 as web server.http://circuits4you.com/2016/12/16/esp8266-web-server-html/

Can anyone help me how to add Arduino Uno on network with the help of ESP8266. enter image description here

enter image description here

4
  • Have the idea of searching this very same site with the words "Arduino" and "ESP8266" ever come to your mind? Please have a look at arduino.stackexchange.com/questions/13470/arduino-with-esp8266 and also arduino.stackexchange.com/questions/30837/…. By refining your search you might also find additional answers to more detailed questions that might arise as you move forward with this project. May 3 '17 at 10:30
  • @RobertoLoGiacco I see those examples but they are sending some commands to ESP8266 and reading it. I have done this example. I want something like get the dynamic ip from wifi network with SSID and password and assign it to arduino so i can access it from network
    – N Sharma
    May 3 '17 at 11:06
  • getting a dynamic ip from wifi is DHCP client. You cannot assign an IP to an Arduino, only the ESP8266 has some knowledge of being on the network. Your question is so broad and vague it would require a series of blog posts to get covered in all its aspects. You didn't even explain your wiring between ESP8266 and Arduino, so we are assuming you are using an hardware serial connection, but yous "assign Arduino an IP" made me doubt about this. May 3 '17 at 12:25
  • This was closed as unclear. I have re-opened it at the OP's request. I think it might be classed as "too broad" but let's see where the answers take us.
    – Nick Gammon
    May 9 '17 at 1:20
3

Sending the following commands to the ESP should get you started:

AT+RST                         # Reset
AT+CWMODE=1                    # Set to station-mode as a client
ATE0                           # turn off command echo
AT+CWLAP                       # optional: list access points
AT+CWJAP_DEF="SSID","PASSWORD" # Always connect to this SSID

(I made-up the comment syntax; don't try to send those.) The full ESP8266 AT Instruction Set has the complete set of commands and a functional description of each one.

Update:

... do I need to connect RX of ESP8266 to RX of Arduino, TX of ESP8266 to TX of Arduino, Ground of Arduino to RESET ?

Rx & Tx must be cross-connected with the corresponding Arduino pins and the ESP's reset pulled high (3.3v).

6
  • For this approach do I need to connect RX of ESP8266 to RX of Arduino, TX of ESP8266 to TX of Arduino, Ground of Arduino to RESET ?
    – N Sharma
    May 3 '17 at 14:53
  • No you still need to cross them over. May 3 '17 at 15:00
  • I have this code pastebin.com/C4ZUmVc0 when I am sending AT commands to ESP8266 it is working and blue light blinks.. now I have coded as you suggested.. now I want to know allocated IP address of it ? any way of it ?
    – N Sharma
    May 3 '17 at 15:23
  • Here is my logs Sending an AT commands Got response from esp8266: AT+CWMODE=1 Got response from esp8266: ATE0 Got response from esp8266: busy p... Got response from esp8266: AT+CWLAP Got response from esp8266: busy p... Got response from esp8266: AT+CWJAP_DEF=Moto,reset1234 Got response from esp8266: busy p... Got response from esp8266: Got response from esp8266: OK
    – N Sharma
    May 3 '17 at 16:24
  • All of the commands are documented in the manual I linked, but "AT+ CIFSR" seems like the one you want.
    – JRobert
    May 3 '17 at 22:15
1

It depends on how you want to approach it. I know of two options:

  1. Use AT commands.
  2. Program the ESP.

When you are using AT commands you need to program the Arduino to open a serial line to the ESP (ensuring rx and tx are crossed over). You tell the Arduino to send the AT commands you need to the ESP and wait for each one to be acknowledged. Then the Arduino sends its network data via the serial connection, to the ESP and the ESP will forward it to the network.

You can program the ESP in EXACTLY the same way as you would the Arduino. You could write some code to accept data from the Arduino over either Serial, SPI, I2C or your own proprietary communication method. The ESP has libraries to be a DHCP client, DNS, HTTP client, etc. (most of which you have probably seen already). If you then write a simple application that establishes the connection to the network and then waits for a packet of data from either the Arduino or the network and forwards it as appropriate.

I can't tell you which option is best, because I have never tried either method. I just program the ESP to do everything that the Arduino would have done anyway and simplify the code.

4
  • I was trying to program ESP8266, have some kinda setup like I connected Arduino to my laptop, connected RX of ESP8266 to RX of Arduino, TX of ESP8266 to TX of Arduino, Ground of Arduino to RESET. But I was doing something like arduino.stackexchange.com/questions/37798/… I pasted my error logs also there..
    – N Sharma
    May 3 '17 at 13:03
  • I hope my setup was correct ? What could be cause of errors ? Would you care to answer there please ..
    – N Sharma
    May 3 '17 at 13:04
  • Arduino Rx <- ESP TX and ESP Rx <- Arduino TX. The Arduino transmits on the Tx and the ESP listens for it on the Rx, and vice versa. If you do Tx to Tx and Rx to Rx it won't work at all. BTW Most people make that mistake first time. Also the Gnd of the Arduino and ESP must be connected together, otherwise you can get a floating ground, which will result in them not knowing what Low and High are. You should also use a bidirectional level shifter for any connections (except Gnd) between a 3.3v device (ESP) and a 5V device (Arduino) May 3 '17 at 14:42
  • I have connected and ESP8266 is able to receive command whatever I am sending like this pastebin.com/YYSjASZe now can you please suggest what changes do i need to make to get allocated ip address so i can access it from network I have selected "Arduino Uno" as board in Arduino IDE
    – N Sharma
    May 3 '17 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.