2

I'm trying to plug a Wee serial WiFi module on my Arduino Uno, through an XBee shield .

Wee in XBee shield

I'm simply trying to make work the example from the library.

All I get is

setup begin
FW Version:
to station err
Join AP failure
setup end

The code i'm using :

#include <SoftwareSerial.h>
#include <doxygen.h>
#include <ESP8266.h>

SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
ESP8266 wifi(mySerial);

#define SSID "yuflowoffice"
#define PASSWORD "cashless"

void setup(void) {
  Serial.begin(9600);
  mySerial.begin(115200);
  Serial.print("setup begin\r\n");

  Serial.print("FW Version: ");
  Serial.println(wifi.getVersion().c_str());

  if (wifi.setOprToStation()) {
    Serial.print("to station ok\r\n");
  } else {
    Serial.print("to station err\r\n");
  }
  delay(1500);

  if (wifi.joinAP(SSID, PASSWORD)) {
    Serial.print("Join AP success\r\n");
    Serial.print("IP: ");       
    Serial.println(wifi.getLocalIP().c_str());
  } else {
    Serial.print("Join AP failure\r\n");
  }

  Serial.print("setup end\r\n");
}

void loop(void) {
}

What can I do?

2
  • Do any of the examples work? Although I guess none of them will work as the setup() is the same in each, and that is where the problems begin. It seems like no information is being picked up from the Serial port (Tx/Rx), as wifi.getVersion().c_str() results an empty string. Have you taken note of the issues/points listed on the main page, in particular increasing the size of the buffer? – Greenonline Jan 1 '16 at 15:49
  • Also, take a look at Need Help with WiFi Connection. As a sanity check, instead of using the XBee shield and the sketch, try just using the Wee just plugged into an XBee Explorer/Breakout board, and then use a terminal to send it AT commands to see if it responds appropriately. I have recently ordered one of these devices, but it has not yet arrived, so I can't try any tests of my own unfortunately. – Greenonline Jan 1 '16 at 19:03
0
+50

A look at https://github.com/itead/ITEADLIB_Arduino_WeeESP8266/blob/master/ESP8266.h shows that when you pass a SoftwareSerial object to the ESP8266 constructor, a default baud rate of 9600 is also passed to it. Also, the library source file shows that, in the constructor, the begin() method of the SoftwareSerial object you passed (myserial) is called with 9600 baud. Thus, this line in your code:

    mySerial.begin(115200);

is a duplicate, albeit one with a different baud rate, thus rendering the constructor's call of mySerial.begin() useless, since your call comes after the constructor's. If you are certain that 115200 is the right baud rate for the hardware, then you should get rid of the line above and instead pass the baud rate to the constructor like this:

    ESP8266 wifi(mySerial, 115200);

Replace 115200 with any baud rate you discover to be the right one for the AT commands. You also need to uncomment the line in ESP8266.h in your library:

    //#define ESP8266_USE_SOFTWARE_SERIAL

and then save, since you are using SoftwareSerial to communicate with the module.

5
  • Thank you for your reply. I tried your code, with every baud rate available, nothing changed for now. – Gregory Kapustin Jan 5 '16 at 18:09
  • Just to be clear, you got rid of the mySerial.begin() in your code, tried baud rates like i recommended, and uncommented the #define in ESP8266.h and saved it? And your pin connections are like this: ESP8266_TX->Arduino pin 3 ESP8266_RX->Arduino pin 2 ESP8266_CH_PD->3.3V ESP8266_VCC->3.3V ESP8266_GND->GND....you should also get rid of the #include <doxygen.h> – SoreDakeNoKoto Jan 5 '16 at 20:16
  • I also recommend you connect the module directly to the Arduino with jumpers; only the pins indicated above should be connected at all, because other pins may be at a level that affect the module's working (e.g. the FW pin, which switches the module between firmware upload mode and normal mode). Also ensure that the slide switch on the module is set to 'work'. You're powering it using the Arduino 3.3V pin, which can't supply > 50mA, whereas the module can use up to 215mA. Try a different power source, maybe Arduino 5V pin connected to the module through LM1117T to bring it down to 3.3V. – SoreDakeNoKoto Jan 5 '16 at 20:40
  • Level-shifting the SoftwareSerial TX from 5V to 3.3V, using a voltage divider circuit, may also be needed, since its unclear if the module is 5V-tolerant. – SoreDakeNoKoto Jan 5 '16 at 20:43
  • Thank you brianrho. Actually, it was indeed the voltage that blew it up : I think the arduinoxbee shield doesn't make the right wiring for wee serial wifi. So i wired by myself : 3V3 on first pin D3 on second pin D2 on third pin GND to last pin and all worked fine. on 9600 bauds, i have to precise. – Gregory Kapustin Jan 7 '16 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.