Shop OBEX P1 Docs P2 Docs Learn Events
Low cost wifi module ESP8266 — Parallax Forums

Low cost wifi module ESP8266

Dr_AculaDr_Acula Posts: 5,484
edited 2015-06-17 05:09 in Propeller 1
$5 wifi module ESP8266

Some email chatter today among the Aussie forum members about this new module. All very new, not sure if anyone has one yet, several on order and on the way.

Hackaday have covered it http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/

More specs here https://nurdspace.nl/ESP8266

Hardware looks like SPI. Software is a work in progress - it seems people are writing code before even getting hold of the module.

I've got one on order (search ESP8266 on ebay). Possible to interface with a Propeller? Or impossible...
«13456718

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2014-09-15 21:29
    I've been keeping careful track of it, it could be very interesting...
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-09-15 22:40
    Interesting indeed!!
  • TonyDTonyD Posts: 210
    edited 2014-09-16 05:16
    Saw it advertised on Seeedstudio a few weeks ago:

    http://www.seeedstudio.com/depot/WiFi-Serial-Transceiver-Module-w-ESP8266-p-1994.html

    very interesting device at that price point.
  • homosapienhomosapien Posts: 147
    edited 2014-09-16 07:35
    I too have been keeping an eye on this. Great price. Most of the information so far is that there is little non-Chinese documentation, so it is a little hard to utilize. Appears to be a Chinese knockoff using a Broadcom (or Broadcom clone) chip, some people have mentioned there may be legal issues if using in a product you want to sell commercially. Will be interesting to see if the Hackaday thread makes progress in getting it to actually work.

    I have been using the TI CC3000 (I have been producing breakout boards for $24.95, photo attached) with the prop, . Considering the firmware updates that the CC3000 has gone through (a lot) to make it somewhat reliable, I can imagine the ESP8266 may have some growing pains before it or some future iteration is off-the-shelf-functional. But it does look like we will get to the ~$5 WiFI module in the not too distant future.


    IMAG1242.jpg




    Nate
    1024 x 612 - 71K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-09-23 15:29
    So I just got one of these in a couple days ago.. They are a "cakewalk" to get working.

    Here's some help with the BASIC commands.
    AT+RST							Reset
    AT+CWMODE=3						Set as Client and Access Point
    AT+CWLAP							List Access Points
    AT+CWJAP="ssid","password"		                Join Access Point
    AT+CIFSR						Display Current Assigned IP Address
    
    (Unit it PINGable at this point)
    
    AT+CIPMUX=1						Set Single Connection
    AT+CIPSERVER=1,{port}			                Open Socket Server
    
    (A telnet connection can be opened at the specified port)
    
    AT+CIPSEND=0,{number of bytes}	>Send number of bytes
    

    I created a simple webserver using one of these this evening for my MMC project.
    I double anyone here would have ANY problem converting it over to use Spin using the FullDuplexSerial object.

    The biggest tip I can give is don't bother creating proper "HTML" headers. It'll actually cause things not work.
    They are a bit power hungry. I had to find a 1amp power supply for my board instead of the 500ma unit I was using.

    Jeff
  • __red____red__ Posts: 470
    edited 2014-09-23 21:04
    AT+CWLAP
    +CWLAP:(0,"",0)
    +CWLAP:(2,"KERUBINHD",-85)
    +CWLAP:(0,"[URL="http://AP.INDTOW.Dasia.Net"]AP.INDTOW.Dasia.Net[/URL] 704.225.1776",-88)
    +CWLAP:(3,"Bright",-93)
    +CWLAP:(4,"rosenet",-74)
    +CWLAP:(4,"Rosenet_Guest",-75)
    +CWLAP:(4,"ATTejDGSVS",-80)
    +CWLAP:(4,"buifamily",-90)
    +CWLAP:(4,"2WIRE958",-91)
    +CWLAP:(1,"SKIP53",-91)
    +CWLAP:(3,"teasea5G",-47)
    +CWLAP:(4,"Loyola Home",-87)
    
    << Red entering his Wifi Passowrd here >>
    
    AT+CIFSR
    192.168.1.6
    
    AT+CIPSTART="TCP","192.241.248.6",80
    
    OK
    Linked
    AT+CIPSEND=7
    > GET /
    SEND OK
    
    +IPD,185:<html>
    <head><title>301 Moved Permanently</title></head>
    <body bgcolor="white">
    <center><h1>301 Moved Permanently</h1></center>
    <hr><center>nginx/1.5.12</center>
    </body>
    </html>
    
    OK
    
    OK
    Unlink
    

    Yes, they work perfectly... :-D
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-09-24 08:09
    Nice work guys!

    Argh. More toys to order.
  • doggiedocdoggiedoc Posts: 2,239
    edited 2014-09-30 13:24
    I ordered a few to play with - OBC has a good thread going on Propellerpowed.com about using them with his Micromite Companion Board that uses a propeller.

    I'm thinking more along the lines of interfacing with the propeller - I'm hoping to incorporate it into my Chicken Coop controller to interface with the Spinneret.

    Doc
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-09-30 15:29
    I can't imagine anything I've done in BASIC on the Micromite Companion not being easily replicatable in Spin using FullDuplexSerial and the Strings library. This module is silly-easy to work with once you get your head worked around the idea that you have to measure the data you are sending, then prefix it with a command.

    I can say however, that I'm rather pleased with the idea that I managed to create an entire IRC client in 5k of BASIC.. Beat that Spin! :)

    Jeff
  • doggiedocdoggiedoc Posts: 2,239
    edited 2014-09-30 16:14
    I can say however, that I'm rather pleased with the idea that I managed to create an entire IRC client in 5k of BASIC.. Beat that Spin! :)

    Jeff
    I saw that. Great job by the way! I don't think I'm up to the task of besting it. ;)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-09-30 16:22
    Truth be told.. The Propeller is running a huge VT100 emulation for VGA, keyboard interface, and Full Duplex Serial to the Micromite leaving it with the only job of communicating with the ESP8266 and pushing the information to/from the screen and keyboard maintained by the Propeller. I was being a bit cheeky there.. :)
  • doggiedocdoggiedoc Posts: 2,239
    edited 2014-10-02 16:12
    I don't seem to be getting very far.

    Think I need to just walk away for a spell.
  • WurlitzerWurlitzer Posts: 237
    edited 2014-10-03 05:13
    First, while I can program in PASM, VB, Spin without breaking a sweat this internet stuff, even though I am very interested, makes my eyes glaze over like reading a 50 page insurance policy.

    Second: What are the chances this module coupled with a Prop could accept xLights E131 data for a Christmas light controller driving the WS2811 LED strips?
  • EE351EE351 Posts: 81
    edited 2014-10-03 08:40
    Wurlitzer wrote: »
    First, while I can program in PASM, VB, Spin without breaking a sweat this internet stuff, even though I am very interested, makes my eyes glaze over like reading a 50 page insurance policy.

    Second: What are the chances this module coupled with a Prop could accept xLights E131 data for a Christmas light controller driving the WS2811 LED strips?
    2 things to consider:
    1). Can this module accept incoming udp/ip data packets? (I would be surprised if it couldn't)
    2). What is the fastest baud rate/spi speed this module can be set to? This may be a limiting factor in the number of pixels you can drive.
    Also, these modules are limited to the 2.4 ghz wifi band. This means you will have interference from other 2.4 ghz devices which will cause periodic "glitches" in your rgb display (I know this from my own personal experience using an rn-xv wifi module).
  • WurlitzerWurlitzer Posts: 237
    edited 2014-10-03 10:15
    EE351 wrote: »
    2 things to consider:
    1). Can this module accept incoming udp/ip data packets? (I would be surprised if it couldn't)
    2). What is the fastest baud rate/spi speed this module can be set to? This may be a limiting factor in the number of pixels you can drive.
    Also, these modules are limited to the 2.4 ghz wifi band. This means you will have interference from other 2.4 ghz devices which will cause periodic "glitches" in your rgb display (I know this from my own personal experience using an rn-xv wifi module).

    1) Agreed, it sure should be able to accept udp/ip
    2) valid points. I believe I would be looking @ 400kbaud (approx). Living in a rural area, I would mostly be concerned with my own generated interference which I could control to some extent, like my Microwave will pause my printer.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-10-07 23:48
    I've converted the datasheet into English and reformatted it if anyone is interested. This PDF gets updated every so often while I edit the document in Google docs. I will also be adding a command and applications section to it as well.

    Contact me if you would like to contribute to the document.

    BTW, I've contacted the manufacturer about making this document available.

    Darn, wouldn't you know it, the very moment I do an English version then they release one! I will still update mine from this though as I have put in the pinout signals and will be adding more.
  • MJBMJB Posts: 1,235
    edited 2014-10-08 02:28
    https://drive.google.com/folderview?id=0BwK3EhAfht8uWTdBdG55NEFCakE&usp=sharing

    some english documents.
    The datasheet seems to be from the manufacturer - not a community translated one.

    ESP8266.com
    is an active forum for this chip
  • ProcessingData...ProcessingData... Posts: 208
    edited 2014-10-08 14:56
    My Modules came last week.

    I have some half-working code, as in I get half of a response from the module, half of the time.

    I once got it to list the IP address with this.
    Usually, I'll get a response from the AT+RST, and the AT+CWMODE=1, but the AT+CWJAP usually doesn't print out anything.
    {ESP8266 }
    
    
    CON
            _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
            _xinfreq = 5_000_000
    
    
            baud  = 115200
            RXPIN = 1
            TXPIN = 0
    var
    
    byte buffer[10]             
    OBJ
      
      serial        : "FullDuplexSerialPlus"
      term          : "FullDuplexSerialPlus"
    
    PUB main | i,j
    
    serial.start(RXPIN, TXPIN, 00, baud)
    term.start(31,30,00,115200)
    
    
    waitcnt(clkfreq*4+cnt)
    term.str(string("Starting Up Terminal",13))
    
    sendCommand(string("AT+RST"))
    getResponse
    
    sendCommand(string("AT+CWMODE=1"))
    getResponse
    
    
    repeat 5
      term.str(string("AT+CWJAP=",34,"SSID",34,",",34,"PASS",34, 13))
      sendCommand(string("AT+CWJAP=",34,"SSID",34,",",34,"PASS",34))
      getResponse
      waitcnt(clkfreq+cnt)
    
    waitcnt(clkfreq+cnt)
      
    sendCommand(string("AT+CIFSR"))
    getResponse
    
    repeat
    
    PRI getResponse | i, a
    
      repeat a from 0 to 9
        buffer[a]:=0        
              
      i:= serial.rxtime(5000)
      repeat while i <> -1
        term.tx(i)
        i:= serial.rxtime(5000)
    
      return false
    
    PRI sendCommand(strng) | i
    
    serial.str(strng)
    serial.tx(13)
    'serial.tx(10) ' not needed
    
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-10-08 16:43
    My first question is what kind of power are you supplying to the module? My experience with these is they will not do much more than AT+RST when powered from USB along with the micro board. You really need to power these from a wall wart (maybe Lipo battery pack but haven't tried that yet).
  • ProcessingData...ProcessingData... Posts: 208
    edited 2014-10-08 16:59
    I'm feeding it from the 3.3v regulator on the PPDB.
    That should be enough, right?

    I'm now getting responses from everything but AT+CIFSR.
    AT+RST
    
    
    
    
    
    
    
    
    OK
    
    
    
    
    
    
     ets Jan  8 2 boot mode:(3,6load 0x40100000m 16
    
    
    tail 12
    
    
    chksum 12 room 4
    
    
    loan 3168, room 12
    
    
    tail 4
    
    
    chksum e8c60, len 4956, room 4
    
    
    tail 8
    
    
    chksum
    
    
    
    
    ready
    
    
    AT+CWMOD
            AT+CWJAP="SSID","PASS"
    ID","PASS"
    
    
    
    
    
    
    
    
    OK
    
    
    AT+CIFSR
    
  • Mag748Mag748 Posts: 263
    edited 2014-10-11 10:41
    Has anyone had any luck updating these units via the cloud? I've managed to flash the new firmware to 00170901, but after the AT+CIUPDATE command, the module starts acting funky and I have to revert back to the flashed version to get any use out of it.

    Thanks,
    Marcus
  • Mag748Mag748 Posts: 263
    edited 2014-10-11 11:07
    Mag748 wrote: »
    Has anyone had any luck updating these units via the cloud? I've managed to flash the new firmware to 00170901, but after the AT+CIUPDATE command, the module starts acting funky and I have to revert back to the flashed version to get any use out of it.

    Thanks,
    Marcus

    Ahh, I didn't see this little note on the bottom of the page stating the following:
    command input end use \ r \ n;

    I updated my serial repeater to add the ASCII 10 character after the PST sends the 13 character. (BTW, I now know you can hit CTRL-enter to send both CR/LF?)

    source: http://blog.electrodragon.com/cloud-updating-your-wi07c-esp8266-now/

    Thanks,
    Marcus
  • Cluso99Cluso99 Posts: 18,066
    edited 2014-10-15 16:35
    My ESP8266 module arrived. Nice and tiny!!
    Now to find some time to test this out :)
  • ProcessingData...ProcessingData... Posts: 208
    edited 2014-10-15 18:32
    Here's my working server code!

    I'm trying to condense the code for the server and client into reusable objects for other projects.


    {ESP8266 Wrapper}
    
    
    
    CON
            _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
            _xinfreq = 5_000_000
    
    
      rx_pin = 0
      tx_pin = 1
      mbaud  = 115200
      
    OBJ
      serial      : "FullDuplexSerial_2k"
      term        : "FullDuplexSerial_2k"
    
    
    VAR
    
    
    byte buffer[15]
     
    PUB main
    ' Connect to the ESP Module
      serial.start(tx_pin,rx_pin,%0000,mbaud)
      term.start(31,30,%0000,115200)
    
    
      waitcnt(clkfreq*4+cnt)
      serial.rxflush
    
    
      if !checkForConnection
          term.str(string("Error: Module did not respond"))
        abort
      else
        term.str(string("Module is responding.",13))
    
    
      SendCommand(@RST, @READY)
    
    
      ' Join the AP
      str(@CWJAP)
      tx(34)
      str(string("SSID"))
      tx(34)
      tx(",")
      tx(34)
      str(string("PASSWD"))
      tx(34)
      tx(13)
      tx(10)
      lookForSuccess(@OK)
    
    
      'str(string("AT+CWJAP?"))
      'tx(13)
      'tx(10)
      'lookForSuccess(@OK)
    
    
      'str(string("AT+CIFSR"))
      'tx(13)
      'tx(10)
      'lookForSuccess(@OK)
    
    
      ' Setup Multiple Connections
      str(@CIPMUX)
      tx("1")
      tx(13)
      tx(10)
      lookForSuccess(@OK)
      
      ' Setup the Server
      str(@CIPSERVER)
      tx("1")
      tx(",")
      str(string("80"))
      tx(13)
      tx(10)
      lookForSuccess(@OK)
    
    
      ' Go to the Main ServerLoop
      ServerLoop
      
    PUB ServerLoop | char, conn
    
    
      repeat
        char := serial.rx
        if char <> -1
          term.tx(char)
    
    
        if char == "+"
          serial.rx
          serial.rx
          serial.rx
          serial.rx
          conn := serial.rx
          if conn <> "L"
            'lookForSuccess(@OK)
            serial.rxflush
            str(@CIPSEND)
            tx(conn)
            tx(",")
            dec(strsize(@HTML))
            tx(13)
            tx(10)
            waitForPrompt
            str(@HTML)
            lookForSuccess(@OK)
            waitcnt(clkfreq/2+cnt)
            str(@CIPCLOSE)
            tx(conn)
            tx(13)
            tx(10)
             
        
    PUB SendCommand(strr,end)
      str(strr)
      tx(13)
      tx(10)
    
    
      if lookForSuccess(end)
        return true
      return false
    
    
    PUB waitForPrompt | i 
    
    
      repeat
        i := serial.rxtime(5000)
        term.tx(i)
        if i == -1
            term.str(string("Timed Out"))
          return false
        if i == ">"
          return true
    
    
    PRI str(strin)
      term.str(strin)
      serial.str(strin)
    
    
    PRI tx(char)
    
    
      term.tx(char)
      serial.tx(char)
    PRI dec(amt)
    
    
      term.dec(amt)
      serial.dec(amt)
          
    PRI lookForSuccess(end) | char, tmp, bufferpos
    
    
    bufferpos := 0
    repeat
      char := serial.rxtime(5000)
      
      if char == -1
        quit
    
    
      term.tx(char)
    
    
    ' Add to the listen buffer
      if bufferpos == strsize(end)-1
        repeat tmp from 0 to strsize(end)-1
          buffer[tmp] := buffer[tmp+1]
    
    
        buffer[bufferpos] := char
        buffer[strsize(end)]:=0
      else
        buffer[bufferpos++]:=char
      if strcomp(@buffer, end)
        return true
         
    
    
    return false
    
    
    PRI checkForConnection
    
    
     return SendCommand(@AT,@OK)
    
    
    DAT
    
    
    HTML        byte "HTTP/1.0 200 OK",13,10,13,10,"<body style=",34,"background:red;",34,">",0
    
    
    OK          byte "OK",13,10,0
    READY       byte "ready",13,10,0
    nochange    byte "no change", 13,10,0
    
    
    ' Simple Commands
    AT          byte "AT",0            ' Check whether the module is there or not
    RST         byte "AT+RST",0        ' Restart the Module
    CWLAP       byte "AT+CWLAP",0      ' List nearby APs
    CWQAP       byte "AT+CWQAP",0      ' Disconnect from the current AP
    CIPSTATUS   byte "AT+CIPSTATUS",0  ' Display current connection status
    CIFSR       byte "AT+CIFSR", 0     ' Display the IP address
    
    
    ' Complex Commands
    CWMODE      byte "AT+CWMODE=",0    ' Set the Wifi mode
    CWJAP       byte "AT+CWJAP=",0     ' Join the AP
    CWSAP       byte "AT+CWSAP=",0     ' Set Parameters of AP (Not usually necessary)
    CIPMUX      byte "AT+CIPMUX=",0    ' Setup Single or Multiple Connections
    CIPSTART    byte "AT+CIPSTART=",0  ' Setup TCP or UDP Connection                       1)single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port>
    CIPSEND     byte "AT+CIPSEND=",0   ' Send data on TCP or UDP Connection                1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>
    CIPCLOSE    byte "AT+CIPCLOSE=",0  ' Close the specified connection                    AT+CIPCLOSE=<id> or AT+CIPCLOSE
    CIPSERVER   byte "AT+CIPSERVER=",0 ' Setup a listening server of the specified port    AT+ CIPSERVER= <mode>[,<port> ]
    
    
    
  • localrogerlocalroger Posts: 3,451
    edited 2014-11-07 12:42
    Got mine a few days ago and have got one blowing the Propeller CNT out to a server via UDP twice a second. Oddly, mine (from flyfun via Amazon) communicate at 9600 baud. Got one working first with a PropPlug and serial program manually typing the commands to determine the baud rate and list the available networks, then moved to a Propeller to issue the commands to set up the IP and port and send data.
  • Mag748Mag748 Posts: 263
    edited 2014-11-07 12:46
    localroger wrote: »
    Got mine a few days ago and have got one blowing the Propeller CNT out to a server via UDP twice a second. Oddly, mine (from flyfun via Amazon) communicate at 9600 baud. Got one working first with a PropPlug and serial program manually typing the commands to determine the baud rate and list the available networks, then moved to a Propeller to issue the commands to set up the IP and port and send data.


    Hey localroger,

    Can you share your method for sending UDP packets? I would find that rather useful.

    Thanks,
    Marcus
  • Cluso99Cluso99 Posts: 18,066
    edited 2014-11-07 13:02
    Nice going ProcessingData & localroger.
    What connections other than TXD, RXD, 3v3 and GND did you use? ie were connections to RST and/or CH_PD required?
    Is TXD an input on the ESP8266 board? ie it is the data to be sent over wifi (or the data received and sent to the prop/etc)

    Must get this going ;)
  • Mag748Mag748 Posts: 263
    edited 2014-11-07 15:05
    On the unit I have I'm using the CH_PD pin to power up the module (High to enable), and the GPIO0 pin to enable reprogramming of the firmware (Low to enable programming).

    UTXD is the output to the Prop, URXD is the input from the Prop.

    There is currently no "transparent" mode with these modules. I'm making progress with a high level object to get the basic functionality available on the Prop, but it's been a very difficult process. The communications protocol implemented in the module is very kludgy from a programmatic view. It seems to be mainly designed for a human user. And there is no "API" that I know of

    Currently I'm having an issue connecting to an AP. Sometimes it will succeed with an "OK", other times it will fail with a "FAIL", and still other times it will just restart itself in the process.

    I am not seeing this unit as a viable solution to any reliable non-trivial wireless network system.

    Thanks,
    Marcus
  • localrogerlocalroger Posts: 3,451
    edited 2014-11-07 16:28
    Hey Marcus, turns out it's very simple. You just specify "UDP" instead of "TCP" in the start command, then send the send command with xxSEND=## where ## is the number of characters, and then send the characters to bulild the packet. When the module gets the last character, it sends. When it receives a packet you get a spontaneous message announcing it with its contents without being asked.

    I'll post more details Monday, as I left it all at work a couple of hours ago. I'm knocking together some functions to sensibly deal with the echo and manage return messages and I'll put that up too.

    For hookup, I just have CH_PD jumped to 3v3 other than TX, RX, 3v3, and GND. TXD on the ESP8266 is transmit FROM The ESP8266 to RX on another device. It's very easy to set up with a PropPlug since the plug is so well labeled.

    P.S. Marcus, where did you get your modules? My 9600 baud units have been extremely reliable; I've set two of them up and never had a failed message or network connect. UDP even recovers gracefully when the router is power cycled. (I suspect UDP might be more reliable than TCP for a lot of reasons, which is why I use it.)
Sign In or Register to comment.