Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 25 of 114

Thread: A Guide To Using ESP8266 With TEENSY 3

  1. #1
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307

    A Guide To Using ESP8266 With TEENSY 3

    Work in Progress
    The ESP8266 is a very low cost Wi-Fi connectivity solution.
    It consists of a 802.11 b/g radio and 32 bit microcontroller.
    While one can program the ESP8266 MCU directly, I'm not ready to learn yet another programming environment.
    For me the Teensy 3 is ideal for a host controller and since it is a 3.3 volt device, it is directly compatible.
    I am hoping to pull the information together in one place to save others the frustration I had getting started.

    These images show the pinouts and connections of a commonly available ESP8266 Breakout board.
    Click image for larger version. 

Name:	ESP8266 Pins2.png 
Views:	59736 
Size:	546.9 KB 
ID:	3646 Click image for larger version. 

Name:	ESP8266 Connections.png 
Views:	2115 
Size:	34.4 KB 
ID:	3602

    Using the Hardware serial port on the Teensy and USB serial port
    ESP TX -> Teensy Pin0
    ESP RX -> Teensy Pin1

    The ESP8266 can be accessed directly from a PC using the following code:
    Code:
    //**** Using a Teensy 3.1 to Connect an ESP8266 to PC USB Serial *******
    //     Compiled with Arduino 1.60 and Teensyduino 1.21b6
    //     ESP8266 Firmware: AT21SDK95-2015-01-24.bin
    
    
    long LED_14_TimeOn=0;
    long LED_15_TimeOn=0;
    
    void setup() {
      
          pinMode(14, OUTPUT);  // YELLOW LED - SENDING
          pinMode(15, OUTPUT);  // RED LED - RECEIVING
    
        // Setup computer to Teensy serial
        Serial.begin(115200);
    
        // Setup Teensy to ESP8266 serial
        // Use baud rate 115200 during firmware update
        Serial1.begin(115200);
    
    }
    
    void loop() {
    
        // Send bytes from ESP8266 -> Teensy to Computer
        if ( Serial1.available() ) {
             digitalWriteFast(14, HIGH);   // set the LED on
             LED_14_TimeOn = millis();
            Serial.write( Serial1.read() );
        }
    
        // Send bytes from Computer -> Teensy back to ESP8266
        if ( Serial.available() ) {
            digitalWriteFast(15, HIGH);   // set the LED on
            LED_15_TimeOn = millis();
            Serial1.write( Serial.read() );
        }
    
        if (millis() - LED_14_TimeOn > 20) {
    	digitalWriteFast(14, LOW);   // set the LED off
    	}
        if (millis() - LED_15_TimeOn > 20) {
    	digitalWriteFast(15, LOW);   // set the LED off
    	}
    
    }
    Sample output:
    Code:
    AT+GMR
    AT version:0.21.0.0
    SDK version:0.9.5
    OK
    
    AT+CWJAP?
    +CWJAP:"NetworkG"
    OK
    
    AT+CIFSR
    +CIFSR:APIP,"192.168.4.1"
    +CIFSR:APMAC,"1a:fe:34:9f:48:d8"
    +CIFSR:STAIP,"192.168.1.50"
    +CIFSR:STAMAC,"18:fe:34:9f:48:d8"
    OK
    
    AT+CWLAP
    +CWLAP:(4,"HOME-A2B2",-91,"00:1d:d5:bc:a2:b0",1)
    +CWLAP:(0,"xfinitywifi",-90,"06:1d:d5:bc:a2:b0",1)
    +CWLAP:(2,"COLLEEN",-85,"c8:b3:73:35:c4:63",1)
    +CWLAP:(3,"NetworkG",-31,"e4:f4:c6:05:ba:4a",11)
    +CWLAP:(2,"STEPH",-93,"20:4e:7f:4b:8d:a8",11)
    +CWLAP:(1,"F3GM0",-81,"00:1f:90:e4:bd:55",6)
    +CWLAP:(3,"TEEDA-UP",-82,"6c:b0:ce:7e:9f:20",10)
    OK

    Latest Stable Expressif AT Firmware (at_v0.20_14_11_28): http://bbs.espressif.com/download/file.php?id=84
    Latest Beta Expressif AT Firmware: Download AT21SDK95-2015-01-24.bin
    FirmWare Updater Program: Link to Google drive folder with Updater Zip
    AT command Reference: Download AT Instructions Reference PDF
    ESPlorer - ESP8266 IDE: Link to Esplorer.ru webpage

    Here are some other useful Links:
    http://rancidbacon.com/files/kiwicon...de_v_1.0.4.pdf
    NURDspace ESP8266 Page from the Netherlands:https://nurdspace.nl/ESP8266
    Last edited by Wozzy; 02-26-2015 at 12:16 AM.

  2. #2
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307

    Sample WebServer Program

    This Sample Program allows the Teensy to wirelessly serve a webpage.

    Code:
    /* Based on:
     * ====== ESP8266 Demo ======
     * (Updated Dec 14, 2014)
     * Ray Wang @ Rayshobby LLC
     * http://rayshobby.net/?p=9734
     * ==========================
     *
     * Modified by R. Wozniak
     * Compiled with Arduino 1.60 and Teensyduino 1.21b6
     * ESP8266 Firmware: AT21SDK95-2015-01-24.bin
     *
     * Change SSID and PASS to match your WiFi settings.
     * The IP address is displayed serial upon successful connection.
     */
    
    #define BUFFER_SIZE 1024
    
    #define SSID  "YOUR-SSID"      // change this to match your WiFi SSID
    #define PASS  "your password"  // change this to match your WiFi password
    #define PORT  "15164"           // using port 8080 by default
    
    char buffer[BUFFER_SIZE];
    
    // By default we are looking for OK\r\n
    char OKrn[] = "OK\r\n";
    byte wait_for_esp_response(int timeout, char* term=OKrn) {
      unsigned long t=millis();
      bool found=false;
      int i=0;
      int len=strlen(term);
      // wait for at most timeout milliseconds
      // or if OK\r\n is found
      while(millis()<t+timeout) {
        if(Serial1.available()) {
          buffer[i++]=Serial1.read();
          if(i>=len) {
            if(strncmp(buffer+i-len, term, len)==0) {
              found=true;
              break;
            }
          }
        }
      }
      buffer[i]=0;
      Serial.print(buffer);
      return found;
    }
    
    void setup() {
    
      // assume esp8266 operates at 115200 baud rate
      // change if necessary to match your modules' baud rate
      Serial1.begin(115200);  // Teensy Hardware Serial port 1   (pins 0 and 1)
      Serial.begin(115200);   // Teensy USB Serial Port
      
      delay(5000);
      Serial.println("begin.");  
      setupWiFi();
    
      // print device IP address
      Serial.print("device ip addr: ");
      Serial1.println("AT+CIFSR");
      wait_for_esp_response(1000);
    }
    
    bool read_till_eol() {
      static int i=0;
      if(Serial1.available()) {
        buffer[i++]=Serial1.read();
        if(i==BUFFER_SIZE)  i=0;
        if(i>1 && buffer[i-2]==13 && buffer[i-1]==10) {
          buffer[i]=0;
          i=0;
          Serial.print(buffer);
          return true;
        }
      }
      return false;
    }
    
    void loop() {
      int ch_id, packet_len;
      char *pb;  
      if(read_till_eol()) {
        if(strncmp(buffer, "+IPD,", 5)==0) {
          // request: +IPD,ch,len:data
          sscanf(buffer+5, "%d,%d", &ch_id, &packet_len);
          if (packet_len > 0) {
            // read serial until packet_len character received
            // start from :
            pb = buffer+5;
            while(*pb!=':') pb++;
            pb++;
            if (strncmp(pb, "GET /", 5) == 0) {
              wait_for_esp_response(1000);
              Serial.println("-> serve homepage");
              serve_homepage(ch_id);
            }
          }
        }
      }
    }
    
    void serve_homepage(int ch_id) {
      
    String header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nRefresh: 300\r\n";
    
      String content="";
        content += "<!DOCTYPE html>";
        content += "<html>";
        content += "<body>";
        
        content += " <h1> Abraham Lincoln's Gettysburg Address </h1> <br/>  ";
           
        content += "<p> <strong> Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. <br/>";
        content += " <br/>";
        content += "Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. <br/>";
        content += " <br/>";
        content += "But, in a larger sense, we can not dedicate -- we can not consecrate -- we can not hallow -- this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us -- that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -- that we here highly resolve that these dead shall not have died in vain -- that this nation, under God, shall have a new birth of freedom -- and that government of the people, by the people, for the people, shall not perish from the earth. <br/>";
        content += " <br/>";
        content += "Abraham Lincoln <br/>";
        content += "November 19, 1863 </strong> </p> <br/>";
        
        content += " <br/>";
        content += " <p> <font color=#880088> This message brought to you by - TEENSY 3.1 & ESP8266 </font> </p>";
        content += " <p> Teensy server uptime ";
        Serial.print("***************************************** UPTIME = ");
        Serial.println(millis());
        content += "<font color=#0000FF> ";
        content += String(millis());
        content += " milliseconds </font> </p>";
        
          
        content += "</body>";
        content += "</html>";
        content += "<br />\n";       
        content += "\r\n";       
    
      header += "Content-Length:";
      header += (int)(content.length());
      header += "\r\n\r\n";
      Serial1.print("AT+CIPSEND=");
      Serial1.print(ch_id);
      Serial1.print(",");
      Serial1.println(header.length()+content.length());
      if(wait_for_esp_response(2000)) {
       //delay(100);
       Serial1.print(header);
       Serial1.print(content);
      } 
      else {
      Serial1.print("AT+CIPCLOSE=");
      Serial1.println(ch_id);
     }
    }
    
    void setupWiFi() {
    
      // turn on echo
      Serial1.println("ATE1");
      wait_for_esp_response(1000);
      
      // try empty AT command
      //Serial1.println("AT");
      //wait_for_esp_response(1000);
    
      // set mode 1 (client)
      Serial1.println("AT+CWMODE=3");
      wait_for_esp_response(1000); 
     
      // reset WiFi module
      Serial1.print("AT+RST\r\n");
      wait_for_esp_response(1500);
    
       //join AP
      Serial1.print("AT+CWJAP=\"");
      Serial1.print(SSID);
      Serial1.print("\",\"");
      Serial1.print(PASS);
      Serial1.println("\"");
      wait_for_esp_response(5000);
    
      // start server
      Serial1.println("AT+CIPMUX=1");
       wait_for_esp_response(1000);
      
      //Create TCP Server in 
      Serial1.print("AT+CIPSERVER=1,"); // turn on TCP service
      Serial1.println(PORT);
       wait_for_esp_response(1000);
      
      Serial1.println("AT+CIPSTO=30");  
      wait_for_esp_response(1000);
    
      Serial1.println("AT+GMR");
      wait_for_esp_response(1000);
      
      Serial1.println("AT+CWJAP?");
      wait_for_esp_response(1000);
      
      Serial1.println("AT+CIPSTA?");
      wait_for_esp_response(1000);
      
      Serial1.println("AT+CWMODE?");
      wait_for_esp_response(1000);
      
      Serial1.println("AT+CIFSR");
      wait_for_esp_response(5000);
      
      Serial1.println("AT+CWLAP");
      wait_for_esp_response(5000);
      
      Serial.println("---------------*****##### READY TO SERVE #####*****---------------");
      
    }
    Here's a sample of the serial console output:
    Code:
    begin.
    ready
    ATE1
    
    OK
    AT+CWMODE=3
    
    OK
    AT+RST
    
    OK
    AT+CWJAP="XXXXXXXX","************************"
    
    ets Jan  8 2013,rst cause:4, boot mode:(3,7)
    
    wdt reset
    load 0x40100000, len 816, room 16 
    tail 0
    chksum 0x8d
    load 0x3ffe8000, len 788, room 8 
    tail 12
    chksum 0xcf
    ho 0 tail 12 room 4
    load 0x3ffe8314, len 288, room 12 
    tail 4
    chksum 0xcf
    csum 0xcf
    
    2nd boot version : 1.2
      SPI Speed      : 40MHz
      SPI Mode       : QIO
      SPI Flash Size : 4Mbit
    jump to run user1
    
    z
    ready
    AT+CIPMUX=1
    
    OK
    AT+CIPSERVER=1,15164
    
    OK
    AT+CIPSTO=30
    
    
    OK
    AT+GMR
    
    AT version:0.21.0.0
    SDK version:0.9.5
    
    OK
    AT+CWJAP?
    
    +CWJAP:"NetworkG"
    
    OK
    AT+CIPSTA?
    
    +CIPSTA:"192.168.1.50"
    
    OK
    AT+CWMODE?
    
    +CWMODE:3
    
    OK
    AT+CIFSR
    
    +CIFSR:APIP,"192.168.4.1"
    +CIFSR:APMAC,"1a:fe:34:9f:48:d8"
    +CIFSR:STAIP,"192.168.1.50"
    +CIFSR:STAMAC,"18:fe:34:9f:48:d8"
    
    OK
    AT+CWLAP
    
    +CWLAP:(2,"COLLEEN",-97,"c8:b3:73:35:c4:63",1)
    +CWLAP:(4,"HOME-A2B2",-91,"00:1d:d5:bc:a2:b0",1)
    +CWLAP:(0,"xfinitywifi",-88,"06:1d:d5:bc:a2:b0",1)
    +CWLAP:(3,"NetworkG",-28,"e4:f4:c6:05:ba:4a",11)
    +CWLAP:(4,"girlnextdoor",-87,"f8:d1:11:22:82:e2",4)
    +CWLAP:(1,"F3GM0",-91,"00:1f:90:e4:bd:55",6)
    +CWLAP:(3,"TEEDA-UP",-90,"6c:b0:ce:7e:9f:20",10)
    
    OK
    ---------------*****##### READY TO SERVE #####*****---------------
    
    0,CONNECT
    
    +IPD,0,341:GET / HTTP/1.1
    Host: 173.62.187.203:15164
    Connection: keep-alive
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8
    
    1,CONNECT
    -> serve homepage
    ***************************************** UPTIME = 34362
    AT+CIPSEND=0,1959
    
    
    OK
    > HTTP/1.1 200 OK
    Content-Type: text/html
    Connection: close
    Ref0088> This message brought to you by - TEENSY 3.1 & ESP8266 </font> </p> <p> Teensy server uptime <font color=#0000FF> 34362 milliseconds </font> </p></body></html><br />
    
    SEND OK
    0,CLOSED
    
    +IPD,1,281:GET /favicon.ico HTTP/1.1
    Host: 173.62.187.203:15164
    Connection: keep-alive
    Accept: */*
    User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8
    
    -> serve homepage
    ***************************************** UPTIME = 36616
    AT+CIPSEND=1,1959
    
    
    OK
    > HTTP/1.1 200 OK
    Content-Type: text/html
    Connection: close
    Ref0088> This message brought to you by - TEENSY 3.1 & ESP8266 </font> </p> <p> Teensy server uptime <font color=#0000FF> 36616 milliseconds </font> </p></body></html><br />
    
    SEND OK
    1,CLOSED
    0,CONNECT
    1,CONNECT
    
    +IPD,0,367:GET / HTTP/1.1
    Host: 173.62.187.203:15164
    Connection: keep-alive
    Cache-Control: max-age=0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8


    Here's a sample image of the Webpage and the Battery operated Wireless Teensy Server:
    Click image for larger version. 

Name:	ESP8266 WEB1.png 
Views:	1253 
Size:	68.6 KB 
ID:	3607 Click image for larger version. 

Name:	Teensy 3.1 - ESP8266 Wireless Webserver2.jpg 
Views:	1723 
Size:	125.6 KB 
ID:	3609 Click image for larger version. 

Name:	Teensy 3.1 - ESP8266 Wireless Webserver.jpg 
Views:	2230 
Size:	169.9 KB 
ID:	3608

    At least for now you can link directly to the Teensy Webserver yourself: http://173.62.187.203:15164/
    I'm not sure how long my dynamic IP address will last.
    Last edited by Wozzy; 02-23-2015 at 07:12 PM.

  3. #3
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307

    ESP8266 Tips and Tricks

    • 3.3V ONLY for Power and signals
    • On the later Firmware You can change the the Serial BAUD Rate with AT+IPR=115200
    • Use the AT+GMR command to check the current version of the firmware
    • Pin GPIO-00 MUST be held LOW when re-flashing firmware.
    • Pull GPIO-02 and GPIO-00 HIGH with a 4.6K Resistor when not in use (at least this works for me)
    • There are several different Firmware out there. The "official firmware seems to be Espressif
    • You can program the ESP8266 32bit MCU Directly with the IDE available from the Espressif Forum
    Last edited by Wozzy; 02-23-2015 at 12:21 AM.

  4. #4
    Senior Member defragster's Avatar
    Join Date
    Feb 2015
    Posts
    4,808
    Cool. I suppose this would work as well with an NRF24 on spi. Unless you took advantage of the onboard ram and processor

    This message brought to you by - TEENSY 3.1 & ESP8266

    Teensy server uptime 5156835 milliseconds

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    how well does the ESP8266 work? I've read elsewhere that its firmware is rather, er, fragile at this point.

    when comparing 802.11/WiFi to nRF and HopeRF telemetry modules... note that WiFi is a 20MHz (or more) wide signal and most telemetry devices are 0.1MHz or less wide. Much narrower channel bandwidth yields lower data rates of course, but it means the required signal strength is much, much lower, for a usable error rate. Trading bandwidth for range, if you will. And using the sub-GHz radios like the 915MHz band adds more range yet due to the lower frequency, and avoids the competition for air time in 2.4GHz.
    But, using the 802.11 standards does allow use of a standard WiFi router or access point, though at shorter range.
    Last edited by stevech; 02-23-2015 at 02:56 AM.

  6. #6
    Senior Member defragster's Avatar
    Join Date
    Feb 2015
    Posts
    4,808
    Interesting - the two quite unique. I'm starting with the nRF24 - but may want the ESP8266 in the end on the master of my system to make that part best.

  7. #7
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    is it easy to upgrade the firmware? mine is not the latest version and it does not support all the latest commands.

  8. #8
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    Dead easy. Just need a 3v3 ftdi USB cable, the firmware and the upload python script. Check out esp8266.com forum for further info and details of all things esp8266.
    you can even use the teensy as a USB proxy to transfer the firmware by creating a serial pass through, if you don't have a 3v3 ftdi cable.
    Last edited by johnnyfp; 02-23-2015 at 07:02 AM.

  9. #9
    Senior Member jimmayhugh's Avatar
    Join Date
    Nov 2012
    Posts
    168

    Teensy3.x ESP8266 Library

    I found an Arduino Library for the ESP8266 that I modified for use with the Teensy3.x boards, so that you can select the hardware serial port you want to use, as well as serial debug port and a reset pin. It in it's rough early stages, and doesn't have any examples that I'm ready to share yet, but if it's useful, feel free to use and upgrade it. It's located at my github site.

  10. #10
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Quote Originally Posted by doughboy View Post
    is it easy to upgrade the firmware? mine is not the latest version and it does not support all the latest commands.
    I was able to upgrade the firmware by connecting a PC USB through the Teensy, using the serial proxy code in the original post. No FTDI needed.
    The serial communications needs to be set at 115200 BAUD for the Firmware upgrade.
    Once the Teensy and ESP8266 are communicating through the serial port then reset the ESP with the GPIO-00 pin grounded and then run the firmware updater program.
    There's a link to the latest AT Firmware and and the updater program in the first post.

    Mine is currently running AT version:0.21.0.0, SDK version:0.9.5
    Last edited by Wozzy; 02-23-2015 at 11:38 AM.

  11. #11
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Quote Originally Posted by stevech View Post
    how well does the ESP8266 work? I've read elsewhere that its firmware is rather, er, fragile at this point.
    Steve,
    I'm still learning the capabilities,, and must admit that I have a lot to learn about TCP-IP connectivity.
    Also note that I'm only interfacing through AT commands and not programming the ESP8266 firmware directly, but so far my experience is that it's not very robust.
    I'm having to reset the Webserver at least once a day because it's frozen.
    I agree that the one advantage to the ESP8266 module is the ability to connect to existing Wi-Fi infrastructure.
    In my case, I'm connecting through my standard Netlink Wi-Fi Router.

    From a hardware perspective, they seem fairly reliable, as I've reflashed the firmware several times, and after 2 weeks, I haven't even burned one out... for me that's pretty good.
    Last edited by Wozzy; 02-23-2015 at 09:23 PM.

  12. #12
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    Quote Originally Posted by Wozzy View Post
    Once the Teensy and ESP8266 are communicating through the serial port then reset the ESP with the GPIO-00 pin grounded and then run the firmware updater program.
    I tie CH_PD and RST to +3.3v and leave the 2 GPIO pins unconnected on normal use. So to upload firmware, all I need is to tie GPIO-0 to ground, power down and power up the esp module, then exit the arduino program, and run the firmware updater program (selecting the teensy com port), correct?

  13. #13
    Senior Member Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    4,241
    Great guide, i bought some some time ago and played a bit with them, but still had no time...
    I configured the ESP to Baudrate ~ 1MBIT (don't remember the exact value), seemed to work.
    Do you think it is possible to receive an audiostream (mp3) without problems ?

  14. #14
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Quote Originally Posted by doughboy View Post
    ... So to upload firmware, all I need is to tie GPIO-0 to ground, power down and power up the esp module, then exit the arduino program, and run the firmware updater program (selecting the teensy com port), correct?
    The pin wiring you described is correct. Some documentation I've seen states that you need to keep GPIO-02 high when booting, but in my experience it's not necessary.

    It doesn't really matter if the Arduino IDE is running, but you must close the COM serial monitor window.

    You need to keep the Teensy serial port forward program running on the Teensy. This is needed to to allow the firmware updater software to communicate with the ESP8266 via the USB.
    Last edited by Wozzy; 02-23-2015 at 10:23 PM.

  15. #15
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Quote Originally Posted by Frank B View Post
    I configured the ESP to Baudrate ~ 1MBIT
    Frank,
    Wow... 1 MegaBAUD... I considered going higher than 115200 but was afraid of forever losing communications with it.
    Can anyone confirm what the maximum BAUD rate the Teensy and ESP8266 can communicate?

    Also, sorry, but I wouldn't know where to start to decode an audio file that was transferred via TCP-IP.
    Last edited by Wozzy; 02-24-2015 at 12:11 PM.

  16. #16
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    I just updated the firmware, now I can use all the latest commands.

    Question: I can't see clearly from the picture, but it looks like you installed right angle pin headers to the esp8266 module. But I only see one row. Can you post a picture showing how you attached the pin headers? If you use double row right angle pin header, it would not be breadboard friendly, so wondering how you attached the pins. I built a carrier board using a proto board that takes the 2x4 pins from the module then I wired them to 1x8 header.

  17. #17
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    also, in your sample server, the page you return length is under 2048 bytes. Have you tried returning data that is > 2048 bytes and see if everything is received by the browser?

    I read the esp8266 can handle multiple simultaneous connections and uses "id" to tell you which connection it is using. I can't seem to find any info as to what the maximum number of simultaneous connections it can accept. 4 like arduino ethernet and wifi shield?

    I tried refreshing 2 browsers continuously and can see the sample test server program print id of 0 and 1 at times, so I can see that it is able to accept the second connection while the first one is being processed.

    ok, I just read in one of the links id value can be from 0-4, so I suppose that means it can handle 5 simultaneous connections.
    Last edited by doughboy; 02-24-2015 at 12:42 AM.

  18. #18
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Quote Originally Posted by doughboy View Post
    Question:... Can you post a picture showing how you attached the pin headers?.
    Here are a few photos:
    Click image for larger version. 

Name:	20150223_201701-1.jpg 
Views:	234 
Size:	191.9 KB 
ID:	3636 Click image for larger version. 

Name:	20150223_201355-1.jpg 
Views:	355 
Size:	314.4 KB 
ID:	3637 Click image for larger version. 

Name:	20150223_201315-1.jpg 
Views:	231 
Size:	101.7 KB 
ID:	3638

    I desoldered the straight double row headers and soldered on 90 degree headers that were spaced to fit across the centerline of the breadboard.
    Not exactly how they were designed to be used, but it works well for this application.

    Alternatively, the supplied double row straight headers can be inserted into Ardiuno style headers which have had the pins bent to fit across the breadboard centerline.

  19. #19
    Senior Member Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    4,241
    Quote Originally Posted by Wozzy View Post
    Frank,
    Wow... 1 MegaBAUD... I considered going higher than 115200 but was afraid of forever losing communications with it.
    Can anyone confirm what the maximum BAUD rate the Teensy and ESP8266 can communicate?

    Also, sorry, but I wouldn't know where to start to decode an audio file that was transferred via TCP-IP.
    This was with 0.9.2.2 Firmware:
    AT+CIOBAUD?

    AT+CIOBAUD=115200
    AT+CIOBAUD=230400
    AT+CIOBAUD=460800
    AT+CIOBAUD=921600

    Can you please check if AT+CIOBAUD? works with the new Firmware?

    I've a MP3/AAC decoder "in software"...but i still have to add streaming mode. (https://forum.pjrc.com/threads/27059...ghlight=codecs)

    p.s. There's a "bug" on your picture. It's 4 MBit(=512KB) Flash, not 4MBit Ram.
    p.s.s. I think it's compatible with the audioboard, so if one has a defective esp8266 it could be used for the audioboard instead...
    Last edited by Frank B; 02-24-2015 at 04:40 PM.

  20. #20
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Frank,
    I was playing around with higher baudrates today, but was not having much luck with reliability,

    Quote Originally Posted by Frank B View Post
    This was with 0.9.2.2 Firmware:
    Can you please check if AT+CIOBAUD? works with the new Firmware? ...
    I can confirm that AT+CIOBAUD is not accepted in AT Firmware Version: 0.21.0.0 (AT21SDK95-2015-01-24.bin - 520.2 KB)

    There's a "bug" on your picture. It's 4 MBit(=512KB) Flash, not 4MBit Ram..
    Thanks for the tip, I fixed the image in the OP.

  21. #21
    Hi Wozzy, I suspect the Russian(?) firmware you're using isn't an 'official' release. AFAIK the most recent 'official' firmware is to be found on the Espressif website: http://bbs.espressif.com/viewtopic.php?f=5&t=64
    At least this matches the documentation & allows you to change the baudrate.

  22. #22
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    The latest doc from espressif matches the Russian firmware. The AT+CIOBAUD is replaced by AT+UART and doc says baud rate up to 115300*40 whatever that means.

    I find the latest firmware to be fast and stable so far, and response always ends with either OK, ERROR or FAIL, unlike the older firmware I had on the module.

  23. #23
    I'll give it a try! Responses like, 'not changed' and 'no, I like it' were not very helpful!
    I've had a lot of frustration with the early firmware. I set up a very simple server, quite like Wozzy's & it would run for several thousand hits & then crash inexplicably.

  24. #24
    Senior Member
    Join Date
    Oct 2013
    Posts
    110
    I just thought I'd chime in and mention that I'm using a couple of ESP8266's paried with Teensy 3.1's and have had excellent stability out of the NodeMCU firmware. Instead of using AT commands over serial, you send LUA code. What's more, is that you can put some of your functionality into LUA scripts that reside on the flash of the ESP(e.g. let the ESP handle the basics of serving HTTP) while the IO and CPU-intensive stuff runs on the Teensy.

    Food for thought, anyway. NodeMCU seems fairly stable. one of mine has been running w/o a hitch for over a month now... with the Espressif "AT" firmware, it seemed to consistently hang after hours or, at the most, a couple days.

  25. #25
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Ian,
    I updated the original post with links to the latest stable firmware from expressif, as well as the beta version which is available from ESP8266.ru.

    I was able to change the baud rates to much higher rates with the AT+IPR=### command, however It only seemed to work within the session in which it was modified. once rebooted, the chip locked up and needed to be reflashed.

Posting Permissions

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