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

Rick Vogel

Forum Replies Created

Viewing 10 posts - 21 through 30 (of 33 total)
  • Author
    Posts
  • in reply to: Using Xbee Cellular Modem with ThingSpeak #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 broker at one of our regional headquarters and also have a FTP-Secure server to remotely update both the XBee and the Teensy 3.5 processor I use as the datalogger. The Teensy runs a special bootloader that allows it to boot off the SD Card file. So I can pull the new file from the server with the XBee and then transfer via the serial port to the Teensy as it writes it to the card. Reboot and boom, new program is running.

      in reply to: Using Xbee Cellular Modem with ThingSpeak #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 network and MQTT items vice using the AT commands from the MayFly to the Xbee as it looks like is happening in the enviroDIY libraries.

        in reply to: Using Xbee Cellular Modem with ThingSpeak #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 the credentials you get from the MQTT device you created on thingspeak, not your API keys. Save file.
          • Within Digi XTCU you will need to go to File System Manager on the Xbee and go into the “lib” folder.
          • Create a folder named umqtt. (right click, create directory, name it, enter) Place the simple.py file in that folder.
          • Go back to the main /flash directory (should show cert and lib folders) and transfer the main.py file into that location.

          This main file does a few different things. Sorry, I didn’t want to completely rewrite the file so I used a lot of what I already had in place and deleted the FTPS portions.

          • It will recognize data that it needs to publish from the mayfly be adding 2 things.
            • #P on the front of the data string (no space between this and the actual data)
            • ‘\n’ on the end of the data string (println() from mayfly for each data string you want to send works)
              • so….. #Pfield1=xx&field2=xx&field3=xx……\r\n
              • python uses the \n to separate the strings and then trims the \r later.
              • you can send multiple strings at once as long as each one has these two identifiers on the front and back and this file will split them into individual posts.
          • Because there may be times where you loose the cell tower, this file creates a couple of files to log the data in case it can’t post. There is a topic file and a message file. Each time a post comes in for publishing it will first back it up to the files. Once it posts then it will clear the file. Does the same thing for power outages. If you have backed up messages that still need to post and you lose power, it will read those logs on boot and place them in a buffer to send. Once they all send it will clear the files.

          within the main.py there are some print statements I had in there while troubleshooting this connection. You can comment them out if needed. I also connected my XCTU profile if you want to dump this to the XBee for settings establishment (profile -> apply profile). I’m on 11417 firmware so you may want to update to that if you want to use it. The only thing you should need to change would be your apn. I use twilio super sims and the apn is different.

          Please let me know if you have any questions. I know this is a fair bit of info. more good info on the python aspect of XBee is here:

          https://www.digi.com/resources/documentation/Digidocs/90002219/#reference/r_access_data.htm%3FTocPath%3DAccess%2520file%2520system%2520in%2520MicroPython%7C_____2

          in reply to: Using Xbee Cellular Modem with ThingSpeak #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 provide some code to just use simple serial.println() on the mayfly to send payload to the xbee and it will handle all the MQTT stuff in the background.

            in reply to: Using Xbee Cellular Modem with ThingSpeak #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 device that would be posting. It issued the device credentials: username, client ID and password…?? Sorry if I’m just causing more confusion, but trying to see what is keeping your unit from the initial broker connection

              https://www.mathworks.com/help/thingspeak/mqtt-basics.html#mw_0bf68abc-6c4e-4e2e-8312-e8223a203b71

              in reply to: Using Xbee Cellular Modem with ThingSpeak #15736
              Rick Vogel
              Participant

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

                in reply to: Using Xbee Cellular Modem with ThingSpeak #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-desktop-mqtt-client-to-subscribe-to-channel-updates.html

                  This example uses MQTT.fx, but I normally use http://mqtt-explorer.com/

                  We are using the Digi LTE-M/NB IoT platform to automate and recover historical COOP sites that have closed. We send 5 minute temp and 15 minute precip. I don’t have any experience using thingspeak, but we have great success with this platform using the micropython programming option built into the Xbees for MQTT. We use a different arduino based platform for the data acquisition and then have the XBee do the heavy lifting for encryption and TLS. It also has capability for FTPS to push remote updates without the need for the Digi Remote Manager. Very capable device.

                  Dashboard –https://www.weather.gov/crh/ccoop

                  in reply to: Datalogger build #1285
                  Rick Vogel
                  Participant

                    should maintain time as long at vBatt on the RTC is good……although plugging and unplugging electronics can do crazy things sometimes. At least now you have a quick way to set the time should you need to.

                    in reply to: Datalogger build #1281
                    Rick Vogel
                    Participant

                      Try this latest one if you have issues. Setting the time within Arduino Serial monitor with T0045….. will still work, but if you are in hyperterm or putty just hit the “?” symbol and it should bring up a menu for you to modify the time manually and step you through the process. If you have issues just let me know and I’ll help you get through.

                      File name changed and change the .txt to .ino again to load into Arduino.

                      Attachments:
                      in reply to: Datalogger build #1280
                      Rick Vogel
                      Participant

                        Brandon,
                        Open up the Serial terminal within the Arduino IDE and perform the following:

                        Send Time as T, sec(00-07), min, hr, dayOfWeek, dayOfMonth, month, year.
                        example: T0045073071015 Send/Enter
                        //sec=00, min=45, hr=07, dayofweek=3, dayofMonth=07, month=10, year=15

                        I forgot that using Putty or HyperTerm this won’t work because they send chars as they are typed. The Arduino Serial Monitor allows you to type it all first and then hit send.

                        I have another menu based structure that would work in any terminal emulator. I’ll see if I can dig that up.

                      Viewing 10 posts - 21 through 30 (of 33 total)