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

Using Xbee Cellular Modem with ThingSpeak

Home Forums Mayfly Data Logger Using Xbee Cellular Modem with ThingSpeak

Viewing 50 reply threads
  • Author
    Posts
    • #15724
      Zeke Holloman
      Participant
        Hi all! I’m working on developing a water monitoring station using a Mayfly board, an Xbee cellular modem (XBC LTE-M/NB-IoT Global), the LTEBee adapter, a solar panel, and a Hydros-21 sensor. I
      • #15729
        Shannon Hicks
        Moderator
          You shouldn’t have to use XCTU for anything, the modem setup part of the sketch programs the Digi module with whatever settings are necessary, based on what you’re trying to do in the sket
        • #15730
          Zeke Holloman
          Participant
            Hi! Thank you for the quick response. Yeah, I already registered a channel with ThingSpeak, and I’ve put the stuff for that into lines 201-206 (the stuff in the sketch above is just placeholders
          • #15731
            Shannon Hicks
            Moderator
              I haven’t used Thingspeak in a very long time, since we have our own data host at MonitorMyWatershed, so I don’t know the specifics about the connections, but I know a few other EnviroDIY
            • #15732
              Zeke Holloman
              Participant

                Ok! Sounds good; thanks. @neilh20, do you have any experience with ThingSpeak or do you have any advice for this issue?

              • #15733
                neilh20
                Participant
                  Hi @zeke thanks for the qu.  I’ve got the thingspeak working as a POST, but don’t regularly test it. I believe the MQTT is a different route, and I personally haven’t used it.

                  For

                • #15735
                  Rick Vogel
                  Participant
                    You might check your ThingSpeak credentials using a desktop MQTT Client just to ensure everything works outside of your project itself as a first step.

                    https://www.mathworks.com/help/thingspeak/use-d

                  • #15736
                    Rick Vogel
                    Participant

                      In the  XBee DE field, type 75B. MQTT port is 1883 (0x75B).

                    • #15737
                      neilh20
                      Participant
                        Hi @zeke – good check by Rick.

                        Looking at your error, it does say connection error so implies it didn’t even connect to thingspeak.

                        I checked this 5months ago and it worked for me. What

                      • #15738
                        Zeke Holloman
                        Participant
                          Hi there! Thank you @neilh20 and @vogelrnws for all of your help! Yeah, based on what I’m seeing, I don’t think its been connecting at all. I have been checking the channel I’m using
                        • #15739
                          Zeke Holloman
                          Participant

                            Also, I was having trouble finding the stream debugger line (#if defined STREAMDEBUGGER_DBG) you were mentioning earlier in the ModularSensors library. Do you know where that would be located?

                          • #15740
                            neilh20
                            Participant
                              I’ll have to get about streamdebugger as heading out the office, back in 2hrs

                              For debug you should see the following in platformIO.ini – add it to the end. It will force a complete recomp

                            • #15741
                              Zeke Holloman
                              Participant
                                Hey, thanks @neilh20. I added that and uploaded the program and this was the serial monitor output. What does dataPublisherBase refer to?

                                Now running logging_to_thingspeak.ino on Logger logger

                                Using

                              • #15742
                                neilh20
                                Participant
                                  Hi @zeke-holloman – looks like the ThingSpeak keys and channel need to be added.

                                  Add them to (the following are examples)
                                  const char* thingSpeakMQTTKey =
                                  “Z0G6QX4IXEHKG0PK”; // Your

                                • #15744
                                  Zeke Holloman
                                  Participant
                                    Hey @neilh20. Thanks for looking at. Yeah, I already had the keys and the channel ID in the code, I just took them out for the forum. Sorry, I understand that could have been confusing. Other than tha
                                  • #15751
                                    Rick Vogel
                                    Participant
                                      @zeke-holloman

                                      I’m not sure if this pertains to your project or not, but when I was looking through the ThingSpeak documentation and going through my test account it had a place to add a MQTT d

                                    • #15753
                                      Zeke Holloman
                                      Participant
                                        @vogelrnws

                                         

                                        Hi there! Yeah I registered the MQTT device via ThingSpeak. I used the MQTT Explorer you suggested and I was able to post some data to Thingspeak by typing literal values into the

                                      • #15754
                                        neilh20
                                        Participant
                                          @zeke-holloman  a correction on my part, when I looked through the thingspeak API, both the historical and the MQTT method use the POST
                                        • #15755
                                          Zeke Holloman
                                          Participant
                                            Hi @neilh20, thanks for all your help! Yeah, I think I replaced the channel key in the trace with the thingSpeakChannelKey for the forum. I’m looking at the Topic [41] thing and I see the key in
                                          • #15756
                                            neilh20
                                            Participant

                                              @zeke-holloman   interesting, seems like it should work.

                                              When I have strange issues, I delete the .pio/…   and force it to  do a refresh with all the remote libs.  I see you a

                                            • #15757
                                              neilh20
                                              Participant
                                                @zeke-holloman – I have no idea why my previous post came out so badly, and it won’t allow me to edit it!!. My usual way of recovering strange posts.

                                                It should be interesting to see what

                                              • #15759
                                                Zeke Holloman
                                                Participant
                                                  Hi there @neilh20. Thanks for your response, sorry I couldn’t get to it until now. I spent some time on the code, and I tried the code with the 0.28.5 version of the EnviroDIY ModularSensors lib
                                                • #15761
                                                  Zeke Holloman
                                                  Participant

                                                    Hey @neilh20. I just had a thought. The fact that the software works with the Digi WiFi S6B. Do you think that means its an issue with the actual cellular connection as opposed to the code?

                                                  • #15762
                                                    neilh20
                                                    Participant
                                                      hello @zeke-holloman. Just looking through it, and yes thats my assumption at the moment is that its the cellular side that is not connecting.
                                                      There are 2 parts 1) getting internet & time 2) thing
                                                    • #15763
                                                      Rick Vogel
                                                      Participant
                                                        @neilh20 and @zeke-holloman

                                                        Gonna let you all work through this on the mayfly code using the xbee transparent mode. If at some point you would like to use the micro-python option in the xbee I can pr

                                                      • #15764
                                                        Zeke Holloman
                                                        Participant
                                                          Hi there @vogelrnws. Honestly, It’d be awesome if you could send that code. I’m still considering my options on the method to publish the data, but that could be helpful!

                                                           


                                                          @neilh20

                                                        • #15765
                                                          neilh20
                                                          Participant
                                                            Hello @rick-vogel – sounds fascinating & fun to use python in the Xbee.  Though for ModularSensors there are layers of software that allow the physical modem to be abstracted so it could be
                                                          • #15766
                                                            neilh20
                                                            Participant
                                                              @zeke-holloman,  I figured out that the other day I hadn’t changed the apn to the source I was using.

                                                              So with your code, my apn a

                                                            • #15767
                                                              neilh20
                                                              Participant

                                                                https://thingspeak.com/channels/5940 shows a data point at Aug 02 2021 15:17 GMT-0700  Yeah!!

                                                              • #15768
                                                                Rick Vogel
                                                                Participant
                                                                  Here are the python files if you ever decide to look at that option. Please feel free to manipulate however you need to.

                                                                  • Open up the main.py file in a ‘python’ editor and use th
                                                                • #15769
                                                                  Zeke Holloman
                                                                  Participant
                                                                    @vogelrnws Thank you for sending that. I’ll be sure to take a look at it if ThingSpeak doesn’t work.

                                                                     


                                                                    @neilh20
                                                                    I tried running the code with your ModularSensors library, and it sti

                                                                  • #15770
                                                                    Rick Vogel
                                                                    Participant
                                                                      @zeke-holloman

                                                                      Everything I was talking about is MQTT with Thingspeak.  I tested it on my Thingspeak connection I created. It was just allowing the micro-python code in the Xbee to handle all the ne

                                                                    • #15771
                                                                      neilh20
                                                                      Participant
                                                                        @zeke-holloman do you want to send me the thingspeak details on my email neilh20@wLLw.net and I’ll try them in my setting.  I have
                                                                      • #15772
                                                                        Rick Vogel
                                                                        Participant
                                                                          @neilh20

                                                                          I’ll put the files up on a google drive and send a link for a folder to download here in a bit.

                                                                          Yes, micro-python gives you lots of option. We use TLS1.2 encryption of our data, run a

                                                                        • #15776
                                                                          neilh20
                                                                          Participant
                                                                            @vogelrnws  sounds great .. the Teensy 3.5 is a great board and amazing support. If you’ve figured out remote upgrade as well, very no
                                                                          • #15780
                                                                            Zeke Holloman
                                                                            Participant

                                                                              @neilh20 Ok, that sounds good. I just sent the details to your email. Let me know if it still works.

                                                                            • #15781
                                                                              Rick Vogel
                                                                              Participant
                                                                                @neilh

                                                                                Teensy 3.5 topic set up.

                                                                                @Both

                                                                                google drive link for the XBee files if either one of you want them in the future.

                                                                                https://drive.google.com/drive/folders/1cr6PCJJRH8-qYIqOKSRQzYnqL8qg4nC5?us

                                                                              • #15801
                                                                                Zeke Holloman
                                                                                Participant
                                                                                  @vogelrnws I was spending some time looking at the cellular stuff and I decided I’d try to use the python example you used, but I can’t seem to access the files through the Google Drive. A
                                                                                • #15802
                                                                                  Rick Vogel
                                                                                  Participant

                                                                                    it seems I have to add your contact email to allow the share. I’ll see if I can post the zip file. It didn’t like the .py files before

                                                                                  • #15803
                                                                                    Zeke Holloman
                                                                                    Participant

                                                                                      @vogelrnws Ok, thank you. If you need my email, zholloman54@gmail.com

                                                                                    • #15804
                                                                                      Rick Vogel
                                                                                      Participant
                                                                                      • #15805
                                                                                        Zeke Holloman
                                                                                        Participant

                                                                                          Awesome, thank you. That worked

                                                                                        • #15806
                                                                                          Zeke Holloman
                                                                                          Participant

                                                                                            @vogelrnws Hi there! So I uploaded the files onto the Xbee and used a python editor to change the main.py file. Is there any arduino code you would recommend using alongside this approach?

                                                                                          • #15807
                                                                                            Rick Vogel
                                                                                            Participant
                                                                                              Any arduino code you would like to use. The key is to identify which serial port you have connected to the XBee. For instance if you have it connected to Serial1 then you would want to print out the s
                                                                                            • #15808
                                                                                              Zeke Holloman
                                                                                              Participant

                                                                                                @vogelrnws Ah, ok! Awesome, thank you. And is there a place to put the apn in the main code?

                                                                                              • #15809
                                                                                                Rick Vogel
                                                                                                Participant
                                                                                                  No, the apn would need to be loaded via XCTU or you can place it in the python code before the cellular connection action…

                                                                                                   

                                                                                                  xbee.atcmd(“AN”, “hologram”) —&#

                                                                                                • #15816
                                                                                                  neilh20
                                                                                                  Participant
                                                                                                    @zeke-holloman  I’ve been out the office. Just to summarize our offline investigation – I got a good POST using your thingsp
                                                                                                  • #15818
                                                                                                    Zeke Holloman
                                                                                                    Participant

                                                                                                      Ok, thanks Neil. I’ll look into it.

                                                                                                    • #15899
                                                                                                      Zeke Holloman
                                                                                                      Participant
                                                                                                        @neilh20. Hey Neil! Sorry it’s been a while, but just a quick update. I was able to get it to work. I ended up purchasing a new XBee cellular modem (same type) alongside the Digi IoT Development
                                                                                                      • #15900
                                                                                                        neilh20
                                                                                                        Participant
                                                                                                          @zeke-holloman  great glad to hear it.

                                                                                                          Which modem did you buy and where did you get it?. I thought they were in short supply,  and I&

                                                                                                        • #15901
                                                                                                          Rick Vogel
                                                                                                          Participant
                                                                                                            That is the version of XBee I use as well. They are very short supply. I only have some cause we bought a large supply of them bout a year ago.  The dev board I use with mine to upgrade the cellular
                                                                                                        Viewing 50 reply threads
                                                                                                        • You must be logged in to reply to this topic.