Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Wifi Bee AT Firmware and Baud Rates

Home Forums Mayfly Data Logger Wifi Bee AT Firmware and Baud Rates

Viewing 6 reply threads
  • Author
    Posts
    • #19608
      GChafe
      Participant

        Hi, I have a Mayfly 1.1 and a ESP32 WiFi Bee purchased from EnviroDIY recently, also a Hydros21 CTD. Having  lots of trouble getting it to work. Using the EnvirDIY_Monitoring_Kit sketch from https://github.com/EnviroDIY/ModularSensors/commit/f149a372ae47d95d474971abc25dd378bd332ecf. Though I have also tried other ones (possibly older) from EnviroDIY including menu-a-la-carte

        All credentials and UUIDs are correct and in the correct order. I believe I’ve narrowed the issue down to the communication between the Mayfly and the Bee which doesn’t seem to occur. I have tried pass through sketches and do not receive and OK when I enter AT (or anything else), but sometimes, not nearly all the time, some garbled text. So I wonder (and I’m new to this so hopefully reasonable questions):
        1. Are the Wifi Bees from EnviroDIY already flashed with the AT firmware?
        2. If not, how best to do that? I assume I have to do it through the Mayfly. Or perhaps the FTDI rail?
        3. I used the auto-bauding and understand,if I have this correct, that it should find the baud that works, use that to set it to 9600 for the Mayfly, then remove auto-bauding and go straight to 9600 for second and subsequent instances. I haven’t had the auto-bauding work, hence my questions about AT firmware.
        – I’ve done the adjust and now sketches, have the coin cell in  and a charged 3.7 Lipo plugged in as well. It logs to the SD card properly.

        Thanks for any help or suggestions.

      • #19611
        Sara Damiano
        Moderator

          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:

          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.

        • #19612
          Sara Damiano
          Moderator

            Once you’ve successfully changed the WiFi bee’s baud rate, it will stay at the slower baud. You should only have to reset the baud rate if you factory reset the bee or update it’s firmware – neither of which you can do by accident.

          • #19613
            GChafe
            Participant

              Thank you very much Sara. I have tried something like that before (but likely not quite rightly coded). This failed to switch baud rates too unfortunately. I have tried this on 3 out of 4 wifi bees that I have (but just one with you sketch so far) and no luck, that’s how I ended up asking about the firmware.
              Did your sketch in a hurry, so will have another go at it, and on other wifi bees later.
              One question though, in the snippet you provided it has “modemBaud = 9600″ that doesn’t compile with the modemBaud being defined earlier in the sketch. I commented that out and put 9600 inthe UART_Def line as

              <span data-olk-copy-source=”MessageBody”>modem.gsmModem.sendAT(GF(“+UART_DEF=”), 9600, F(“,8,1,0,0”));</span>

              Not sure that’s the right way to handle it. Will report back when I have a bit more time to go through it carefully.

              Thanks

               

            • #19615
              GChafe
              Participant

                I’ve tried some more witht hat code and no luck. So I decided to confrim the AT firmware and I’m not sure if I did or not. Using a USB to TTL I connected directly to the Wifif Bee and used Putty. I did see some text and a brownout warning on the screen. So I used the TTL for RX and TX and I connected a 3.7V Lipo battery to VCC and GND and also the TTL to GND. No brownout warning, but no response at 115200 or any others that I tried (74880, 57600,9600) using the Putty Terminal.  And various other things like more pass-through sketches to talk directly to Wifi Bee on the mayfly, which I don’t know if they should work or not. Get gibberish responses still, but no matter the speed I don’t find any clear text answers from the Bee. Tried all four Wifi Bees that I have and the same.

                Any other hints for what I’m doing wrong?

                The  same mayfly boards work just fine with a Sim7080, so I haven’t damaged them in any way.

                Graham

              • #19617
                Sara Damiano
                Moderator

                  Use 3.3V to power the WiFi bee and make sure that you’re adapter uses 3.3V logic.  The 0.5A most USB ports can provide should be enough for the WiFi bee without browning out.  You are seeing the lights on the bee go on, right?

                  This script worked for me to force the baud rate on three different WiFi Bee’s.  The script forces the baud rate and then factory resets the board and then forces the baud rate again – over and over, just to show it works.  Don’t run it long; you could wear out the bee’s flash if you let it run forever.

                   

                • #19618
                  Sara Damiano
                  Moderator

                    If that doesn’t compile for you, update your TinyGSM library or just delete lines 87-92 to remove the forceModemBaud command, which needs the version of TinyGSM within the last few weeks.

                    It it’s working for you, comment out the section that resets the modem to defaults (lines 107-126) and run it one more time to get the modem to 9600. It should stay at that baud through power cycling.

                Viewing 6 reply threads
                • You must be logged in to reply to this topic.