Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here


Home Forums Mayfly Data Logger GPRSBee

This topic contains 16 replies, has 5 voices, and was last updated by  Sara Damiano 3 months, 3 weeks ago.

  • Author
  • #12349


    I have very recently purchased a Mayfly, GPRSBee (with SIM800H) and a Hologram sim card. Finding information on how to get the cellular communication working has been a nightmare. I’m sure there is some documentation out there somewhere but I haven’t found what I need: a step-by-step guide for loading/personalizing/testing the configuration. I have gotten some code I found to talk to the GPRSBee but the response to AT+CSQ has only been 0,0. I have been reassured that GSM 2G exists where I live but I don’t really know how to be certain of that. So I’m not sure if my code or personalization or library or antenna or cellular availability is the problem. I think I need a guide that steps me through the process.

  • #12350


    Hi Cal,

    I have been working on a tutorial, but it’s unfortunately nowhere near complete, and I will be away for the next week. I suggest using the Modular Sensors library on GitHub, where there’s an example called logging_to_EnviroDIY. This is formatted to log to data.envirodiy.org, where you can set up a hosting site for free.

    The catch is that it has a lot of library dependencies, which could be difficult to set up depending on your Arduino background.

    Because you are using Hologram, line 106 will be:

    const char *apn = “apn.konekt.io”; // The APN for the gprs connection, unnecessary for WiFi

    The Modular Sensor sketches have a built-in “sensor testing mode”, and when you are in logging mode, watching the serial monitor, the sketch will give you
    the “response code” for your internet connection, which you can look up to see if you have success (201 is the winning response: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes).

    I’m attaching the tutorial text that I have done so far. It’s really in first draft mode, but I hope it can help you.


  • #12352

    Sara Damiano

    The modular sensors library that Beth references depends on TinyGSM for the majority of the cellular connection process. You may want to look at the code and examples in that library for help communicating with the GPRSBee (which is a SIM800 chip).

    Unfortunately, I think if you’re successfully querying for csq and only being a response of 0, that probably means you just don’t have any signal. Having amazing 3G or 4G doesn’t mean there’s any 2G at all. Beth has found some quirks to the sequence of connecting the GPRSBee to that could also cause it to falsely report 0 signal. From the ReadMe for modular sensors:

    Note for GPRSBee modems: To start the modem you will need to power the logger board off, connect the battery to the logger board, and finally attach the modem to the logger board. Then you may power the board and run your sketch. We have found that attaching a GPRSBee modem to power in a different sequence results in the modem reporting zero signal strength. Note, the Mayfly connected to a computer via USB does not supply sufficient power to the GPRSBee. If the community finds this true for other modems, please let us know.

  • #12353


    Thanks for your posts Beth and Sara. The more I look into this, the more I believe that Sara is right; I just don’t have 2G service where I live. I found an old Raven 2G modem, plugged it in and it couldn’t connect either. Even knowing that, I tried to run the script that Beth suggested but couldn’t get it to compile:
    error: ‘class Adafruit_ADS1115’ has no member named ‘readADC_SingleEnded_V’,
    adcVoltage = ads.readADC_SingleEnded_V(_dataPin);
    I think I need to learn PlatformIO and see if it finds better libraries. In the meantime, I’m going to start looking at 3G boards.

  • #12356


    I can feel your pain, Cal. I am going to face the problem of data upload to the the cloud or whatever on some projects that I am contemplating. I have a Mayfly water sensor on my property and the 2G is working fine. Shannon has a small box that does a 2G site survey that we used before installation of SL149

    I think the larger concern will be how to upgrade all the existing Mayfly’s using 2G when that service goes the way of the dot-matrix printer!

    I got some input on this question from some colleagues and in summary 3G and 4G will be overkill in terms of data rate so it would be expensive. The other option might be ORBCOMM which is a low data rate store and forward system which might be more affordable.

  • #12362


    Does anyone know when 3G will be available on the Mayfly?

  • #12363

    Shannon Hicks

    There are 3G and 4G modules that work just fine with the Mayfly. Are you meaning you want instructions on how to do it, or you’re just looking for the hardware?

  • #12366


    Hi @ckillen, The Bee socket on the Mayfly makes it easy for the Mayfly to hook up with any radio with that connection/communication protocol. The socket can be used for several types of radios, including the 2G one that you have, WIFI radios, and the new XBee3 by Digi, that supports LTE-M communication (https://www.digi.com/pdf/ds_xbee3-cellular-lte-m.pdf). @w3asa, have you looked into this LTE-M radio? I think it will work with my existing hologram.io SIM plans and data rates.

    I think the XBee3 is the route to use if you are no longer covered by 2G. My understanding is that T-Mobile is keeping their 2G coverage until ~2020, but if you don’t have their coverage, it’s not going to expand to cover you in the next couple of years. Here’s a 2G coverage map: https://orion.freeus.com/coverage-map.aspx.

    I’ll keep plugging away on the instructional for logging to data.envirodiy, but it will probably be after September 10… because I have two proposal deadlines before then!


    P.S. @ckillen Are you using a sensor with the ADS1115 chip? This is an analog to digital converter that shows up in ~3 sensors in the logging to envirodiy sketch. If not, your error message sounds like you need to “turn it off” by commenting those sensors out. I use “Command-/” after text is selected on my Mac. I suspect PC has a similar keyboard shortcut.

  • #12370


    Thanks Beth and Shannon, I’m finally getting a chance to get back to this.

    I’m NOT using any sensor with the ADS115 chip so I’ll go back to my 2G setup and comment out those lines of code. I’ll get back to you on my success/failure eventually.

    The Digi XBee3™ Cellular Smart Modem, LTE-M seems to be what I want in the long run. I just ordered one today. I’d gladly accept any information anyone has on setup, configuration, example sketches, etc.

    I have to hurry with this project now since it’s quickly getting cold in the far north. I want to get this deployed before the ice/snow comes.

  • #12376


    I just received the Digi Xbee3 that I ordered a week ago. Now I need a little help with a sketch to get me started. I tried using the code that Beth suggested (Logging_to_EnviroDIY.ino) but never got it to compile. Does anyone have a simple bring-up sketch for this module? You can contact me externally at ckillen@charter.net.

  • #12377

    Sara Damiano

    Which ADS1115 library are you using? Make sure you’re using the soligen2010 fork at https://github.com/soligen2010/Adafruit_ADS1X15/ – Don’t use the Adafruit original.

  • #12380


    OK – I’ve cleaned up my library problems as suggested. I’ve paired down the logging_to_EnviroDIY.ino to the bare minimum to check out the modem. I also turned on some debugging and I think I fixed a bug in the code that made it think it was connecting to a WiFi network. I know I got on the cellular network because it showed as active on Hologram.io but would not connect. I suspect I have a SIM card problem now. I’ll be contacting Hologram for help and a new SIM card (this one was borrowed from another modem I have). Thanks for all your help.

  • #12381

    Sara Damiano

    What was the bug you found?

  • #12387


    I ordered some parts and I’m back working on this. I have 4 each of Mayfly’s (v0.5b), Hologram SIMs, and XBee3’s (XB3-C-A2-UT-001). I’ve had a little trouble getting the library straight and I intend to learn and install PlatformIO, but for now I’m working on regular Arduino platform. I’m running Sara’s “logging_to_EnviroDIY” … I don’t know if it’s the latest version.

    Oh, the “bug” I reported last post wasn’t really a bug, but a choice between Cell and Wi-Fi in that code. I switched the commented line with the uncommented line:
    #elif defined(TINY_GSM_MODEM_XBEE)
    //modem.setupModem(&ModemSerial, modemVCCPin, modemStatusPin, modemSleepRqPin, ModemSleepMode, wifiId, wifiPwd);
    modem.setupModem(&ModemSerial, modemVCCPin, modemStatusPin, modemSleepRqPin, ModemSleepMode, apn);

    I’ve had some luck getting a BEE to attempt to connect to the network, because the Hologram website reports:

    {“linkid”:439623,”record_id”:385223430,”session_begin”:”2018-09-16 14:14:40″,”timestamp”:”2018-09-16 14:15:39″,”bytes”:0,”imei”:”35275xxxxxxxxxx”,”cellid”:4864,”lac”:20502,”network_name”:”AT&T Mobility”}

    However, the modem never connects. I added some more time and some AT commands to TinyGsmClientXBee getRegistrationStatus() to make sure the modem is ON and responding. I get some response to these commands, but I only get “22” response for status. The output:

    sending S# to get SIM num
    [16873422] <<< 894450030xxxxxxxxxx

    sending IM to get IMEI
    [16873504] <<< 35275xxxxxxxxxx

    sending OA to get APN
    [16873570] <<< ERROR

    sending MN to get operator
    [16873625] <<< OK

    sending DB to get signal strength
    [16873678] <<< OK

    sending AI to get status
    [16873732] <<< 22

    My cell strength (4G) is good here so I don’t think that’s the problem. I’ve tried different antennae too. I’m ready, willing and able to insert some debug code to find out what’s wrong if anybody has some ideas. Thanks for your help in advance.

  • #12390


    Hi Cal, there’s a thread on GitHub about getting this thing up and running. Looks like others are having trouble as well. Perhaps contributing your debugging will help things along.


  • #12414


    I’ve cut the trace at SJ13 and made the solder bridge to directly connect the LIPO battery to the modem. Now the LTE-M XBee doesn’t reply to anything – I’m sure it’s not powering on. Am I missing some switch or setting? I’m using some version of logging_to_EnviroDIY.ino.

  • #12488

    Sara Damiano

    Huh.. I don’t know why the XBee would entirely stop responding. Does it still respond on XCTU? Could you have accidentally put it to sleep?

    So far I have not managed to get my LTE-M XBee to connect to the internet with Hologram’s sims. I get denied service every time; sometimes quickly, sometimes after hanging at “22” (searching) for a long time. I’m having the same issue whether it’s on a Mayfly, connected to a PC and talking to XCTU, or connected to a PC and using a terminal with the USB direct access pins at AT commands.

    The same hologram sim works fine in a 3G XBee and my LTE-M XBee can connect to the network just fine when I put in my AT&T sim from my cell phone. But I cannot get the hologram sim to allow connection with my LTE XBee.

You must be logged in to reply to this topic.