Sunday, 9 April 2017

sending data from Arduino over ESP 13 sheild (win/ linux/ mac)

I was working on my new project which include Esp13 sheild. But it turned out that I, like many people, couldn't simply "turn it on and expect it to work". So to make the task simple for you I had written this blog.

To work with ESP13 WIFI Sheild follow the steps.


  • Connect the Wifi sheild to Arduino .

                    Arduino uno and Esp 13 wifi sheild.

               Arduino mega and Esp 13 wifi sheild.

     

     

     

  • NOW Connect the wifi from your laptop or mobile

     

     If wifi is not connecting press key button on esp13 for 2 seconds and connect to wifi

     

     

  • Then open any web browser and Type " 192.168.4.1 " in the address bar and hit enter.                     


  • Then configure the Wifi module :


    • Lets leave wifi open for now
    • Ip = 192.168.4.1
    •   9600
    •   8
    • none
    •   1
    • TCP
    • Server

When all settings are done click submit button the module will restart after 5 seconds

  


  • Now Upload Test Program to arduino.

     

      void setup()
    {
      Serial.begin(9600);
     
    }
    void loop()
    {
      delay(1000);

      Serial.println(" - hello ESP8266 WiFi"); //output the serial data
    }


                  Note: SW switch should be OFF while uploading the program to arduino otherwise it will not upload the code because Arduino uses Tx , Rx to upload program.

  • Now Switch the SW to on and connect to wifi

  •  
     
  • Now Write the python program to receive the data from TCP Socet.

     

    import socket
    import sys
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_address = ('192.168.4.1', 9000)
    #print >>sys.stderr, 'connecting to %s port %s'% server_address
    sock.connect(server_address)
    print  ("Connection made!")

    try:
     while 1:
      data = sock.recv(16)
      print  ('%s' % data)

    finally:
      print  ('closing socket')
      sock.close()
 
 
 
  • Run the code the output will be like this.