Interested in using hardware to take better care of a plant? This tutorial will show you the basics of how to read the level of moisture from the Soil Moisture Wireling and create a nice graphic display of the information.
All you need to do here is attach your Wireling Adapter TinyShield to the TinyScreen+, and attach the Moisture sensor to the Adapter Shield with the 5-pin cable! If using the provided code, make sure to plug the sensor into port 0 on the Adapter Shield (port numbers are on the back of the board.)
Make sure the TinyScreen+ power switch is flipped to on, and use the Micro USB cable to connect the hardware to your computer.
Step 2: Software (Setup)Make the correct Tools selections for your development board. If unsure, you can double-check the Help page that mentions the Tools selections needed for any TinyCircuits processor.Then upload the program to the TinyScreen+, or development board of your choice.
If you don't have the TinyScreen library yet, go to Sketch -> Include Library... -> Manage Libraries... -> type in "tinyscreen" to the search bar, and download the library! If it's your first time using a TinyScreen+, please go through the TinyScreen+ Setup Tutorial.
Download the Soil Moisture Wireling example sketch with animation and calibration from the 'Code' section at the bottom of the page. This sketch will be used in steps 4 and 5.
Open the Soil-Moisture-Monitoring_example.ino file in the Arduino IDE and upload it to the TinyScreen+.
Step 4: TestingFirst, upon uploading the sketch from the downloaded zip file you will see a screen like in the below picture.
Now that the code is uploaded to the board, there are two ways you can look at the moisture level detected by your Wireling. One way is on the screen itself (the easiest way) or in the Arduino IDE's serial monitor (The serial monitor is accessible from the Arduino IDE through Tools > Serial Monitor).
Either way, touch the Soil Moisture Wireling with your fingers and watch the bar change on the screen:
As a bonus, if the change in percentage/readings is big enough, a little raindrop animation will play on the screen and the plant status will change to "Hydrating."
Serial Monitor: TinyZero or TinyDuinoIf you are using the Arduino IDE serial monitor for testing, connect your board to your computer, make sure the power switch is on, and open the serial monitor from Tools > Serial Monitor. You will see messages such as "Plant is -> IDLE | Moisture level = 0.02" The moisture level reading will change if you touch the Wireling with your fingers.
Step 5: CalibrationBoth download links in the code section have hardcoded values in the programs that we obtained here at TinyCircuits for you! This means you don't need to calibrate anything yourself unless you feel like customizing what your readings mean, or if you feel you can make them more accurate. If this is your first time using the Soil Moisture Wireling, then you can skip this step and you're done!
Before starting any kind of calibration, make sure your sensor is dry, clean, and that you don't touch the sensor with your fingers during the process.
There are two ways to calibrate your sensor if you are using our code, with the TinyScreen's screen or using the Arduino IDE serial monitor. Both methods are separated below. Method one uses the screen and method two uses the serial monitor, choose whichever fits your needs!
Method 1: Calibrating the Soil Moisture Wireling using the TinyScreen+ screenOn the TinyScreen+ board press the button directly beside the power switch. The screen will then display: "Hold sensor in AIR and press any button (hold by wire only)." After pressing a button it will take some readings and then display them to you. The next instruction displayed will say "Submerge sensor in WATER and press any button." Submerge the Soil Moisture Wireling in a glass of water to just under the black microchip on the sensor (the position/level is shown below as a red line).
The sensor is coated so short circuits are not a problem but try not to let the water get above the chip and touch the tan 5-pin connector. After submerging it press any button and it will take some more readings and display the result like last time, calibration is done!
Method 2: Calibrating the Soil Moisture Wireling using the Arduino IDE serial monitorConnect your board to your computer, open the Arduino IDE, and then open the serial monitor from Tools > Serial Monitor. To start the calibration process enter the letter 'c' (press c then Enter) in the top input box marked below in red.
A line will be printed stating that the calibration process has started and then it will say, "Hold the sensor in the AIR and press any button or enter 'n' (hold by wire only)." Enter the letter 'n' while holding the sensor in the air. After taking some readings and then displaying the result you will be asked to "Submerge the sensor in WATER and press any button or enter 'n'." You will only need to submerge the sensor to under the black chip on the Wireling. The level to submerge the sensor too is shown above in the picture titled "Soil Moisture Wireling Calibration Submerge Level" in the method one section of calibration. After putting the sensor in water and entering 'n' it will take readings and display the result, you're done!
NOTE: If the message "The range is not big enough! Setting offset and range to defaults" appears, this means the sensor was not submerged in water. It will go back to using hardcoded values. This message will be shown when using any of the two methods of calibration above if anything goes wrong.
Comments