Cheap WiFi modules


Closed Thread
Results 1 to 40 of 40
  1. #1
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Cheap WiFi modules

    Some very good information here...

    5$ Arduino WiFi Module!? ESP8266 mini Tutorial/Re…:

    If the link doesn't work , search YouTube for some of the text in the link above
    The video is by "GreatScott!" and it's quite good.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  2. #2
    Join Date
    Oct 2004
    Posts
    448

    Default Re: CHEAP wifi modules, at last!

    A couple of days back, some guys ported a version of LUA (hadnt heard of that before), onto the ESP8266.

    This replaces the stock firmware, and makes things much easier, apparently. Also lets you manipulate/read the ESP8266's own IO bits, enabling the module to be used as a standalone controller for simple tasks.

    http://importhack.wordpress.com/2014...or-web-client/

    Regards,

    Anand

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    getting the module to work smoothly is a bit of a challenge with the device talking duplex . have noticed that the response part that is required to verify action seems to always be preceded by two cr's (ascii 13) as circled in the attachments .
    the latest firmware revision makes things a bit better by slowing to 9600 baud and giving the pic a bit more time to work
    its all good fun
    thanks to henrik for a good starting point
    Attached Images Attached Images     

  4. #4
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Re: CHEAP wifi modules, at last!

    Also, If you are trying to use Putty (terminal program) from your PC and some sort of usb.ftdi serial converter (caution!! 3v3 only) to communicate serially you have to enter CTRL+J to get the thing to take your command.

    If you switch to something like "Termie.exe" it works without the CTRL+J.

    Apparently putty has a problem properly sending either the carrage return or the line feed.

    Also when using the CWJAP command you have to include the quote marks " when you enter your AP credentials.

    I bought one of these off of amazon and it came configured to 9600 baud out of the box.

    NOTE: another way to deal with the 3v3 requirment is to just power your PIC and the ESP module from a single lithium ion battery. No 3v3 to 5v0 converter needed

    Question... how sensitive to over voltage is the 3v3 type devices? If I take my single lithium ion battery off the charger it usually has around 3.8 to 4.0v is that going to be destructive??
    Last edited by Heckler; - 9th December 2014 at 04:33.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  5. #5
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Re: CHEAP wifi modules, at last!

    henrik...

    Thanks so much!! for your example.

    I was able to connect to my ESP module via an FTDI/USB adapter and send the commands you listed in your example from a terminal program (termie.exe) and achieve the same results (after connecting to my device from a browser.

    Now to sharpen up your code and program it into my favorite PIC

    It's good simple examples like yours that can clear up a lot of confusion.

    good stuff!!
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    I guess now I have to learn html ,I think I need a <form or something \form> to get a value from the browser back to the pic .
    any quick tips on how that works ,any simple example would be nice

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    modified henriks html to this
    Code:
     < html>
     <TITLE>PBP ESP8266 demo</TITLE>
     <body>
     <H1>Testing the ESP8266</H1>
     <H3>Cool stuff!</H3> Page visits: 3 
    <inputname="v2"value="2">
     <inputvalue="1"name="v1"type="submit">
     </body>
     </html>
    it displays a input box and a button but the method of actually sending value back to the pic chip eludes me

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    success
    Code:
    < TITLE>PBP ESP8266 demo</TITLE>
     <H1>Testing the ESP8266</H1>
     <H3>Cool stuff!</H3> Page visits:  4
     <formmethod="get"action="set">
     <inputmaxlength="5"value="2" name ="MyInput"size="5">
     <inputvalue="Change MyInput"type="submit">
     </form>

  9. #9
    Join Date
    Feb 2012
    Location
    South Carolina, USA
    Posts
    18

    Default Re: CHEAP wifi modules, at last!

    Here is a link to a few free software programs that some of you may find useful when testing communication. The TCP tool should be helpful for testing getting info between two ESPs.

    https://www.simplecomtools.com/produ...p?idCategory=5

    John

  10. #10
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    tried this
    Code:
    < DOCTYPE htmlPUBLIC"-//W3C//DTD HTML 4.01//EN"  "http://www.w3.org/TR/html4/strict.dtd"> 
    < html><TITLE>PBP ESP8266 demo</TITLE>
     < H1>Testing the ESP8266</H1>
     < H3>Cool stuff!</H3> Page visits:3
     < formmethod="get"action="set">
     < inputmaxlength="5"value="3" name ="MyInput"size="5">
     < inputvalue="Change MyInput"type="submit">
     </ form></html>
    but I have three android devices two lockup the eps8266 instantly,the other (asus transformer) is ok
    I think as a web server these things are just too flaky , any simultaneous requests will cause instant lookup , the onboard wdt seems to ignore this state likewise for a soft reset .
    fyi the ie browser connect/response pkt is upto 324 bytes, and for the transformer 490 bytes ,its not going to be pic friendly this way.

    will try tcp/udp or even telnet next

  11. #11
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516

    Default Re: CHEAP wifi modules, at last!

    Hi Richard,
    I haven't played any more so you're way ahead of me. Copy/pasting your HTML code into a .txt file (renamed to .htm of course) and opening it in IE does not look like anything really usable to me. Of course, I know very little HTML :-(

    Regarding multiple connections, did you set it up to allow that and are you servicing the second connection request or just ignoring it?

    fyi the ie browser connect/response pkt is upto 324 bytes, and for the transformer 490 bytes ,its not going to be pic friendly this way.
    Why? You don't really need to grab the buffer everything in the PIC, you can parse it on the fly as it arrives. With that said, there are plenty of PICs available with RAM to spare, you do need to go to a 28pin 18F device to "max out" though.

    /Henrik.

  12. #12
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    the html code is a copy and paste from "komposer" a free html editor I found on the net , its really just what you did with an input field MyInput added in to a form and levered into your setup .
    it does nothing useful just demonstrates sending data from the browser back to the pic. it works ok

    if have stepped up to a pic18f45k20 so resources aren't an issue yet , biggest problem is if a connection is made while you are serving a page the incoming link request just stops everything dead .
    and if you hit the refresh on the browser before current request (same connection ) is dealt with it all comes to a crashing halt.

    parsing the data on the fly is a bit tricky if you are looking for multiple keys eg in the server loop I am looking for ,"busy" , "OK" and "MyInput" and trying to respond appropriately ,
    I think I need to watch for "'Link", "Unlink" and "Error" too. I found it easier to swallow the lot and then pick the good bits out (a bit crude I admit but I'm looking at proof of concept here)

    I'm not sure about the "channel" thing looking on the salea all link requests are ch 0 so far ,this is probably due to the CIPCLOSE=0 at the end of the served page, but if that's removed the browser locks up .
    I know approx. nothing about http-html and it may stay that way for sanity reasons

  13. #13
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    managed to capture problem on the logic analyser ,I might get this yet


    ps the logicdata.txt file is a salea logic file not text , there's a wish for the forum allow logicdata files
    Attached Images Attached Images  
    Attached Files Attached Files

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    things improve if :-
    1. I serve up the webpage in one continuous string
    2. I control when the rxbuffer actually accumulates data (it auto triggers on a \r ( 0x10) ) , still needs a 350 byte buffer or 500 bytes for some browsers

    the cache toggle signal in this example toggles when a rxbyte is cached and the reply signal when the rxbuff is emptied and parsed for data.

    multiple connections still elude me , I find the behaviour of some browsers is quite baffling ,and they lock up the module upon connection .
    hitting the refresh button while the current page is still coming causes the esp module to reset and start talking at a different baud rate , I can find no cure for this other than a hardware or a power on reset.
    Attached Files Attached Files

  15. #15
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    I think I have a workable multi connection model worked out . it doesn't like a few browsers esp some Linux/android ones at this stage its been done in C
    if anyone is interested PM me and you can get the ip address and have a go (its probably prudent not make it public) and you're welcome to the code too.
    after playing with these things for days I think a multi connection version for pbp is not worth the effort and not necessary for me anyway . I really just want to monitor remote things and maybe tweak a few of their settings on the fly . one connection is amply for most if not all my requirements ,and it will be great just being able to set the time on the solar tracker for daylight savings time changes without having to get on the roof and plug the laptop into the tracker

  16. #16
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    a header like this
    HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nRefresh: yyy\r\nContent-Length: xxx\r\n\r\n
    where yyy = refresh rate in seconds and xxx is the number of bytes in your page (the header not included) is a good thing

    The AT+CIPCLOSE,NN is no required when you do this , although multiconnections are even more problematic a single user connection is more robust

    ps this is a header not a <heading>

  17. #17
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    Had a go at the cloud update ,it failed miserably and therefore i had to reflash device using the gpio0.low method and their flash tool.
    I tried this version from their update site link 'ESP8266_AT_V00180902_04 (0018000902-AI03)_unconfirm version.bin '
    it still reports its version as 0018000902-AI03 but the android devices can now connect without locking the esp8266 up and the stability of the unit is much improved things are looking up

  18. #18
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    a single connection pbp3 version than can turn a led on/off ,report the led state ,and allow a byte var to updated over the web , its fairly robust but not perfect

    had a bit of trouble getting the line extender _ to work with arraywrite so watch out for the looooong lines and its still just proof of concept nothing fancy

    Code:
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 29/11/2014                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :   [pic18f45k20                                                *
    '*          :                                                 *
    '****************************************************************
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRT = OFF
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 18
      CONFIG  WDTEN = ON
      CONFIG  WDTPS = 512
      CONFIG  CCP2MX = PORTC
      CONFIG  PBADEN = OFF
      CONFIG  LPT1OSC = OFF
      CONFIG  HFOFST = ON
      CONFIG  MCLRE = ON
      CONFIG  STVREN = ON
      CONFIG  LVP = OFF
      CONFIG  XINST = OFF
      CONFIG  DEBUG = OFF
      CONFIG  CP0 = OFF
      CONFIG  CP1 = OFF
      CONFIG  CP2 = OFF
      CONFIG  CP3 = OFF
      CONFIG  CPB = OFF
      CONFIG  CPD = OFF
      CONFIG  WRT0 = OFF
      CONFIG  WRT1 = OFF
      CONFIG  WRT2 = OFF
      CONFIG  WRT3 = OFF
      CONFIG  WRTC = OFF
      CONFIG  WRTB = OFF
      CONFIG  WRTD = OFF
      CONFIG  EBTR0 = OFF
      CONFIG  EBTR1 = OFF
      CONFIG  EBTR2 = OFF
      CONFIG  EBTR3 = OFF
      CONFIG  EBTRB = OFF
    #ENDCONFIG
    
    
      define OSC 64
      
       osccon=$70   '64 mhz
       
       trisb.7=0
       trisc.6=0
       trisc.1=0    'rst
       trisd.1=0
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 130 ' 9600 Baud @ 64MHz, -0.02%
    SPBRGH = 6
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    
    
    
    
    
      led var latd.1
    
        
      page var byte[294]      
      head var byte[85]    
      buff var byte[22]
      dummy VAR BYTE[15]
      Hits VAR BYTE 
      tmp var word
      myvar var byte
      ch var byte
     
     ASM       
    content_z          = _head+77    
    ch_z               = _page+76
    hits_z             = _page+100 
    my_z               = _page+151                                                                                                 
    chk_z              = _page+226
    ENDASM   
    page[293]=0
    head[84]=0
    content_z   var byte EXT 
    my_z        var byte EXT 
    hits_z      var byte EXT 
    ch_z        var byte EXT 
    chk_z       var byte EXT 
    PORTb.7=1       'debug out
    OSCTUNE.6=1 
     PORTc.1=1      'rst
     pause 4000 
     Serout2 PORTb.7,84,["ready",13,10]
      
     ARRAYWRITE head,["HTTP/1.1 200 OK",13,10,"Content-Type: text/html",13,10,"Connection: close",13,10,"Content-Length: AAA",13,10,13,10]
     arraywrite page ,["<TITLE>PBP ESP8266 demo</TITLE><H1>Testing the ESP8266</H1><H3>You are ch :-B of 5 </H3>Page visits:CCC<form method=",$22,"post",$22,"><input  maxlength=",$22,"5",$22,"value=",$22,"DDD",$22,"name=",$22,"MyInput",$22," size=",$22,"5",$22,"><br><input type=",$22,"checkbox",$22," name=",$22,"led",$22,"value=",$22,"on",$22,"checked> led<br><input value=",$22,"Change MyInput",$22," type=",$22,"submit",$22,"></form>" ]
     
    
      
    
      tmp=293
      ARRAYWRITE content_z,3,,[dec3 tmp]
      tmp=tmp+84
      hits=0
      myvar=0
      led=0
      
    Main:
        ' Issue a module reset
        HSEROUT["AT+RST", 13, 10]
        ' Module should respond with a bunch of data and finally 'ready'
        HSERIN[WAIT ("ready"), dummy[0]]
    
        HSEROUT["AT+CWMODE=3", 13, 10]
        PAUSE 100
    
        HSEROUT["AT+CWJAP=", 34, "ssid", 34, "," ,34, "password", 34, 13, 10]
        HSERIN[WAIT ("OK"), Dummy[0]]
          PORTc.1=1
    
        
         PORTc.1=0
        ' Allow multiple connections, module should respond with 'OK'
        HSEROUT["AT+CIPMUX=1", 13, 10]
        HSERIN[WAIT ("OK"), Dummy]
        
         pause 50
         PORTc.1=1
        ' Open port 80 (normal port for HTTP), module should respond with 'OK'
        HSEROUT["AT+CIPSERVER=1,80", 13, 10]
         HSERIN  [WAIT ("OK"), Dummy[0]]
        Serout2 PORTb.7,84,["run",13,10] 
     doop:     
       
         PORTc.1=0
        ' Here we need to wait for a client to connect and request data.
        ' When that happens the module will outout the HTTP header on the
        ' UART, we'll trig on the GET keyword.
        HSERIN[WAIT("+IPD"),str Dummy\6]    ;get ch number
        ch_z=dummy[1]
       
        HSERIN 100 , novar,[WAIT("MyInput="),str Dummy\5\10]   'parse input data if any
        Serout2 PORTb.7,84,[#dummy[0],",",#dummy[1],",",#dummy[2],13,10]
        myvar= (dummy[0]-$30)*100 + (dummy[1]-$30)*10 +(dummy[2]-$30)     ' the myvar input  field needs 3 chars  and leading 0's for padding  this could be better done
        if dummy[4]= "l"  then 
        led  =1
        else
        led=0
        endif
     novar:   
        Hits = Hits + 1                ' update web array
        ARRAYWRITE my_z,3,,[dec3 myvar]
        ARRAYWRITE hits_z,3,,[dec3 hits] 
        if led then 
          ARRAYWRITE chk_z,7,,["checked"]
        else
           ARRAYWRITE chk_z,7,,["       "]
         endif
         
         
        ' Prepare to send  bytes
        HSEROUT["AT+CIPSEND=0,",#(tmp+2), 13, 10]          
        HSERIN[WAIT (">"), Dummy[0]]
        ' Send the actual data
        HSEROUT[str head,str page ,13, 10]
      
          HSERIN[WAIT (" OK"), Dummy[0]]
        '
     
    Goto doop

  19. #19
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516

    Default Re: CHEAP wifi modules, at last!

    Richard,
    I haven't had time or motivation (read need) to play more with my modules as I'm currently working on some other stuff but I wanted to really thank you for your continued efforts and for sharing with the rest of us, keep up the good work!

    Thanks!

    /Henrik.

  20. #20
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    some slight improvements and a clean up , got rid of those pesky leading 0's for the data field and a half hearted attempt at multi ch servicing
    I was hoping to get something to fit in a 12f1822 but a 16f1825 is a possibility I might get a IOT yet

    still to do :-
    1. figure out how to detect that the server function on the esp8266 has crashed , it still pings . it reports all the at+xxxx? status requests as good and still alive, but it wont serve web pages
    2. detect when it reboots itself when things go awry
    3. a reboot it when it dies


    Code:
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 29/11/2014                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :   [pic18f45k20                                                *
    '*          :                                                 *
    '****************************************************************
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRT = OFF
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 18
      CONFIG  WDTEN = ON
      CONFIG  WDTPS = 512
      CONFIG  CCP2MX = PORTC
      CONFIG  PBADEN = OFF
      CONFIG  LPT1OSC = OFF
      CONFIG  HFOFST = ON
      CONFIG  MCLRE = ON
      CONFIG  STVREN = ON
      CONFIG  LVP = OFF
      CONFIG  XINST = OFF
      CONFIG  DEBUG = OFF
      CONFIG  CP0 = OFF
      CONFIG  CP1 = OFF
      CONFIG  CP2 = OFF
      CONFIG  CP3 = OFF
      CONFIG  CPB = OFF
      CONFIG  CPD = OFF
      CONFIG  WRT0 = OFF
      CONFIG  WRT1 = OFF
      CONFIG  WRT2 = OFF
      CONFIG  WRT3 = OFF
      CONFIG  WRTC = OFF
      CONFIG  WRTB = OFF
      CONFIG  WRTD = OFF
      CONFIG  EBTR0 = OFF
      CONFIG  EBTR1 = OFF
      CONFIG  EBTR2 = OFF
      CONFIG  EBTR3 = OFF
      CONFIG  EBTRB = OFF
    #ENDCONFIG
    
    
      define OSC 64
      
       osccon=$70   '64 mhz
       
       trisb.7=0
       trisc.6=0
      
       trisd.1=0
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 130 ' 9600 Baud @ 64MHz, -0.02%
    SPBRGH = 6
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    
    
    
    
    
      led var latd.1
    
        
      page var byte[294]      
      head var byte[85]    
      'buff var byte[22]
      dummy VAR BYTE[15]
      Hits VAR BYTE 
      tmp var word
      myvar var byte
      ch var byte
     
     ASM       
    content_z          = _head+77    
    ch_z               = _page+76
    hits_z             = _page+100 
    my_z               = _page+151                                                                                                 
    chk_z              = _page+226
    ENDASM   
    page[293]=0
    head[84]=0
    content_z   var byte EXT 
    my_z        var byte EXT 
    hits_z      var byte EXT 
    ch_z        var byte EXT 
    chk_z       var byte EXT 
    PORTb.7=1       'debug out
    OSCTUNE.6=1 
     
     pause 4000 
     Serout2 PORTb.7,84,["ready",13,10]
      
     ARRAYWRITE head,["HTTP/1.1 200 OK",13,10,"Content-Type: text/html",13,10,"Connection: close",13,10,"Content-Length: AAA",13,10,13,10]
     arraywrite page ,["<TITLE>PBP ESP8266 demo</TITLE><H1>Testing the ESP8266</H1><H3>You are ch :-B of 5 </H3>Page visits:CCC<form method=",$22,"post",$22,"><input  maxlength=",$22,"5",$22,"value=",$22,"DDD",$22,"name=",$22,"MyInput",$22," size=",$22,"5",$22,"><br><input type=",$22,"checkbox",$22," name=",$22,"led",$22,"value=",$22,"on",$22,"checked> led<br><input value=",$22,"Change MyInput",$22," type=",$22,"submit",$22,"></form>" ]
     
    
    ' to test the  ext vars line up ok
    '  Serout2 PORTb.7,84,["content ",str content_z \3  ,13,10]    'AAA
    '  Serout2 PORTb.7,84,["my      ",str my_z \3  ,13,10]        ,DDD
    '  Serout2 PORTb.7,84,["hits    ",str hits_z \3  ,13,10]       'CCC
    '  Serout2 PORTb.7,84,["ch      ",str ch_z \2  ,13,10]        'B
    '  Serout2 PORTb.7,84,["chk     ",str chk_z \7  ,13,10]        'checked
    '  for hits= 0 to 10
    '  Serout2 PORTb.7,84,[#hits,"page z  ",page[282+hits]  ,13,10]
    '  next
    '  for hits= 0 to 10
    '  Serout2 PORTb.7,84,["head z  ",head[73+hits]  ,13,10]
    '  next
      tmp=293
      ARRAYWRITE content_z,3,,[dec3 tmp]
      tmp=tmp+84
      hits=0
      myvar=0
      led=0
      
    Main:
        ' Issue a module reset
        HSEROUT["AT+RST", 13, 10]
        ' Module should respond with a bunch of data and finally 'ready'
        HSERIN[WAIT ("ready"), dummy[0]]
    
        HSEROUT["AT+CWMODE=3", 13, 10]
        PAUSE 100
    
        HSEROUT["AT+CWJAP=", 34, "ssid", 34, "," ,34, "password", 34, 13, 10]
        HSERIN[WAIT ("OK"), Dummy[0]]
          PORTc.1=1
    
        
         
        ' Allow multiple connections, module should respond with 'OK'
        HSEROUT["AT+CIPMUX=1", 13, 10]
        HSERIN[WAIT ("OK"), Dummy]
        
         pause 50
        
        ' Open port 80 (normal port for HTTP), module should respond with 'OK'
        HSEROUT["AT+CIPSERVER=1,80", 13, 10]
         HSERIN  [WAIT ("OK"), Dummy[0]]
        Serout2 PORTb.7,84,["run",13,10] 
     doop:     
       
        
        ' Here we need to wait for a client to connect and request data.
        ' When that happens the module will outout the HTTP header on the
        ' UART, we'll trig on the GET keyword.
        HSERIN[WAIT("+IPD"),str Dummy\6]    ;get ch number
        ch_z=dummy[1]
       
        HSERIN 100 , novar,[WAIT("MyInput="),str Dummy\5\10]   'parse input data if any
        'Serout2 PORTb.7,84,[#dummy[0],",",#dummy[1],",",#dummy[2],13,10]
        myvar= 0
        if (dummy[0]>$2f)&&(dummy[0]<$3a) then myvar= (dummy[0]-$30)
        if (dummy[1]>$2f)&&(dummy[1]<$3a) then myvar= myvar*10 +(dummy[1]-$30) 
        if (dummy[2]>$2f)&&(dummy[2]<$3a) then myvar= myvar*10 +(dummy[2]-$30)                 
        if dummy[4]= "l"  then 
        led  =1
        else
        led=0
        endif
     novar:   
        Hits = Hits + 1                ' update web array
        ARRAYWRITE my_z,3,,["   "]
        ARRAYWRITE my_z,3,,[dec myvar]
        ARRAYWRITE hits_z,3,,[dec3 hits] 
        if led then 
          ARRAYWRITE chk_z,7,,["checked"]
        else
           ARRAYWRITE chk_z,7,,["       "]
         endif
         
         
        ' Prepare to send  bytes
        HSEROUT["AT+CIPSEND=",ch_z,",",#(tmp+2), 13, 10]          
        HSERIN[WAIT (">"), Dummy[0]]
        ' Send the actual data
        HSEROUT[str head,str page ,13, 10]
      
          HSERIN[WAIT (" OK"), Dummy[0]]
        '
     
    Goto doop

  21. #21
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    after playing with Elapsed_INT-18.bas for demon I decided to add it to the esp8266 demo for a bit of time stamping
    also added a hardware rst to the esp module that activates at the slightest hint of trouble (often unnecessarily ), its a bit brutal but I can find no other way
    it also now can report what state it was in before it needs a kick in the ass
    enjoy
    Attached Files Attached Files

  22. #22
    Join Date
    Dec 2010
    Posts
    409

    Default Re: CHEAP wifi modules, at last!

    I've been using an 18f1330 at 32 MHz, but I'm having a lot of trouble with reliable communications at 9600 BAUD. The ESP8266 does not seem to offer slower speed, and I'm losing bytes occasionally. The code is using DT_INTS-18 to try to clear the buffer as fast as possible. Do I really need to move to a device that supports 64 MHz? Is anybody having this thing work reliably at 32 MHz or less?

  23. #23
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default Re: CHEAP wifi modules, at last!

    Post your code. Guesses cannot help you.

    Ioannis

  24. #24
    Join Date
    Dec 2010
    Posts
    409

    Default Re: CHEAP wifi modules, at last!

    Never mind. It's not an issue of speed - it's an issue of RAM. The 18F1330 only has 256 bytes. This is not nearly enough for the array size you need for sufficient buffer depth.
    Digging in the bin for something bigger now.

  25. #25
    Join Date
    Dec 2010
    Posts
    409

    Default Re: CHEAP wifi modules, at last!

    FYI for those of us that remember teletype which required a CR & LF in any order, these devices do not work that way.
    You MUST send CR LF (10,13) in the correct order to work consistently. 10,13 will *sometimes* work, but not always.

  26. #26
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    according to the http://www.electrodragon.com/w/Wi07c web site since firmware 0.92 the terminator is \r\n previously was \n\r.
    \r\n has worked for all my ebay supplied esp2866's but the firmware needed updating for a decent result to be achievable
    ps
    cr=13=\r
    lf=10=\n
    Last edited by richard; - 30th December 2014 at 10:44. Reason: ps

  27. #27
    Join Date
    Mar 2006
    Location
    China
    Posts
    266

    Default Re: CHEAP wifi modules, at last!

    I have what might be a really stupid question.

    Is it possible (and if it is then how) to send serial data from one wifi module to an other when they are both connected to the same wifi router?

    I would like to remove some cables in a rs-485 network and replace then with uart wifi solution. I just dont know where to start.... well I have a wifi router :-) and the modules and lots of PICs and programmers . Does anyone know?

  28. #28
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    Is it possible (and if it is then how) to send serial data from one wifi module to an other when they are both connected to the same wifi router?
    you may not even need a router the esp modules can also act a access point . I have not tried that sort of comms yet but there are examples around on the web using TCP/UDP packets , or you could try TELNET mode . I think telnet is the closest match to what you want

  29. #29
    Join Date
    Mar 2006
    Location
    China
    Posts
    266

    Default Re: CHEAP wifi modules, at last!

    True, but I need to assign an IP to the module and I can not see any AT command for that ... and I really would like to have static IP so each module always had the same number even when the system is re-booted.

    How else do we know who is on the other end of the net?

  30. #30
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    if you do a AT+CIFSR you get two ip addresses the first is the modules ap address the second the dhcp address from your router , question is the first ip address identical on all modules ,maybe they can network that way. " silicon chip" magazine had an article on using these modules as ap's and assigning addresses to other devices using that ap , but I can find no mention of assigning the ap address anywhere . maybe you do need a router , most routers allow permanent address assignments/reservations (usually nested about ten levels deep in some arcane menu structure) .

  31. #31
    Join Date
    Dec 2010
    Posts
    409

    Default Re: CHEAP wifi modules, at last!

    Quote Originally Posted by Charlie View Post
    FYI for those of us that remember teletype which required a CR & LF in any order, these devices do not work that way.
    You MUST send CR LF (10,13) in the correct order to work consistently. 13,10 will *sometimes* work, but not always.
    Nothing worse than discovering a critical typo after the time to edit has expired. I've corrected it in the quote. Bottom line, use 10,13 in that order.

  32. #32
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default Re: CHEAP wifi modules, at last!

    I think this site might be interesting for the IoT:

    https://thingspeak.com/

    After registration you get a free channel for your data to be stored, graphed or used as you want.

    Ioannis

  33. #33
    Join Date
    Oct 2004
    Posts
    448

    Default Re: CHEAP wifi modules, at last!

    True. People have done amazing things with the ESP8266, and uploading to Thingspeak. Also absolves you from having to learn HTML, I guess.

    For those yet to discover these, there have been a slew of development utilities for the ESP8266.

    And, folks have ported LUA (remember CHDK for Canon point-and-shoots?!), a scripting language to the ESP. The benefit being to be able to use the microcontroller on the module directly to store and execute simple programs. And with its own IO, one wouldnt even need a pic for simple applications.

    My favourites are ESPLORER (multi-purpose, works with stock firmware and LUA) and LuaLoader (only for LUA).

    Regards,

    Anand

  34. #34
    Join Date
    Dec 2005
    Posts
    1,073

    Default Re: CHEAP wifi modules, at last!

    These are available from Amazon (some via Prime with free shipping) for about $8. Now, to see if I can talk some dialect of Basic to them.

  35. #35
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637

    Default Re: CHEAP wifi modules, at last!

    I bought 5 of these modules for $13.45 plus $2.25 shipping on ebay. I can't wait to start playing with these modules.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  36. #36
    Join Date
    Oct 2004
    Posts
    448

    Default Re: CHEAP wifi modules, at last!

    Greetings, Dave!

    There is indeed a basic-of-sorts, a scripting language called LUA thats already been ported to the ESP8266.

    Makes things much easier, and other folks have developed IDEs to be able to upload/load LUA files directly on the module.

    In fact LUA is getting so popular, they have a separate sub-form for LUA at www.esp8266.com

    If this generates more interest, I'll post all the LUA related URLs in my record.

    Regards,

    Anand

  37. #37
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: CHEAP wifi modules, at last!

    Quote Originally Posted by richard View Post
    if you do a AT+CIFSR you get two ip addresses the first is the modules ap address the second the dhcp address from your router , question is the first ip address identical on all modules ,maybe they can network that way. " silicon chip" magazine had an article on using these modules as ap's and assigning addresses to other devices using that ap , but I can find no mention of assigning the ap address anywhere . maybe you do need a router , most routers allow permanent address assignments/reservations (usually nested about ten levels deep in some arcane menu structure) .
    Hello Richard ...

    How did you figure out the pending client problem ... For example if a scenario occurs as follows ; First client connects to the server then the second one connects but its +IPD data will be missed while answering to the first client ... So will its channel number ... Do you have a solution for that ? Or perhaps there is an AT command I can't see that helps us to display the numbers of the channel IDs of the incoming and pending client requests ....

  38. #38
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380

    Default Re: CHEAP wifi modules, at last!

    How did you figure out the pending client problem
    I did not get bullet proof solution with the pic chips I have. they lack sufficient ram but work ok for modest requests
    The best solution I have found is to make a queue of ipds to serve
    1. serve up your html/cgi page as one unbroken stream (needs heaps of ram) using int driven hardware serial method , note what ipd you have served and remove from queue
    2. have a large rx buffer big enough for the biggest request form (about 450 bytes from an android device) this must be back ground int driven method too
    3. when not serving , scan rx buffer for new +ipd add to queue
    4. the whole process falls to bits if a requesting device asks for a refresh when a request is already pending for that ipd , this I find will lock the esp8266 up or cause it to reset and then lock up (post#50)

    I have had much better results with an arduino mega2650 , the faster cpu and 8k of ram makes it easier to do things this way and C 's string functions help too

    when I get around to it I will look at tcp/udp methods , its appears to be much more robust
    Last edited by richard; - 5th March 2015 at 12:20. Reason: still can't type

  39. #39
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: CHEAP wifi modules, at last!

    Quote Originally Posted by richard View Post
    I did not get bullet proof solution with the pic chips I have. they lack sufficient ram but work ok for modest requests
    The best solution I have found is to make a queue of ipds to serve
    1. serve up your html/cgi page as one unbroken stream (needs heaps of ram) using int driven hardware serial method , note what ipd you have served and remove from queue
    2. have a large rx buffer big enough for the biggest request form (about 450 bytes from an android device) this must be back ground int driven method too
    3. when not serving , scan rx buffer for new +ipd add to queue
    4. the whole process falls to bits if a requesting device asks for a refresh when a request is already pending for that ipd , this I find will lock the esp8266 up or cause it to reset and then lock up (post#50)

    I have had much better results with an arduino mega2650 , the faster cpu and 8k of ram makes it easier to do things this way and C 's string functions help too

    when I get around to it I will look at tcp/udp methods , its appears to be much more robust
    Very well ... Here is an another strange problem I keep having with my ESP-01 ... When the ESP disconnects from the WIFI of the router It gets hot (around 41 degrees and so on)... Have you ever had such an interesting problem ?

  40. #40
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: CHEAP wifi modules, at last!

    Is there anyone who can communicate with Pushingbox api service using this chip ? I can send datas to thingspeak and update it but since pushingbox is on a shared hosting I know things are different for it .. But how ? Anyone can give an aid ?

Similar Threads

  1. CHEAP wifi modules, at last!
    By ardhuru in forum Ethernet
    Replies: 28
    Last Post: - 27th November 2014, 17:45
  2. Replies: 0
    Last Post: - 20th September 2011, 04:31
  3. cheap gsm modules
    By isaac in forum GSM
    Replies: 2
    Last Post: - 15th June 2007, 10:18
  4. supply FSK COB modules and FSK modules
    By Elsa zhang in forum Adverts
    Replies: 0
    Last Post: - 8th August 2006, 07:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts