LORA Temperature and Soil Moisture Sensor

by lazygarden in Circuits > Arduino

4536 Views, 11 Favorites, 0 Comments

LORA Temperature and Soil Moisture Sensor

1.JPG

In the preparation of making my own greenhouse I'm making some sensornodes to monitor the environment of the greenhouse. You can also use this sensor outside. Using the temperature inside or outside the greenhouse in combination with ground temperature and moisture levels are interesting to know when to plant your vegetables. I choose the capacitive moisture sensor because this kind of sensor doesn't corrode when in water.

In this instructable we are going to make a LORA node that sends following data:

  • soil humidity
  • soil temperature

For the completeness of this instructable I'm also going to post the code without the LORA tranceiver but instead sends soil humidity and soil temperature data over serial.The air temperature and air humidity will be measured with another node because I wan't a higher frequency of measurements to have more data. You can use this sensor together with the server node in this instructable.Read this instructable first to know what tranceiver to choose and to make the server node to receive data.

Needed Parts

Sensornode:

Tools:

Making the Antenna

For the antenna I use some leftover cable of my 2x2x0.8mm or 2x2 20awg bus cable.
On the things network you can choose your tranceiver and antenna frequency band by country.
These are the lengths per frequencie:

  • 868mhz 3.25 inches or 8.2 cm (this is the one I use)
  • 915mhz 3 inches or 7.8 cm
  • 433mhz 3 inches or 16.5cm

Soldering the Esp Shield

10.jpg
  • Remove the resistors of the esp shield (see R1 to R3 in the red field)
  • Solder the rfm95 chip onto the esp shield.
  • Solder the pinheaders onto the esp shield
  • Solder the antenna onto the esp shield. Don't use without an antenna you can damage the shield.
  • If the pinheaders aren't soldered onto the arduino solder these too

Coding

5.JPG
6.JPG
7.JPG

I know I can use the DTR to automatically reset the arduino but in my case I had errors uploading the code. Therefore I also used a manual reset in this instructable so if you have the same problem you can solve it by a manual reset.

  • Wire the arduino to the CP2102 as following:
    • CP2102 txd -> Arduino pro mini rx
    • CP2102 rxd -> Arduino pro mini tx
    • CP2102 gnd -> Arduino pro mini gnd
    • CP2102 3.3 -> Arduino pro mini vcc
  • Open the schetch in the arduino ide
  • Select board arduino pro mini
  • Select atmega 328p 3.3v 8mhz under processor
  • Select your com port
  • Click the upload button
  • While the code is compiling at the moment you see the bautrate (see picture) press the reset button on the arduino pro mini (the cp2102 doesn't reset the board) also be sure to close your serial monitor while programming.

The file agriculturesensor is the code without the LORA tranceiver. This way you can start your own project beginning from that file and you can better understand how the code works.
If you need more accurate readings you need to map the values of the moisture sensor when not in water and when in water.(minimum and maximum value) I have mapped the values between 400 and 880. Don't dip the sensor in water above the line. This will destroy your sensor. Later on I will show you how to waterproof this sensor.

The temperature readings are in degrees celcius.

One last remark: When you open the serial monitor of the server (last picture) you will see that the data is sent with a colon between the data. This is so we can send everything to the server node in one packet. In a later instructable I will make another server node where this data is processed.

Wiring

2.JPG
1.JPG
4.JPG
3.JPG

In the image above you see how to wire everything. The resistor is a 4.7kohm resistor used as a pullup. In the schematic I use another LORA tranceiver and another soil moisture sensor but the wiring stays the same. I've included some detailed pictures in case the first one isn't clear.

Conclusion

This instructable enables you to measure the soil temperature and humidity. In future instructables we will use this data to trigger a solenoid to water your plants also we will use this data in an upcoming project to propose the planting of certain vegetables when certain conditions are fulfilled. We will also reuse this instructable for another project where we will waterproof everything and I will make a PCB where you can mount everything onto.