It's been a while since we played around with our wifi modules but in recent months we've been inundated with Arduino projects in the real world; the latest involves running an AVR off a lipo battery (actually, it's a li-ion but you get the idea) to interface with an ESP8266 wifi module.
So far so good.
Except our Arduino Pro Mini modules are set up to run at 8Mhz from a 3.3V supply (an atmega328 is not guaranteed to be stable at above somewhere around 12Mhz on a 3.3V supply). And with the internal oscillator at 8Mhz on an AVR, the error rate is far too high for a 115,200bps baud rate.
Which means either
a) change the baud rate on the ESP8266 or
b) change the controller to one that can run faster at lower voltages
Obviously a faster mcu running off a battery will drain it more quickly, so we're looking to reduce the baud rate if possible. Except our ESP8266 modules are running some pretty old firmware - and they don't support changing the baud rate.
The datasheet says we should be able to issue the AT+CIOBAUD command to query/set the baud rate. Each time we tried this (and even tried AT+CIPBAUD in case it was a typo!) the result was ERROR.
It looked like we were stuck with 115200bps.
But after a bit of digging around on the intertubes, we found this website: http://www.xess.com/blog/esp8266-reflash/
And it talks through re-flashing the firmware on the wifi modules using a nice easy-to-use Windows interface (rather than the nasty run-it-and-hope Python scripts a lot of other sites recommend). It basically involves running the ESP8266Flasher.exe and downloading the v0.9.2.2.ATFirmware.bin - both of which we've bundled up and put here.
Firstly, wire up the module with the GPIO1 line pulled to ground (normally we leave this line floating). Then start the executable
Select the .bin file (we're using version 0.9.2.2 but other versions may be available on the interweb)
Hit the "download" button. It takes about 2-3 minutes (for ever in computer time) to re-flash the wifi module. Booting up, however, returned nothing but garbage
Normally the ESP8266 spits out some gobbledegook when it boots up. But that's because the boot-up log is always spit out at 74880bps before the module returns to the baud rate set by the AT+CIOBAUD command.
But we expected at least some kind of "OK" or "ready" message. Instead we got nothing. Trying to enter AT commands resulted in more garbage. So out of curiosity, we set out serial monitor baud rate to 9600 and tried again. This time, the response was much more meaningful. Not only could we see that we were running newer firmware, but we also received valid responses from the AT+CIOBAUD? command
As it turns out, this new firmware defaults to 9600bps, which is what we were looking for. So there's no need for us to update the baud rate, once the firmware has updated. And - more importantly - we're able now to communicate with the wifi modules using an Arduino running at 8Mhz of it's own internal oscillator, powered by a lipo battery.
It's only a small victory. But a success all the same!