Cheap WiFi modules


Closed Thread
Results 1 to 40 of 40

Hybrid View

  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,389

    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 03: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,389

    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,389

    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

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521

    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.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389

    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

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

    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

  11. #11
    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?

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807

    Default Re: CHEAP wifi modules, at last!

    Post your code. Guesses cannot help you.

    Ioannis

  13. #13
    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.

  14. #14
    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, 16:45
  2. Replies: 0
    Last Post: - 20th September 2011, 03:31
  3. cheap gsm modules
    By isaac in forum GSM
    Replies: 2
    Last Post: - 15th June 2007, 09:18
  4. supply FSK COB modules and FSK modules
    By Elsa zhang in forum Adverts
    Replies: 0
    Last Post: - 8th August 2006, 06: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