Project: IOT wireless LORA temperature sensor for grain storage monitoring

Hello,

At farm, we have this old temperature sensor, but the electronics device to read them is dead:
20210322_182646
So 2 options, throw them or starting a new interesting electronics project. So lets start a new project !

After a few measurement with a multimeter and an water ice bath, the sensor type is identified: RTD PT1000 sensor.

So the goal is to transform them into wireless connected temperature sensor:

  • Running into batterie, with an autonomy for at least 3 months
  • A temperature mesurement period of 6 hours (so a sample every 6 hours), enought for grain storage monitoring
  • Data available ā€œon internetā€, so that we can consult them everywhere (not requiered to be at farm to read them)

My project is greatly inspired from this @BrianTee_Admin video: Farming the LoRa Network - YouTube

For the wireless aspect, I also choose LORA, main reason:

  • Low power, easy to use
  • Range: the internet box is not close to the hangar were grain is stored, Wifi signal is too low

Some details about LORA network:

Hardware used for the sensor:

Also, itā€™s required to used a LORA Gateway, so for development, I choose this low cost 8 channels LORA Gateway (available on AliExpress):

Picture of the prototype of the sensor:
20210322_182718

So currently I have the sensor that read temperature, send the value to LORA. The Feather go to ā€œdeep sleepā€ during 8s, then wake up, make a measurement and send data on LORA, go to deep sleep again for 8s.
The 8s is the limit of the 34u4 Wathdog Timer used to generate the interup to wake up the microcontroler;

