Using HUZZAH ESP8266 and Arduino Uno

Hi everybody

I’m currently working with an Arduino Uno, but I need it to have a WiFi and a Bluetooth connection.
So, I bought a Huzzah ESP8266 and I’m trying to connect it to my Arduino.
Here is the problem: when I want to flash some code, I have this message “avrdude: stk500_cmd(): programmer is out of sync” and then on the monitor, I only have some ASCII characters (apparently from 128 to 255 in decimal). I wonder if I should have bought a ESP8266-1 chip instead. I need some help please :slight_smile:

Thanks in advance.

EDIT: I succesfully flashed my code, but I can’t reach any server. Can I use this Huzzah just as a WiFi chip for the Uno ?

P.S: Here’s my code

/*------------------------------------------------------------------------
  Simple ESP8266 test.  Requires SoftwareSerial and an ESP8266 that's been
  flashed with recent 'AT' firmware operating at 9600 baud.  Only tested
  w/Adafruit-programmed modules: https://www.adafruit.com/product/2282
  The ESP8266 is a 3.3V device.  Safe operation with 5V devices (most
  Arduino boards) requires a logic-level shifter for TX and RX signals.
  ------------------------------------------------------------------------*/

#include <Adafruit_ESP8266.h>
#include <SoftwareSerial.h>

#define ARD_RX_ESP_TX   0
#define ARD_TX_ESP_RX   1
#define ESP_RST         4
SoftwareSerial softser(ARD_RX_ESP_TX, ARD_TX_ESP_RX); // Arduino RX = ESP TX, Arduino TX = ESP RX

// Must declare output stream before Adafruit_ESP8266 constructor; can be
// a SoftwareSerial stream, or Serial/Serial1/etc. for UART.
Adafruit_ESP8266 wifi(&softser, &Serial, ESP_RST);
// Must call begin() on the stream(s) before using Adafruit_ESP8266 object.

#define ESP_SSID "XXXXX" // Your network name here
#define ESP_PASS "XXXXX" // Your network password here

#define HOST     "www.adafruit.com"     // Host to contact
#define PAGE     "/testwifi/index.html" // Web page to request
#define PORT     80                     // 80 = HTTP default port

#define LED_PIN  13

void setup() {
  char buffer[50];

  // Flash LED on power-up
  pinMode(LED_PIN, OUTPUT);
  for(uint8_t i=0; i<3; i++) {
    digitalWrite(13, HIGH); delay(50);
    digitalWrite(13, LOW);  delay(100);
  }

  // This might work with other firmware versions (no guarantees)
  // by providing a string to ID the tail end of the boot message:
  
  // comment/replace this if you are using something other than v 0.9.2.4!
  wifi.setBootMarker(F("Version:0.9.2.4]\r\n\r\nready"));

  softser.begin(9600); // Soft serial connection to ESP8266
  Serial.begin(57600); while(!Serial); // UART serial debug

  Serial.println(F("Adafruit ESP8266 Demo"));

  // Test if module is ready
  Serial.print(F("Hard reset..."));
  if(!wifi.hardReset()) {
    Serial.println(F("no response from module."));
    for(;;);
  }
  Serial.println(F("OK."));

  Serial.print(F("Soft reset..."));
  if(!wifi.softReset()) {
    Serial.println(F("no response from module."));
    for(;;);
  }
  Serial.println(F("OK."));

  Serial.print(F("Checking firmware version..."));
  wifi.println(F("AT+GMR"));
  if(wifi.readLine(buffer, sizeof(buffer))) {
    Serial.println(buffer);
    wifi.find(); // Discard the 'OK' that follows
  } else {
    Serial.println(F("error"));
  }

  Serial.print(F("Connecting to WiFi..."));
  if(wifi.connectToAP(F(ESP_SSID), F(ESP_PASS))) {

    // IP addr check isn't part of library yet, but
    // we can manually request and place in a string.
    Serial.print(F("OK\nChecking IP addr..."));
    wifi.println(F("AT+CIFSR"));
    if(wifi.readLine(buffer, sizeof(buffer))) {
      Serial.println(buffer);
      wifi.find(); // Discard the 'OK' that follows

      Serial.print(F("Connecting to host..."));
      if(wifi.connectTCP(F(HOST), PORT)) {
        Serial.print(F("OK\nRequesting page..."));
        if(wifi.requestURL(F(PAGE))) {
          Serial.println("OK\nSearching for string...");
          // Search for a phrase in the open stream.
          // Must be a flash-resident string (F()).
          if(wifi.find(F("working"), true)) {
            Serial.println(F("found!"));
          } else {
            Serial.println(F("not found."));
          }
        } else { // URL request failed
          Serial.println(F("error"));
        }
        wifi.closeTCP();
      } else { // TCP connect failed
        Serial.println(F("D'oh!"));
      }
    } else { // IP addr check failed
      Serial.println(F("error"));
    }
    wifi.closeAP();
  } else { // WiFi connection failed
    Serial.println(F("FAIL"));
  }
}

