Home › Forums › Mayfly Data Logger › Wifi Bee AT Firmware and Baud Rates › Reply To: Wifi Bee AT Firmware and Baud Rates
The WiFi bee should have the AT firmware on it. The problem probably is the baud rate. The default baud rate for the ESP32 (the brain on the WiFi bee) is 115200. That’s too fast for stable communication with the 8MHz Mayfly. The Mayfly can usually *talk* fairly accurately at 115200, but it can’t listen that fast. The auto-baud function depends on the Mayfly hearing an ‘OK’ to detect the baud rate so it’s iffy at best.
Assuming you’re using the Monitoring Kit sketch as it is currently on the master branch of the repo, try replacing the auto-baud section with a fire-and-forget attempt to change the baud rate.
That is, replace lines 485-505 with something like this:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#ifdef USE_WIFI_BEE /** Start [setup_esp] */ PRINTOUT(F("Attempting to force the ESP32 to switch from 115200 to 9600 baud..")); modemBaud = 9600; for (uint8_t i = 0; i < 10; i++) { modemSerial.begin(115200); delay(50); modem.gsmModem.sendAT(GF("+UART_DEF="), modemBaud, F(",8,1,0,0")); modem.gsmModem.waitResponse(); modemSerial.end(); delay(50); modemSerial.begin(modemBaud); delay(50);if (!modem.gsmModem.testAT()) { PRINTOUT(F("Attempt"), i, F("failed to switch baud rate")); } else { PRINTOUT(F("Attempt"), i, F("successfully switched baud rate")); break; } } modem.modemWake(); // NOTE: This will also set up the modem /** End [setup_esp] */ #endif |
The WiFi bee does not have a built-in FTDI or other TTL-to-USB converter on it, so to flash it or talk to it directly, you have to use a separate adapter of some kind. If you do have an adapter, it’s easy to change the baud rate from your PC. Connect the bee’s TX, RX, power (3.3V!), and ground to your adapter and that to your PC. Set your terminal to 115200, check that you can get an “ok” back from an “AT” and then send the command AT+UART_DEF=9600,8,1,0,0. After you get an ‘OK’ back from that, stop your terminal, restart it at 9600 and make sure you can get an ‘OK’ after an ‘AT’ at that baud rate.
If you can’t get the modem to respond to anything, it’s possible there is something wrong with your firmware. The easiest way to flash is using espressif’s Flash Download Tool and the ESP32-WROOM-32 AT firmware binary. The programming UART uses bee pins 18/17 as TX/RX and you need to hold bee pin 9 (ESP32 IO0) low as you apply power to get the ESP into ‘download’ mode where it can accept new firmware . You can’t flash the bee through the Mayfly, you need a direct connection to your computer.
Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of