Cellular & Microcontrollers: Environmental Datalogger - Page 1
Forum section: electronics / projects

author: zachary5577
author_rank: Contributor
timestamp: June 18, 2023, 07:16:15 pm
content: Hello Reader,I'm currently working on a project for work where we would like to upload log files from a datalogger deep in the woods to an online database that we have. We also want to be able to update the datalogger's firmware remotely. We currently have an excessive amount of equipment for what we are trying to do and we are working on a redesign and I'm looking for some advice and some suggestions for the best way to procceed. I'm a young EIT myself and need assistance!For a bit more context, our loggers have an ATMega1284P connected to a fancy sensor that logs the response from this sensor to a file on an sd card. We want these log files to be uploaded to a database (we already have the endpoint for where these files can be uploaded and formatted etc). Our current setup uses an off-the-shelf celluar modem with a linux machine in it (one of telitonika's RUTs running RUTOS). Currently we just use the RUT to provide wifi to a raspberry pi zero (which are currently out of stock) which then connects with a serial cable over to our ATMega datalogger device. The reason we don't use the linux machine in the RUT to do this had to do with difficulties getting all the python script dependencies on the RUTOS. The ATMega has a CLI which allows you to send the sdfiles over serial and get meta data about them. We have a script that runs on the pi to grab all the files and save them locally. Then the pi will do something like a POST request to an endpoint with the files as an attachment/datastream.One idea to simplify the setup was to perhaps replace the ATMega 1284P with a wifi capable microcontroller like an ESP32 or Rasbperry PICO W and try to find a simpler device for providing celluar (or maybe put that on the board?). Then have the microcontroller just post files itself. But i'm not sure how we could update the firmware in this case - I think we'd need to ensure we have more than 2x the memory for our firmware available on the board and write a custom bootloader.Another idea was to just remove the pi and re-investigate getting getting our scripts to run on the RUT. This makes using avrdude to upload firmware remotely trivial (like how we do it now). This seems like the simplest and correct thing to do. But perhaps there is something that I'm missing.What do you all think we should do? I'm very open to suggestion or suggested readings.Regards,Zachary

author: globoy
author_rank: Frequent Contributor
timestamp: June 18, 2023, 07:29:46 pm
content: Definitely sounds like you could simplify. Have you considered a device made specifically for IOT such as a Particle device? Some of their devices include a cellular modem and can be programmed like an Arduino. They can support local file storage (I've done a project where we log data to a local store when we can't get cellular communication and then upload everything when we do have cellular communication). Their infrastructure can handle remote firmware updating and can provide an endpoint for your own software (database) to access for the information provided by each device. Of course you'd have to make sure they are supported by the network in your country.

author: zachary5577
author_rank: Contributor
timestamp: June 18, 2023, 07:54:16 pm
content: Quote from: globoy on June 18, 2023, 07:29:46 pmNo I've never heard of them! Thanks I'll check them out.

author: zachary5577
author_rank: Contributor
timestamp: June 20, 2023, 11:55:52 pm
content: Just wanted to bump this post. Still interested in hearing other people's experience with Cellular micro-controllers and recommendations! Thanks.

author: Scrts
author_rank: Frequent Contributor
timestamp: June 21, 2023, 08:09:22 pm
content: Did you have a look into Teltonika gateway, like TRB142, which has RS232 interface? You could then interface it to your existing ATmega.Another option is to take your atmega, utilize UART interface and interface it to LTE or NB-IoT module like SIM70xx (e.g. SIM7000, SIM7070 or SIM7080). These modules have MQTT built-in, so you can easily formulate your own messages and publish to MQTT server. There are also plenty of libraries for atmega, like tinygsm or so.I have a prototype working for STM32+SIM7070G, which sends MQTT messages to AWS. Then on AWS I have a rule that if my variable is over threshold - I receive an email. Basically had an idea of a product to send an email if power is lost, so it operates from battery and lets owner know. Kind of made it to work then lost enthusiasm :-)

author: zachary5577
author_rank: Contributor
timestamp: June 23, 2023, 01:15:06 am
content: Thanks. We have a TRB142 and a RUT955. I have been taking steps to remove the pi. I was able to get a syncing script to pull serial file data from the device using a gateway and save it into a file on my local machine. Still having some trouble with flashing firmware though. Turns out you can install avrdude on RUTOS with opkg install avrdude. But it can't flip the DTR pin which actually resets the microcontroller to flash the new firmware. I tried running running avrdude from my local machine and flashing the the exposed port using telnet but no good. Not sure why only the rs232 service has control over the DTR/CD pins but kind of a pain. Ill check out SIM7000 and the MQTT protocol. Someone else mentioned MQTT to me before but I haven't looked to closely at it yet. What's the benefit of it?

author: hussamaldean
author_rank: Unknown
timestamp: June 23, 2023, 03:32:14 am
content: Check nRF9160.It is designed for low power IoT devices.