The measurements are received by the LORA gateway (connected to my Wifi) and then send by internet to the open LORA network TheThingsNetwork (https://www.thethingsnetwork.org/). The LORA gateway
20210322_182821

Then the temperature data is send from TheThingNetwork to Cayenne (Cayenne Features - Developer | myDevices.com), a service that alow to easily design a IoT data visualisation. Exemple, temperature data of my sensor from this week-end in Cayenne:
cayenne

Since monday afternoon, Iā€™ve started an ā€œenduranceā€ test of the sensor: the sensor is running continusly on a 4000mAh battery (with the cycle deep-sleep for 8s, send a measurement, deep-sleep for 8s, etc.). The goal is to have a first a estimation of the sensor autonomy with this cycle that I can interpolate for a 6 hours cycle.

Of course, I plan to share the code I have made for this project, hardware design ect, when all of this will be more mature.
Documents that Iā€™ve used for this project:

For the MAX31865, I havenā€™t use the Adafruit library: as MAX31865 use SPI and LORA module of the feather also use the SPI so I wanted to keep a controle of SPI traffic. So I rewrite function for MAX31865 using Arduino SPI library

Next steps planned for this porjects:

  • Make a range test between Gateway and sensor at farm: check that with the sensor in the grain storage building and the LORA gateway in the orther bluiding with internet box, the LORA range is enought for data tranmision

  • Find a conviniant way to manage a deep-sleep of 6 hours (how to generate an interrupt every 6 hours ?)

  • Test the Heltec Cubecell board (CubeCell ā€“ Dev-Board ā€“ Heltec Automation) as an alternate to the Adafruit board. The Heltec board has many advantages compare to the Adafruit board that I currently use:

    • Twice cheaper
    • A real ā€œdeep-sleepā€ mode: in deep sleep Adafruit board consumption is ~330ĀµA, where Cubcell datasheet announce 11ĀµA
    • The 3.3V output of Cubecell can be switched off: so during deep-sleep, we can switch off the 3,3V output of the board, so shut-off the MAX31865, for saving more power
  • Have a RGB LED (where le Adafruit has a standard red LED): so the led can light up with different color depending on the state of the board: INIT, temperature measuring, sending data, error stateā€¦

    But main drawback of the Heltec board is that the documentation is very light compare to Adafruit.

  • When I choose between this to board, design a PCB and 3D printed box

  • Iā€™m also not very satisfied with Cayenne: the interface is slow, and configuration is limited. So enought for tests and initial use, but eventually I would like to find another solution.

I will continue to share here the progress of the project.

Math

19 Likes

Have had a very similar idea for awhile now too. Just have no extra time to really get working on it. Was going to use LoRa also. My thought was to build my own temp cables for each bin, using DS18B20 sensors. I do have a arduino uno set up to communicate with Cayenne for testing purposes but like you mentioned, not sure if Cayenne is the best. At the time they did offer a app which was what I liked about it, but it has been discontinued. Keep working at it when I can I guess.

1 Like

Opportunity for me to introduce one of my favorite ā€œguruā€: Andreas Spiess ā€œthe guy with a swiss accentā€
on Youtube: https://www.youtube.com/c/AndreasSpiess/search?query=grafana
Very clear explanations on many topics close to our concerns: MQTT, Node Red, InfluxDB, and Grafanaā€¦
And much more!

2 Likes

Interesting subject and specialy Lora

I do a similar project but really simple
a temperature sensor in the arrow (~1meter) , a ESP8266 and a battery in the top box
image

evry 1h it send information to local webserver or now to one google spread sheet with Wifi

we use:

  • now to check soil temperature and take a tendancy before spring seeding
  • in may during hay season to check hay baler
  • in july to check seed
    image

and we can get result like this ( soil temperature at 10 cm) the last 8 days
image

5 Likes

Hello,

@farmerj, in fact Cayenne display can be enought for me. But the main trouble is that the graphics can take between 30s to 1min to display. Ok for testing my hardware and LORA part, but not convenient for operationnal use.

@flipper80, Iā€™ve already seen his videos. But main trouble for his setup:

  • The server running on the Pi is connected to your local networtk: so your server is submitted to the quality of your local internet connexion. At our farm, the internet connexion as a poor bandwidth: 1,5Mbit/s
  • For security connexion, he used a VPN via OpenVPN. To every time you want to connect to your server to check the data, you have to launch the VPN connection before: not very convenient.
    Iā€™m more look to a service like Cayenne: you loggin with your loggin / password to the website, and itā€™s done, all your datas are displayed.

@bricbric Very interesting !
How did you manage the deep-sleep and wake-up every hour ? ESP8266 has an internal counter able to deal with 1h time ? Our did you used a external RTC ?
What is your Wifi range ? For soil temperature in the field, you need a long range signal !
The data display you show is from Google sheet ?

Math

For deepsleep ESP has this internal function ESP.deepSleep( timeMicrosecond); >> 71 mm (if more need to play with RTC memory)

For transfert i use Wifi Bridge for other purpose so i have some spot evry where, i can sometimes catch 300 meter if i have no obstacle.
I use ESP multiwifi to give a chance to catch one wifi network.

This year i use also with two ESP slave and master to use ESPnow and i can catch 3-4 more time autonomy

Transfert data by ESP NOW is very fast \ send data to local web server is correct\ send to google spread sheet is very slow

the data show is my own graph generation so it is not smoth but now i use google spread sheet, script because it is really convineniant to share by web site

for example in google spreadsheat

This is a MKRfox1200 ( so Sigfox network) connected to mechanical float level, pressure level sensor and internal temperature sensor
this sensor evaluate solar pump and water level tank so you can see when pump is activated (upper pic) and when Cow are drinking ( and temperature as bonus)

information in the graph shows some relativity ( it is not precise but can detect some failure)

1 Like

Hello,

Ok this is a lot more than the timer of the 32u4 of the board I used, limited to 8ms.

What you call ā€œWifi Bridgeā€ is a Wifi Mesh Network (multipble access point diffusing the same Wifi, like Netgear Orbi system) ?

Ok; I donā€™t now the ESP board, I donā€™t know what thoses fuctions are.

Ok, interesting, I didnā€™t know google sheets can do this kind of operation. But if I understand well, you still have a local server ? This is that I want to avoid.

Why did you choose Sigfox ? Itā€™s required a subscription to Sigfox, where LORA is Open-Source.

Math

hello

when you do Deepsleep function in ESP it reboot and restart again and you loose data ( so you need to save before ansd restore after in RTC memory)
if it is an arduino boaed it is mutch simpler ( deep sleep stop and restart at the same position on the soft)

I think it is similar but more adapted for longer distance

at least you need 2 for bridge and an other one to make wifi locally

With google spread sheet it is on the clouds that is the most interesting thing you need only a gmail adress. ( you can send 10000 query by day)

Sifox module is cheap and easy to start with out network ,
But LORA is better for your argument that what i folow you and i probably switch to LORA

Hello,

Thank for your answer, interesting.

In my case the 32u4 of the board I used has a wathdog timer limited to 8ms, but yes itā€™s stop and restart at the same position in the soft. For longer deep sleep, for now the easier way I can see is to implement a counter to check number of time the ĀµC is wake, and if less than x count, imediatly go back to sleep.
If I want a measure every hour the counter shall be 3600/8=450. And for the counter itā€™s requiered that the RAM is not reset when ĀµC go to sleep.
But for what Iā€™m doing a ĀµC like the ESP that have a internal counter allowing deep-sleep for one hour, even-if itā€™s reset the ĀµC, itā€™s not a problem: in this case I donā€™t need to store data between awake period. Every time the ĀµC wake up, I make a measurement, send them to LORA and go back to sleep. Donā€™t need to store anything on the ĀµC.

My prototype is running since 1 week on a 4400mA battery, with a measurement every 8ms. After one week the batterie is discharged by only 1/4.
So with a period of 1h and the Heltec board who has a consumption in deep sleep 10 times lower than my current board, I have good hope to reach months of autonomy.

Iā€™m waiting the Heltec board for now.

Math

Hello,

Some news:
The Adafruit LORA board have run on a 4000mA battery with a cycle of a data acquisition and send to LORA every 8ms from 05/04/2021 18h46 to 30/04/2021 07h53.
So with a deep sleep period of 1h, we can reach a really longer autonomy.

Iā€™ve received the Heltec board. Test it with simple .INO to play with the RGB LED.
The board works.
Now Iā€™m trying to port the code made for Adafruit board step by step:
First, the code to read the MAX trought SPI
Second, the code to send a simple value to LORA
Then the conbinaison.

But for now I face an error when I compile the code for read the MAX: Iā€™ve a ā€œerror: ā€˜max31865Initā€™ was not declared in this scopeā€ while the function is strictly define in the INO. When I compile it for Adafruit Board itā€™s works.
Not a lot of documentation on the CubeCell board.
I feel that programming this board will be painfull !

Math

Hello,

Still fighting with the Heltec board.

Today I went to the farm and I made a range test of the LORA sensor (Adafruit Feather board):

  • The LORA gateway is placed in the house near the internet box
  • The LORA sensor is placed insite the hangar
    Distance approx: 50m
    lora_distance.PNG
    Both buildings are closed.
    Hangar is fulling in sheet still. In the line of sight between LORA sensor there is 2 tractors and a sheet metal grain storage bin. The sensor is placed only at 1,5m of the floor.

Result: I received all the packets from the sensor. So good new: this is a ā€œworst caseā€ scenario:

  • For the final application, I planed to have a more advance gateway LORA, with antena that can be placed outside
  • For now, the antena of the Adafruit bard is just a wire: for final solution, I planed to use a specific LORA antenna
    So conditions will be better.

I let the baord running all the night.

Math

Maybe I cheated. I have a RadioBridge LoraWan sensor (see below) in each grain bin. I extended the wiring to be approx 6ā€™ long and ran a piece of chain to support the sensor so it doesnā€™t hang on the wire. I put the sensor about 2ā€™ deep in the grain. Data flows into The Things Network and I have a script that pulls the data into Google sheets to give a way to archive and display temperature and humidity.

image

Hello,

Some news about this projet:

  • I have the Cubecell board communicating correctly with the MAX31865
  • I have the board sending the data over LORA. Itā€™s was a bit difficult do to the fact that SX1262 LORA chip of the board communicate with the MCU using SPI. And MAX31865 is also on SPI bus. I had conflicts on the SPI bus between these two components.
    http://community.heltec.cn/t/cubecell-difficulties-to-adapt-lorawan-bmp280-example-for-my-projet-with-ttn/7164
  • At the same time, The Things Network have migrate their platform to the new version : The Things Stack v3. So all the devices have to be migrate on this new version. So I had to migrate my Gateway on this version and also the board.
  • And I have the data displayed into Cayenne like previously (I also face some bug when migrating the application to TTNv3)

So now, Iā€™m at the same point than 6 months ago :grinning_face_with_smiling_eyes:. But with a new board and everythings migrate to TTNv3.

So Iā€™ll continue the project with the Cubecell board. With TTNv3 itā€™s not recommanded to use LORA ABP activation, OTAA shall be used. The LORA library of the Adafruit Feather 32u4 doesnā€™t take in charge OTAA activation method.
And Cubecell board offers more possibilities. The drawback itā€™s the documentation of the Cubecell which is not very detailed.

Next step are:

  • Deep sleep management: I would like to have a duty cycle of 1h maximum (sending every 1h maximum). So Iā€™ve to test how the deep sleep mode work on this board and seeing if the internal counter can count to 1h minimum or if I need and external clock
  • Batterie management and charging of the batterie
  • Designing a dedicated PCB board and a 3D printed case
  • Migrate from Cayenne to an other platform that are more customizable

A video about migration on TTNv3:

Math

Hello,

Some news:

  • With the Heltec board, the range of the internal timer used for deep sleep period is 2^32 milliseconds. So we can put the board into deep sleep for a very long period. A lot more that what I need. Iā€™ve tried with a period of 1h: it works. The good thing is that if I want to go up to 2h, 3h or even more, I can.
  • Now Iā€™m waiting the availablity of this low current measurement tool kit KitĀ II de profileur de puissance (PPK2) - Nordic | Mouser to measure the avarage current consumption of the board over a cycle and determine the battery capacity requiried to reach a board autonomy of 6 months
  • I started to design a SMD board, but the main issue is that there is no stock of MAX31865 in JLCPCB part library. And the bigger package of the components is SSOP20. Hard to hand solder !

Math

1 Like

Done mā€™y grain thermal sensor monitoring with raspberry pi, domoticz, rflink in 433 and tft monitor. All sensor use sx888 radio with attiny. 1 data each 8 hour and sensor got an autonomy more than 1 year with 3 AA battery
I use this box


Anyone make headway with this? Looking to do something similar

1 Like

We are doing something similar but for monitoring a batch dryer plenum / ambient T/H, water and fuel tank levels, multi level T/H probe for the grain dryer. Also prototyping controlling the dryer using LoraWan downlink commands but that is being a bit of a challenge currently.

I use a Dragino outdoor base station and Dragino sensor nodes. Reporting to TheThingsNetwork and sending data via webhooks to Datacake for easy setup of mobile friendly dashboards and sensor value driven email alerts for dryer faults.

The turnkey sensors units are easy to use and simple enough to configure over a serial port. The multi sensor grain probe has been a bit of a journey but my prototype has been running with five sensor which will be spaced evenly inside a piece of conduit.

My basic T/H and water tank level systems have been deployed to one other farm currently and I suspect I have another 4 to do next year, Sadly they are all just far enough apart that Iā€™ll need to deploy base stations to each of them.

1 Like

I have been working on something kind of similar. I am using fixed transmission lora radios to create a P2P connection between the reader units and the base station. The base station will be an esp32 hosting a local website that will display the readings. My goal is for it to not utilize any external servers, and be more or less plug and play. So far my prototypes have performed rather well, they seem to be more or less reliable. Currently I have some pcbs on the way that feature solar charging, power management, short circuit protection and detection, and an advanced onewire driver circuit that should be able to drive a bus up to 100ā€™s of meters in length. Eventually I plan on offering a low cost kit that is simple and affordable.

I am also working on building professional quality temp/humidity cables that will be completely backwards compatible with many commercially available cables/readers. Each node on the cable will contain a small pcb measuring 24.5X5mm in size, this pcb will carry a DS28EA00 onewire temperature sensor and SHT35 humidity sensor, both protected by a sintered steel filter. All of this will be placed inside a machined aluminum housing and suspended on an 1/8 cable with hose spanning the gaps between nodes. From the looks of it I will probably be able to build the cables for 1/3 of the price of commercially manufactured ones with similar strength and protection.

3 Likes