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

XBee and Hologram LTE: issues connecting to internet

Home Forums Mayfly Data Logger XBee and Hologram LTE: issues connecting to internet

Viewing 25 reply threads
  • Author
    Posts
    • #14352
      Letsid
      Participant

        I am unable to connect to the internet (and therefore monitor my watershed).  After reading some other posts, it seems that I am not alone.  However, I am still having problems even after reading some of the tips.  Here are links to the forums that I have read:

        1. https://www.envirodiy.org/topic/xbee-r410m-cant-connect/
        2. https://www.envirodiy.org/topic/connecting-xbee3-lte-to-the-internet/
        3. https://www.envirodiy.org/topic/difficulty-connecting-to-mmw-with-lte-adapter/

        My unit hardware is (photos attached):

        My code is from the mmw example: https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_MMW

         

        Upon building the code to the Mayfly, it begins to set up the sensors and the RSSI light stays on for what seems like the full two minutes.  It then turns off and the device alerts me that it “could not connect to internet for clock sync” and is “putting modem to sleep”.

         

        I realize this is the same problem as posted in the second forum, linked to above.  In that post, it is recommended to change the allowable connection time — “by changing the time in line 302 ‘if (modem.connectInternet(120000L))’.” I scanned the code in the mmw sketch and cannot find this command.  Has the sketch been updated since that forum post?

         

        Another tip, mentioned in the 3rd post linked above, was using “DigiXBeeLTEBypass”.  I tried this and the result was the same.

         

        Advice?

      • #14356
        Sara Damiano
        Moderator

          Woops, yes, the example has changed since then.  Sorry about that.

          And, yes, you’re definitely not alone.  I think issues with LTE connections are the top forum topic here.  The LTE XBee3’s are so much trouble.  I wish I could find something better.

          From your pictures, your hardware connections look right.  🙂

          As you’ve read, the first connection can take near forever.  In the last update I simplified the clock sync, but that removed the control over how long to wait.

          I put up a new program for you to try to see if you can get a connection:  https://github.com/EnviroDIY/ModularSensors/blob/master/tools/LTExBee_FirstConnection/LTExBee_FirstConnection.ino  It will set up the XBee, the carrier profile, the APN and then just sit and wait forever for a connection.

           

        • #14359
          Letsid
          Participant

            Thank you for taking the time to put that together!  It worked… sort of.  My SIM successfully connected to the internet!  It took maybe 30 minutes.  My signal quality is listed as -45.

            After successfully connecting, I restart the Mayfly and build in the MMW example.  This code fails to connect and I get the same result as before ( “could not connect to internet for clock sync” and is “putting modem to sleep”).  I then re-try the code you provided above and it takes another 30 minutes or so to connect. And repeat.

            Is there a way to do the ‘wait forever to connect’ strategy within the MMW example?  Is this not an ideal solution?

            P.S. I originally bought three of the Digi XBees.  I have tried two of them, repeating all the steps above.  They are acting the same.

             

          • #14360
            Sara Damiano
            Moderator

              -45?  The nominal RSSI range for the XBee3 is -113 dBm (really bad) to -51 dBm (excellent) so -45 either means your signal is *amazing* or not valid.  I made a small change to that program to continuously print the quality so you can watch it to see if it changes while trying to register.  When running that first connection sketch, are you seeing lots of 22 or 23responses (searching for the network) or are you getting 25‘s (denied)?  Can you copy the output from running for a minute or two and post it?

              Your pictures of your set-up look good.  The battery’s not dead, right?  Try (gently) wiggling the antenna to make sure its secure.

              Are you sure there is AT&T signal available?

            • #14361
              Letsid
              Participant

                The battery I am using is basically straight from the box so I was under the assumption that it was about 50% charged.  I have not had the opportunity to complete the solder on the Voltaic solar panel.  The antenna has been gently wiggled!  I should also note that I did not remove the antenna when testing the second Digi XBee (to avoid unnecessary damage).  So, I have gotten the same result with two different antenna, both with a seemingly secure connection.  I am not certain that there AT&T is available but when it did connect, and came up on my Hologram account, I assumed there was.  Also, I tried connecting to Verizon and had no luck connecting.

                Attached are snapshots of the serial monitor as it moves through trying to connect.  I cut it up because it was pretty long.  I see no 22s, 23s or 25s.  But I do see many zeros.  These changed into -93 for a while and then to -45 and then back to zeros (as you can see in the pictures).  Is this what you were looking for?

                 

              • #14366
                Sara Damiano
                Moderator

                  Woops, sorry, the XBee uses carriage returns instead of new lines so the 22/23/25 isn’t appearing.

                  Add this to your platformio.ini:

                  Your log will suddenly get a lot longer.

                • #14367
                  Sara Damiano
                  Moderator

                    But it seems like you might have kind-of low signal, if that -93 is valid.  Does anyone around have an AT&T cellphone?  Do they have ok signal?

                    Hologram doesn’t work on Verizon.  Sometimes they say the do, and for a while we actually got it to work, but usually it’s only AT&T.

                  • #14368
                    Sara Damiano
                    Moderator

                      You can try adding a network scan before the “waiting for network registration” section.  It won’t help you connect, but it should show what networks have signal.

                       

                    • #14370
                      Letsid
                      Participant

                        Got it!  So this time I left it long enough to connect (or I think it is connecting).  Attached are snips of the monitor.  It repeats for quite a while and then right at the end it changes.  So, pictures 3 & 4 are almost consecutive.

                         

                        I commented back after fixing my ini file and did not reload the page and didn’t see your other comments!  I will try the network scan tomorrow!

                      • #14375
                        Sara Damiano
                        Moderator

                          Wahoo, that’s connected!  *Usually* after you’ve made a few connections it connects more quickly the next time, but signal quality of -81 isn’t stellar, so it might still be somewhat slow.  Are you testing at where you’re going to deploy?  If so, you might want to take some time fiddling with just the right arrangement of the antenna and other wires to maximize your signal – you don’t want other wires to cross the antenna and I think you want a slight curve in the antenna’s cable.  Small movements can make a surprising difference.  If you’re planning to deploy somewhere else, and it’s easy to do so, you might want to run that “first connection” program again at your deployment location to see how long the connection takes.  Hopefully it will be faster.  Concrete office walls do a pretty good job of blocking cellular signals.

                        • #14386
                          Letsid
                          Participant

                            Wanted to send an update: the XBee is now connecting to the internet in a timely manner!  I saved the testing code for my future units.  Thanks again!

                          • #14958
                            James_NZ
                            Participant

                              Hi,

                              I have a similar issue with our Xbee3 LTE.  I have the hardware set up identical to how Letsid has it above. I am using the ‘LTExBee_FirstConnection.ino’ code, with the only amendment being a change of the apn to ‘m2m’ (as required for the Spark network).   The serial output I get from this code (after the initial setup) is: “Signal quality = 0”, over and over.  I left this for an hour and still got the same message.

                              I have a few questions/comments that might get me a step closer:

                              1) Do I need to do anything to the sim before inserting it?  Cellphone sims need to be activated, but the instructions from the NZ IOT provider (Spark) suggested that I should just insert it, turn on the LTE and then ‘test’ it from their developers portal.

                              2) Cell signal is unlikely to be the problem as I am testing this at my house in an urban area.  However, is there a way I can query the LTE to see what signals it can see (rather than connected signal) to determine if the antenna is the problem?

                              3) Spark provides 3G, 4G, 5G and CAT-M1 coverage (Spark NZ network coverage).  CAT-M1 seems to be the most appropriate for this method.  Should I be doing something different to specify that I want to use the CAT-M1 network as opposed to the 3G or 4G?

                              4) I understand network bands need to align with the capability of the Xbee3 LTE.  Spark CAT-M1 operates on Band 28 (700MHz) and Band 3 (1800MHz).  The LTE seems to support bands 1, 2, 3, 4, 5, 8, 12, 13, 17, 18, 19, 20, 25, 26, 28 and 39, therefore I don’t think this is the problem.

                              5) Is there anything else that anyone can think of that might prevent the LTE from working here in New Zealand?

                              6) Would I have more success with a Hologram sim?  These operate on the Vodafone network in NZ, but at least my methods would align with everyone else.

                              5) Another option would be to purchase a developers board and ensure that network connections are addressed in XCTU rather than operating blind on the Mayfly.  Would this help?

                              As always, thanks for your help.

                              Regards,

                              James

                               

                               

                            • #14959
                              James_NZ
                              Participant

                                Just a further update on above.  The IoT provider thinks that the UBlox needs to be told to register.

                                He suggested using the AT commands:

                                AT+CPIN?
                                AT+CREG?
                                AT+COPS=?

                                Am I correct in assuming that the way to do this would be via the code below:

                              • #14960
                                Sara Damiano
                                Moderator
                                  1. If the SIM provider says you don’t have to do anything to activate the SIM, I’d trust them.
                                  2. Yes, the “AS” command in the first run sketch does that. (line ~147)
                                  3. If you’re using an XBee3 LTE-M it *only* supports LTE-M and LTE NB-IoT.  Since your provider doesn’t use NB-IoT, LTE-M will be the only possibility.  That first-run program you’re using sets the bee to use LTE-M preferentially in line 121, which is what you want.
                                  4. This might be your issue.  Yes, the module can use all of those bands, but you would commonly set it up to use a specific carrier profile that will optimize searching to only the bands that carrier uses.  In the example sketch (line 115), the carrier profile is set to 2/AT&T.  Most of AT&T’s traffic is on bands 2, 4, and 12 (https://www.phonearena.com/news/Cheat-sheet-which-4G-LTE-bands-do-AT-T-Verizon-T-Mobile-and-Sprint-use-in-the-USA_id77933). So if you’re setting your module to AT&T, it will not attempt to use band 3 or band 28.  I think you would want to select “1” as your carrier profile here, which will set the module for “SIM ICCID/IMSI select.”  *Hopefully* your SIM and the module will be friendly enough with each other that the module will then switch its mode to that for your SIM.  This doesn’t always work, though.  I know with a Hologram SIMs in the USA the module will attempt to switch to 100/Standard Europe based on the SIM ICCID, which won’t work.  But with a T-Mobile SIM the “SIM ICCID/IMSI select” setting immediately correctly matched to the 5/T-Mobile profile and the connection worked right away.  If just switching the carrier profile to 1 doesn’t work, there are commands to manually try and force the bands.  Start with the profile, though.
                                  5. Well, I generally think getting the development board is a good idea if you want to ever do much with the XBee (like test multiple boards or update firmware) but it shouldn’t be strictly needed.
                                • #14961
                                  Sara Damiano
                                  Moderator

                                    No, I don’t think those command suggestions from your IoT provider will help much.

                                    The CPIN command checks if your SIM is locked by a pin number.  If your SIM provider didn’t mention it and give you the pin number, you shouldn’t need it.

                                    The proper equivalent to theCREG command is already being used in the gsmModem.isNetworkConnected() command on line 155 of the first run sketch.

                                    The COPS=? command is the same as the AS command on line 147.

                                    You don’t see exactly those commands in the code because you’re not talking to the u-blox chip directly; you’re talking to a Digi programmed processor that’s talking to the u-blox chip.  You can issue commands directly to the u-blox chip by switching your XBee3 from Digi recommended “transparent” mode to “bypass” mode.  It might be necessary to do that to adjust the band scanning to exactly match your provider, but hopefully just setting the profile will work.

                                  • #14963
                                    James_NZ
                                    Participant

                                      Thanks for the prompt reply Sara.  You must love these LTE’s by now!

                                      I have had some feedback from Spark who suggest that they have lots of other SARA R410M devices running on the network.

                                      Sara, does the information below mean anything to you?  I figure that I would construct code using “gsmModem.sendAT(GF(“”)) ” to send these configurations to the LTE?

                                       

                                    • #14964
                                      Sara Damiano
                                      Moderator

                                        To use those commands exactly, you need to switch to bypass mode.

                                        But, the proper equivalent of almost all of those commands area already being used anyway, so you don’t need to change much at all.

                                        They are setting the profile to 1 just like I suggested (that’s the UMNOPROF).  Other than making that change, I think the only thing you need to add is setting the bands (at+ubandmask=0,134217732 in their example).  In the first-run sketch, right below setting the network technology (line 123), add the digi equivalent for setting the band mask:

                                        gsmModem.sendAT(GF(“BM134217732”));
                                        gsmModem.waitResponse();

                                      • #14965
                                        James_NZ
                                        Participant

                                          Thanks so much for your help. I will try this tonight when I get home!

                                          Have a wonderful Christmas.

                                          James

                                        • #14966
                                          Sara Damiano
                                          Moderator

                                            The settings for the profile and the band mask should be saved on the module, so you should only need to set it up one time. But, if you’re using ModularSensors, you’ll see that a bunch of the set-up from the first-run sketch is copied in the set-up for the modem in the example sketches. So when using those examples, you’ll either need to delete those extra set-up lines (and use what’s saved on the module) or change the profile to 1 and add the band mask every time. I’d lean toward re-setting it every time rather than hope the module remembered correctly.

                                            Also, yes, I’ve spent enough time fiddling with the LTE and other modules that I knew exactly what all of those commands were right off the top of my head. The Digi command for setting bands was the only one I needed to check. These things are really troublesome.

                                          • #14967
                                            James_NZ
                                            Participant

                                              Sigh, so I thought we had this but I’m getting the same result.  My code is below, as well as the serial output.

                                              Any thoughts?

                                               

                                            • #14968
                                              Sara Damiano
                                              Moderator

                                                Ugh; I thought it would work.  🙁

                                                Two things to try.  First, try running the same thing but change your serial monitor settings to show you more of the output.  If you’re running the Arduino IDE, when you open the serial port monitor, use the drop-down at the bottom to select “Carriage return.”  (See screenshot.)  In PlatformIO, add this to the [mayfly] (or [env]) section of your platformio.ini:

                                                Then rerun the same program and you should see much more extensive output.  It’s not going to fix anything, but it would be interesting to see the output.

                                                 

                                              • #14969
                                                Sara Damiano
                                                Moderator

                                                  And a new program to try to set it up in bypass to see if we can see what’s failing that way.  I’ve also posted this on GitHub here: https://github.com/EnviroDIY/ModularSensors/blob/master/tools/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino

                                                  You should set your end of line back to newline instead of carriage return when running this or you might get a lot of extra blank lines in the printout.

                                                • #14970
                                                  Sara Damiano
                                                  Moderator

                                                    I wish there was some magical way to know why the connection isn’t working or to bribe the thing into working.  Obviously from this forum, and from dozens of issues in the TinyGSM library, a lot of people have trouble figuring out the right settings to get their board to connect.

                                                  • #14973
                                                    James_NZ
                                                    Participant

                                                      Hi Sara,

                                                      Here’s the output from the carriage return code extension:

                                                    • #14974
                                                      James_NZ
                                                      Participant

                                                        And here’s the bypass output. I think this worked! Any idea why, and how I could transfer to my modular sensors code?

                                                        James

                                                      • #14975
                                                        James_NZ
                                                        Participant

                                                          Further update. My modular sensors code is logging to MMW flawlessly. I never thought I would see the day! Obviously something worked with Sara’s bypass code:

                                                          https://github.com/EnviroDIY/ModularSensors/blob/master/tools/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino

                                                          The only other thing I would like to know is how to code the settings into a standard modular sensors code so that my LTE doesn’t forget them.

                                                          Thanks again Sara!

                                                          James (& the rest of the UoW team)

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