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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Needed Parts
- Waterproof temperature sensor (ds18B20)
- capacitive moisture sensor
- arduino pro mini 3.3v 8mhz
- esp breakout
- wire for antenna and connections (I use a 0.8mm solid core wire)
- male to male jumper cables
- female to female jumper cables
- terminal block
Step 2: 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
Step 3: Soldering the Esp Shield
- 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
Step 4: Coding
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
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.
Step 5: Wiring
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.
Step 6: 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.