In June of 2020, Asvin was selected to implement a use case scenario with LTE connectivity and DLT (Distributed Ledger Technology) together with Tsenso as a part of the European Blockchers competition. Read more about it here in this blog post. Following is a blog post to demonstrate the results.
Problem Statement
Most fresh food lasts for much longer then described on the packaging. Manufacturers and suppliers often put a blanket date on food stuffs as they do not have enough data to say otherwise. FreshIndex form Tsenso is making efforts to prolong the usable shelf life of foods by collecting end to end temperature data right from farm to plate. This large data set helps FreshIndex to determine the real shelf life of food stuffs. At asvin we are providing FreshIndex with a solution for this application.
In the fresh food industry, the food products are always kept at a temperature below 7°C during the entire life cycle of the food. This is the minimum, but different products are stored at different temperatures. FreshIndex and asvin are empowering making these decisions easier for the customers
Solution
To measure the temperature, we use a widely available DHT22 temperature sensor. The sensor is easy to connect and interface and has a variety of supported libraries. This temperature sensor will be used to periodically measure and store temperature data. This data is then uploaded over LTE network using MQTT protocol. This sensor, the development board and with all its peripherals is enclosed in a IP66 waterproof enclosure. A cable gland is installed to let in air to measure temperature. The result of this solution is a device which is capable of monitoring temperature of food batches and reporting this data over LTE network to a dashboard. It operates in two modes as stated below.
Storage mode: This mode is active when the device is not in use and is stored or shelved.
During this mode, the device parameters are as follows
- Measurement interval: 20mins
- Upload interval: 24 Hours
- Check firmware: True
This is the default mode for the IoT device, and it will stay in this mode until the measured temperature goes below 7°C. The firmware IoT update is checked once in every 24 hours.
Operation mode: This mode is active during the actual operation of the IoT device.
Once the measured temperature is below 7°C, the operation mode will be activated. Once this mode is activated, the IoT device will upload all the previously measured data and check for available firmware updates. The IoT device does not check for firmware updates further on in this mode. This mode is active for 7 days from the day of activation. This mode has the following parameters.
- Measurement interval: 20mins
- Upload interval: 2 Hours
- Check firmware: False
Real Time Clock
Timing parameters play a crucial role in the operation of this device. RTC provides a time reference in this case in setting up timing parameters. The device will check if the RTC is updated with the current time. If not, then the device will update the RTC time by connecting with a nearby NTP (Network Time Protocol) server. This operation is done only on the first boot as the RTC has an onboard battery and will keep time between device resets. We used a DS3231 based RTC module as shown below.
OTA Updates
Asvin’s IoT device Management platform is used to provide secure Over the Air (OTA) updates to this IoT device. Files on the device’s filesystem can be rolled out as firmware updates. There is also a config file on the device which can be rolled out as an update. This config file allows the users to configure parameters such as User credentials, Timing parameters, LED color etc.
Data Format
We store the timestamp and temperature data measured by the temperature sensor as struct packed binary data.
The decoded data looks as follows
This data is sent over MQTT to an assigned broker.
Description OF Hardware
Pycom
In this project we are using the Gpy development board from Pycom. This board has onboard Wi-Fi, BLE and cellular CAT M1/NB1 connectivity. It is also an ideal platform for enabled rapid prototyping and experimentation. It runs micropython underneath which is also easier to work with and reduces development time for prototypes.
We are also using an expansion board in this project to enable additional features such as interfacing with GPIO pins, onboard Li ion battery charging and programming /debugging code on the Gpy board.
LTE setup
In this solution as discussed above we use LTE CAT M1 connectivity. The Pycom boards have onboard LTE modem (sequans monarch). The LTE modem also comes with a matching LTE antenna from Pycom. This antenna is mounted under a felt material under the top lid of our box.
AT&T LTE sim cards
We choose AT&T as our provider for LTE CAT M1 sim cards. AT&T uses deutsche Telekom network in Germany and has ties with other network providers all around Europe and other parts of the world.
AT&T also provides a web-based platform to manage sim cards, user accounts, user profiles etc. It also provides a variety of features and tutorials to assist with get started with. It also provides API’s for automation and integration with other systems.
Links
- https://marketplace.att.com/products/att-iot-dataplans-lte-m-us
- https://eckstein-shop.de/DS3231-RTC-Modul-LIR2032
- https://pycom.io/product/gpy/
- https://blockchers.eu/
- https://freshindex.eu/