Difference between revisions of "Lora Soil Moisture Sensor"
|Line 56:||Line 56:|
== Interface Function ==
== Interface Function ==
Revision as of 10:55, 23 June 2020
- 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||433MHzcommunication is established.|
|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).
• ATMEL Atmega328P: High Performance, Low Power Atmel®AVR® 8-Bit Microcontroller
• RAM: 2KBytes.
• 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℃.
- 1. Lora Soil Moisture Sensor
- 2. Maduino Lora Radio
- 3. USB-to-UART tool
- 4. 2*AAA battery
- 5. microUSB Cable
- 6. PC
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
|Lora Soil Moisture Sensor||USB-to-UART Tool|
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
Download the [RadioHead file], click Add.ZIP.Library, select RadioHead.
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.
Open the code LoraReceiver.ino
Select the Arduino Pro or Pro mini
Verify and upload the firmware.
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.
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 Here uses Micropython programming to receive and process data.
You need to use Makepython Lora module and MakePython ESP32 module, you can get them from the link below.
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)
- 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.
You can list your questions here or contact with email@example.com for technology support.