Sodaq Autonomo and WifiBee

I’ve tried the http get example from the Sodaq_WifiBee library and when I call wifiBee.isAlive() it returns false. Does this mean I’m not connected to a wifi network?

There is also an isOn function but that is private. I tried the on function and I see a message Power ON in the serial monitor. Does this mean the device is on and functioning?

The WifiBee is designed to stay powered off when not in use.

The HTTPGet() method will switch on the device, connect to the network, open the TCP connection, send and receive the data before closing the connections and powering down.

If you call isAlive() it will normally return false as in most cases the device is switched off.
You can also call on() which will leave the device powered on until you call off().

I’m getting: Failed to connect: Timeout

I’m trying to connect to the public wifi network from Ziggo. Unfortunately, I don’t have a private network to test with at the moment. Is this supported by the WifiBee?

It should be able to connect to almost any network.

Can you just double check that you have configured the SSID and password correctly in the sketch.

Also if you could post the Serial Monitor output, that would be helpful.

I double checked the details. I also put a username but that didn’t help.

With the original example from the library I don’t get any output. For some reason I don’t see output printed from the setup function.

I renamed Serial to SerialUSB as in the tph example and then I get the output below if I put the code in the loop.

Failed to connect: Timeout

Device Type: WifiBee

HTTP GET from http://httpbin.org/get

Power ON
Failed to connect: Timeout

I

Yeah, sorry I need to create a separate set of examples for the Autonomo.

I’ll work on that tomorrow.

I have added Autonomo specific examples.

There were two main differences, the Serial -> SerialUSB change, and also the initialisation and switching is different on the Autonomo due to the switchable BEE_VCC.

The repository can be found here: https://github.com/GabrielNotman/Sodaq_WifiBee

Let me know how you get on.

This is the output I get now:

Device Type: WifiBee

HTTP GET from http://httpbin.org/get

Power ON
¤¨yåXü:$jtÊ–:>¾b8-þh:6¾c\¬üh#ïXFailed to connect: Timeout

The strange characters are extra but I do see output now from the setup function.

Adding some extra delays I now see this output:

Device Type: WifiBee

HTTP GET from http://httpbin.org/get

Power ON
l:ý|Yø¤_ðƒh#6¾¦¢x#/¯øjøh:öXð
Restore init data.

NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
lua: cannot open init.lua

wifi.setmode(wifi.STATION)
wifi.sta.config(“Ziggo”,“Password”)
wifi.sta.connect()
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
print("|" … “STS|” … wifi.sta.status() … “|”)
|STS|1|
Failed to connect: Timeout

I searched for this error and saw that a file is missing, I did flip the switch on the wifibee once when it wasn’t working but after that I put the switch back into its original position, Is this ok?

I’m not sure what you mean by a missing file?

You should be ok to put the module into flash/program mode, although I probably wouldn’t do this while it is on.
You should leave it in the run/work position unless you are updating the firmware on the WifiBee module.

Those odd characters at the start up are normal. Also you can ignore the “lua: cannot open init.lua” message.

That list of |STS|1| responses are correct. However, it is timing out trying to connect to the network (code 1 = connecting). This is usually the result of incorrect AP name or password. The current timeout is set at 10 seconds, if you do need more time you can adjust WIFI_CONNECT_TIMEOUT in Sodaq_WifiBee.cpp (line 57). Value is set in milliseconds.

init.lua is the missing file. It probably doesn’t work because I try to connect to a public network. When I have a home wifi network available I will try the code again. Thanks for updating the examples. The SSID and password were correct, I checked them against the mijn Ziggo site.

It seems that WPA2-Enterprise is required for joining the Ziggo networks.

This authentication does not seem to be supported by the module:

Actually, at the end of this thread it says it is now supported (14/12/15).
http://www.esp8266.com/viewtopic.php?f=6&t=1243

A colleague suggested to use my phone as a hotspot so I tried that. When I select WPA2-PSK I get the same time out. I also increased the time out in the code but this didn’t help.

I also had the option to provide open access with no password, when I did this the example ran correctly and I got the response. I don’t know why the WPA2 is failing for me.

Hi Alan,

I checked what encryption my home router is using, it is set to WPA2-PSK.
As I haven’t run into this issue, I’m not exactly sure what could be causing it.

We could try updating/reflashing the module.
There is a tool for this available here:

If you have a USARTBee, the process will be quite straight forward.
Put the switch in program position, connect it via USB and then use the
provided tool. You will also need to jump the DTR pin to ground, as this
needs to be low for the module to switch on.

If you don’t have USARTBee, I believe it should be possible to do the
same process via a pass through sketch. I can help you with that sketch,
just let me know if you need it.

I don’t have a USARTBee nor much experience with Arduino but I would like to try to upgrade the firmware to see if that helps.

Here is a sketch that will work for updating the WifiBee firmware using an Autonomo:

void setup() 
{
  // Turn on BEE_VCC
  pinMode(BEE_VCC, OUTPUT);
  digitalWrite(BEE_VCC, HIGH);

  // Turn on the WifiBee
  pinMode(BEEDTR, OUTPUT);
  digitalWrite(BEEDTR, LOW);

  // SerialUSB is running at 115200

  // Start Bee UART
  Serial1.begin(115200);
}

void loop() 
{
  // Pass through one byte at a time
  if (SerialUSB.available()) {
    Serial1.write(SerialUSB.read());
  }

  if (Serial1.available()) {
    SerialUSB.write(Serial1.read());
  }
}

In the flasher tool you will need to go to the Advanced tab and set the baudrate to 115200.
(This is the baudrate of the SerialUSB connection).

Also don’t forget to move the switch on the WifiBee to “PROG”.

If you have an Mbili or another one of our boards let me know as the sketch will be slightly different.

I would recommend starting with the firmware build that comes built in with the tool.

I have an Autonomo, let me recap the steps to see if I understand what I need to do.

  1. I upload the sketch to the autonomo

  2. unplug autonomo and move the switch. my switch is currently to the left if looking from the back, so i move that to the right.

  3. plug in the autonomo again

  4. Start flasher tool and set baudrate to 115200

  5. Start the flash proces

Is this correct?

Yes that sequence should work.

You can also put the WifiBee in program mode before uploading the sketch.

On the one I have, looking from the back, right is “program” and left is “run”.

I’ve managed to flash the wifi chip, or at least I got the green check after it was done. However, now I also get a time out when I use no password for my hotspot. I see the blue light on the wifi chip flashing once and then after some time I get the time out message.