void loop() {
}

You do realise that the Huzzah ESP8266 comes loaded with the NodeMCU Lua firmware and not the basic ESP8266 AT command firmware with which the ESP-0x modules are loaded, do you not?

Sorry, I should have said that I flashed the binary of the ESP8266 AT command firmware

Hi MaxBit

What have you connected the Arduino and the Huzzah?

What output exactly do you see on serial monitor? For example, do you see the output of this statement?

Serial.println(F("Adafruit ESP8266 Demo"));

Regards

Ray

Hi Hackscribble, thanks for your reply.

I'm sorry, I forgot to show you my output. Here it is:

Adafruit ESP8266 Demo
Hard reset...'
no response from module.

I've changed those 2 define un my code

#define ARD_RX_ESP_TX   2
#define ARD_TX_ESP_RX   3

My Huzzah is connected this way to the Uno: HUZZAH UNO V+ 5V GND GND TX 2 RX 3

I got it working by flashing a firmware to the Huzzah before using it. But I've another problem. I'm trying to do a GET request to parse cloud with a proxy. I always have those messages:

AT+CIPSTART=0,"TCP","104.131.30.204",80

AT+CIPSEND=0,203

> GET /1/classes/Exception/lWZW4PL8Zp HTTP/1.1 
Content-type: application/json 
X-Parse-Application-Id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
X-Parse-REST-API-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

busy s...
SEND OK

@MaxBit, I'm pretty sure the Huzzah is designed to be used with 3.3 V only, you may have fried it if you connected in to 5V.

colbster: @MaxBit, I'm pretty sure the Huzzah is designed to be used with 3.3 V only, you may have fried it if you connected in to 5V.

Nope.... read here.

Ray

@MaxBit, how did you flash the HUZZAH board to use the AT command firmware?

I have connected HUZZAH board to UNO similar as you suggested - I connected from FTDI end which is breadboard friendly. I'm able to use softserial to communicate with it with LUA running. I like to talk via AT commands though. Did not get much help from Adafruit forums.

BTW, I also use Adafruit BLE UART friend with UNO. I intend to use both at the same time.

MaxBit: Hi everybody

I'm currently working with an Arduino Uno, but I need it to have a WiFi and a Bluetooth connection. So, I bought a Huzzah ESP8266 and I'm trying to connect it to my Arduino. Here is the problem: when I want to flash some code, I have this message "avrdude: stk500_cmd(): programmer is out of sync" and then on the monitor, I only have some ASCII characters (apparently from 128 to 255 in decimal). I wonder if I should have bought a ESP8266-1 chip instead. I need some help please :)

Thanks in advance.

EDIT: I succesfully flashed my code, but I can't reach any server. Can I use this Huzzah just as a WiFi chip for the Uno ?

P.S: Here's my code

@MaxBit, look here: https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide.