Difference between revisions of "Lora Soil Moisture Sensor"
(→Introduction) |
(→microPython usage) |
||
Line 174: | Line 174: | ||
− | === | + | ===Lora Gatewayusage=== |
This routine will use Lora Soil Moisture sensor and Lora gateway to make an Internet project that collects air temperature and soil humidity data and uploads it to the server, allowing you to learn the usage of Lora Soil and the basic use of Lora in depth.<br> | This routine will use Lora Soil Moisture sensor and Lora gateway to make an Internet project that collects air temperature and soil humidity data and uploads it to the server, allowing you to learn the usage of Lora Soil and the basic use of Lora in depth.<br> | ||
Line 189: | Line 189: | ||
[[File:Lora_Soil_4.jpg|700px]]<br> | [[File:Lora_Soil_4.jpg|700px]]<br> | ||
<br> | <br> | ||
− | 2. LoRa Gateway | + | 2. LoRa Gateway(microPython) |
− | Here uses Micropython programming to receive and process data.<br> | + | Here uses Micropython programming to receive and process data. Of course, it can be used in Arduino too.<br> |
You need to use Makepython Lora module and MakePython ESP32 module, you can get them from the link below.<br> | You need to use Makepython Lora module and MakePython ESP32 module, you can get them from the link below.<br> | ||
https://www.makerfabs.com/makepython-esp32.html<br> | https://www.makerfabs.com/makepython-esp32.html<br> |
Revision as of 06:44, 7 December 2020
Contents
Introduction
- The Lora soil moisture sensor is based on Atmel's Atmega328P, it collect local air temperature/ humidity with sensor AHT10, and detect the soil humidity with capacitor-humility measurement solution with 555, and transmit the local environment data to the gateway, with Lora communication, suit for applications for smart-farm, irrigation, agriculture, etc.
- In applications, always you do not need to check the air/soil state continuously, have a test of them for few seconds after then minutes/hours sleeping is normally Ok for most projects. To save the power, there the Air/ Soil measuring functional could be shut down in the working, so they can be only powered ON a short time and then a long time power off. With MCU in sleeping mode and low power consumption Lora module, this module works ok with 2 AAA battery for months. Besides, this sensor is coated with waterproof paint, makes it longer working time in the damp soil.
- The Lora soil moisture sensor is shipped out with Arduino pro-mini bootloader pre-loaded, and there also default sketch programmed. Uses can re-program it with Arduino IDE, we suggest a standard USB2UART convertor for this. Note that the DTR in the USB2UART convertor is needed to connect to “Reset” pin for Arduino sketch downloading, if there no DTR, you may need to press the “reset” button manually in the downloading.
Lora Soil Moisture Sensor offers bandwidth options ranging from 7.8125kHz to 500 kHz with spreading factors ranging from 6 to 12, there are three choices of the working frequency.
Item | Lora Module | working frequency |
Lora Soil Moisture Sensor 433M | RFM98W-433MHz/SX1278 | 433MHz |
Lora Soil Moisture Sensor 868M | RFM95W-868MHz | 868MHz |
Lora Soil Moisture Sensor 915M | RFM95W-915MHz | 915MHz |
Free ISM bands world Wide(come from TI)
Lora Soil Moisture Sensor based on the Arduino, users can program it with Arduino IDE, which is very easy especially suit for the none-programmers. There are also guide for users to learn how to create the first IoT project with this board, with which the starters can learn the hardware and programming skill quickly.
This guide help you the basic usage of Lora Soil Moisture Sensor.
This Moisture Sensor can be used to detect the moisture of soil or judge if there is water around the sensor. They can be very easy to use, just insert it into the soil and then analog read it. With help of this module, it will be realizable to make the plant reminds you : Hey, I am thirsty now, I need some water.
This design is based on a capacitive principle. We integrated the 555 oscillator capacitive measurement, which will give you a reading ranging from about 500 (very wet) to 1000 (very dry).
Features
• ATMEL Atmega328P: High Performance, Low Power Atmel®AVR® 8-Bit Microcontroller
• RAM: 2KBytes.
• Flash:32Kbytes.
• EEPROM: 1Kbytes.
• Clock Speed: 8 MHz.
• Interface: UART.
• MCU Power Consumption at 1MHz, 1.8V, 25C
- – Active Mode: 0.2mA
- – Power-down Mode: 0.1µA
- – Power-save Mode: 0.75µA (Including 32kHz RTC)
• 2*AAA battery powered
• Measure soil moisture
• Integrated air humidity and air temperature sensor
• Default baud rate: 115200bps.
• Working Temperature: -20 ~ +85℃.
Interface Function
①U1:LTC555
②J1:UART interface
③U2:Atmega328P
④ISP: used for download bootloader
⑤RST:Reset button
⑥Lora Module
⑦Air humidity and air temperature sensor:AHT10
⑧Antenna interface
Usage
Github:Lora-Soil-Moisture-Sensor
Required Materials
- 1. Lora Soil Moisture Sensor
- 2. Maduino Lora Radio
- 3. USB-to-UART tool
- 4. 2*AAA battery
- 5. microUSB Cable
- 6. PC
System diagram
Notice: Maduino Lora Radio and the Lora Soil Moisture Sensor must have the same work frequency. Otherwise, it receive nothing from another.
Lora Soil Moisture Sensor requires a USB-to-UART tool to upload firmware to it, you can get it from:
https://www.makerfabs.com/usb-uart-convertor-cp2102.html
Install the CP2102 driver from:
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Hardware Connections
Lora Soil Moisture Sensor | USB-to-UART Tool |
3V3 | 3V3 |
GND | GND |
RX | TXD |
TX | RXD |
After a Arduino IDE installed, there is a default package to support Lora Soil Moisture Sensor(Arduino Zero ),
From the top Arduino IDE menu, select Tools-> Board-> Arduino Pro or Pro Mini
From the top Arduino IDE menu, select Tools-> Processor->Atmega328P(3.3V,8Mhz)
After inserted the USB-to-UART tool to you PC, select the related Port. In my PC, there is COM7 that may different in your PC.
Download the RadioHead file, click Add.ZIP.Library, select RadioHead.
https://github.com/Makerfabs/MaduinoLoraRadio
Open LoraTransmitterADCAHT10.ino, verify and upload the firmware to Lora Soil Moisture.
Modify the frequency macro according to your board is 433Mhz or 868Mhz or 915Mhz.
If your Lora board is 433MHz:
#define RF95_FREQ 433.0
If your Lora board is 868MHz:
#define RF95_FREQ 868.0
If your Lora board is 915MHz:
#define RF95_FREQ 915.0
Tips: Lora Soil Moisture designed as a product, so it not integrates the USB-to-UART on board. If you upload the firmware fails, press and hold the Reset button before upload the firmware. When the IDE shows below, then release the button that may helped to upload the firmware success. That’s we need a reset the MCU when upload the firmware.
Install the AAA*2 batteries and put the Lora Soil Moisture aside, now we need to make the Lora Radio Receiver.
2. Lora Radio Receiver.
Plug the Maduino Lora Radio to PC via microUSB cable.
Open the code LoraReceiver.ino
Select the Arduino Pro or Pro mini
Select ATmega328P(3.3V,8Mhz)
Verify and upload the firmware.
Result:
The Lora Soil Moisture will send messages via Lora Radio frequency. And the Maduino Lora Radio will receive the result and print them in the Serial Monitor.
We can see it gets the air humidity and temperature and soil moisture from the Lora Soil Moisture Sensor.
Lora Gatewayusage
This routine will use Lora Soil Moisture sensor and Lora gateway to make an Internet project that collects air temperature and soil humidity data and uploads it to the server, allowing you to learn the usage of Lora Soil and the basic use of Lora in depth.
Step:
1.The Lora Soil node sends data to the gateway.
- Here we need to use Arduino for programming.
- Use the serial tool to connect the Lora soil moisture sensor.
- Open Arduino IDE, Board choose Arduino Pro or Pro Mini, Processor choose ATmega328p (3.3V, 8MHz), select the corresponding port.
- Download the program from here: TransmitterAHT10.
- Open the program and click upload (you need to press the reset button during the upload process). After success, you can see the following output from the serial monitor:
2. LoRa Gateway(microPython)
Here uses Micropython programming to receive and process data. Of course, it can be used in Arduino too.
You need to use Makepython Lora module and MakePython ESP32 module, you can get them from the link below.
https://www.makerfabs.com/makepython-esp32.html
Makepython ESP32:
Makepython Lora:
Assemble MakePython Lora and ESP32 to make a gateway that can receive remote data and upload it to the Internet.
3.Receive the data transmitted by Lora Soil Moisture sensor.
You download the code from here: code, then upload all xxx.py in the Micropython_Lora_Soil file to ESP32.
Open the LoRaDuplexCallback.py file, You need to make some adjustments so that your ESP32 can connect to the network and upload data to the server.
- Modify the API_KEY you obtained in ThingSpeak. (I will introduce how to obtain it later)
#https://thingspeak.com/channels/1035244 API_KEY='SO3W20EMSKIEJN4E'
- Modify SSID and PSW to connect WiFi.
ssid = "Makerfabs" pswd = "20160704"
- Open the connectWiFi.py file, here also need to modify the ssid and pswd.
- Sign up an account in https://thingspeak.com/. If you already have one, sign in directly.
- Click New Channel to create a new ThingSpeak channel.
- Input name, Description, Select Field 1 to 5. Then save channel on the bottom.
- Click the API Keys option, copy the API Key, we will use it in the program.
- Insert one end of the Lora Soil Moisture sensor module into the soil of the flower pot to collect data.
- Press the reset button of Makeoython ESP32, after the connection to the network is successful, the screen can display the data sent by the Lora Soil Moisture sensor module.
- After logging into ThingSpeak, you can see the data uploaded by ESP32 Gateway.
FAQ
You can list your questions here or contact with support@makerfabs.com for technology support.