Menu

ESP8266 basic demo

Peter
2016-12-31
2019-12-27
  • Peter

    Peter - 2016-12-31

    This is a bit of a work in progress but I thought it might help others.
    This demo fetches the time (as a string) from a server running the RFC 867 Daytime protocol. Several of the NIST NTP time servers currently run this, and newer versions of Windows have the ability to function as a server ( http://www.windowsnetworking.com/articles-tutorials/windows-7/Windows-7-Simple-TCPIP-Services-What-How.html )

    This is the output on the connected GLCD:

    ESP8266      (dbg)
    Disconnecting...
    Connecting to WiFi...
    Requesting time...
    17:43:32 31/12/2016
    

    This is the full output on the terminal, piggy backed onto the serial connection between the PIC and the ESP8266 (with AT echoing turned on):

    ATE1
    
    OK
    AT
    
    OK
    AT+CWQAP
    
    OK
    WIFI DISCONNECT
    AT+CWJAP="your_ssid_here","abcde12345"
    
    WIFI CONNECTED
    WIFI GOT IP
    
    OK
    AT+CIPMUX=0
    
    OK
    AT+CIPSTART="TCP","192.168.1.5",13
    
    CONNECT
    
    OK
    
    +IPD,20:17:53:27 31/12/2016CLOSED
    

    The modules that I recieved are the ESP12-E and run a recent version of the AT firmware - some versions you get on eBay etc. have different firmware.
    The module is also set at a baud rate of 74880 which took me ages to find out. You can change the baud rate of the AT interface, but the bootup commands seem to be fixed at 74880 unless you flash the firmware which I've not figured out how to do yet.
    If you want to try it, I suggest connecting the ESP9266 to a USB-TTL device and running a terminal to check it works before trying to connect it to a PIC.
    Oh, and remember they run at 3.3V, not 5V :)

    I'll try adding in some of the extra commands when I get time, as well as figuring out NTP/FTP/HTTP.

     

    Last edit: Peter 2016-12-31
  • Peter

    Peter - 2017-12-31

    A year later and another ESP8266 demo.
    This one starts up a server you can connect to via Telnet and it sends data back. It also makes use of the SNTP functions in the newer ESP8266 firmware - much better than using the Daytime Protocol.
    There are also some functions in the demo for parsing IP addresses.

    I'll try and put up a demo video tomorrow.

    Edit 01/01/18: Updated code attached without the missing ServerPort variable.

     

    Last edit: Peter 2018-01-01
    • Peter

      Peter - 2018-01-01

      Demo video:

       
      • Peter

        Peter - 2018-01-01

        And a further example setting up a HTTP server which responds to user inputs to control things (in this case radio controlled mains power sockets).
        The delay is due to the slow process of sending 3 lots of radio signals multiple times, not due to the WiFi / processing speed.

        The code for this is a bit buggy so I've not attached the GCB file.

         

        Last edit: Peter 2018-01-01
  • Anobium

    Anobium - 2018-01-01

    Nice. I want to add ESP8266 to the libraries - a project for this year?

    :-)

    I have tried to compile/port. A few errors. I cannot test whether this start of a port broken something - so, I have attached my port to a Mega328p (lots of variables names had to be changed as these are registers in the Mega328p). Can you test for me? And, I did get variables not defined errors - so, I did define and set to 0.

    Cheers.

     

    Last edit: Anobium 2018-01-01
  • Peter

    Peter - 2018-01-21

    Now controlling an LED strip.: PL9823 LEDs in the video, but it would work with a WS2812b strip too.


    Hopefully YouTube won't take down my video this time.

     

    Last edit: Peter 2018-01-21
    • Anobium

      Anobium - 2018-01-21

      Nice! And the video works!

       
    • Peter

      Peter - 2018-01-21

      Initial version of the ESP8266.h library attached.
      For some reason SF won't let me add it to the original post.

       

      Last edit: Peter 2018-01-21
  • bed

    bed - 2019-01-29

    Hello Peter, I have been flirting a long time ago with the ESP-12.
    Now there is a concrete project that requires me to deal with it.
    I want to use the ESP-12F to provide my PIC (or AVR if necessary) with the correct time and to change some parameters during operation.
    The ESP should connect a few times a day with the guest Wlan WPA2(CCMP) in my house.
    As I understood until now, the ESP has to be powered with 3.3 volts and you use a common USB-TTL module to transfer the communication to the PC in parallel, right?
    Would you be so kind and sketch out how the hardware is wired? Especially the 5V (USB) and 3.3V ESP-12 worries me, that has to be a level change.

    Or does it already work so reliably that I could do without the parallel transfer to the PC and only the connection (and communication) with the microcontroller (PIC, AVR) is enough?

    @ mods: if this should be a seperate thread, so say where I shall post it, please.

     

    Last edit: bed 2019-01-29
  • bed

    bed - 2019-01-30

    Command back!
    I wrote that I wanted to make my next project suitable with the help of ESP-12F Wifi.
    Actually, it's all about a precise time and the optional convenience of a web interface.
    Basically I'm dealing with a lot of problems. For example, the current consumption is very erratic, which doesn't make the design easy and requires a larger transformer than would be expected with the average current consumption. But what made me change my mind now were the reports about the latest hacks in the IOT area. I don't feel like dealing with these security risks.
    So I will simply use these cheap DS3231 RTC modules.

     

Log in to post a comment.