Soil Moisture Monitor LED Arm Warmer

by ghostbirding in Circuits > Arduino

822 Views, 14 Favorites, 0 Comments

Soil Moisture Monitor LED Arm Warmer

20230502_053028.jpg

I wish most of all for a green thumb. Oh, how wonderful to be surrounded by green, to share one's space with photosynthesizing wonders!

But I have a ridiculously hard time taking care of beings who cannot tell me with large movements or loud noises that they are thirsty.

This project resulted from me asking how I might be able to use technology to further develop my relationship with, attention to, and awareness of the plants over which I have responsibility. It all started on the day I moved into the college dorms my senior year at the University of West Florida. After hauling all my boxes in, I took a moment to pull away the window blinds and see my view. Straight done on the ground, about a foot away from the brick wall, was a long row of small blackberries! I checked online and, sure enough, they had been planted by the Argos Edible Campus Program (https://storymaps.arcgis.com/stories/71c17860449744e68a01fd2105d31f62). The poor things were dry. It turns out that there had been a miscommunication. The blackberries were supposed to be included in a pre-established campus greenspace watering regimen, but the sprinklers did not actually reach the planting beds! I got involved in the Edible Campus Program and have been making sure the blackberries stay watered regularly ever since, which has been one of the greatest joys of my past year. But there have been times when I have gotten very busy, and I have forgotten to check on them for a few days...

Following the steps I've put together here will produce a crocheted arm warmer adorned with LEDs that are controlled by nearby real-time soil moisture measurements. Unfortunately, this design is not waterproof, and I cannot use it with the outdoor blackberries. However, it has helped me forge a deeper connection with my dear little indoor succulent (whose species I don't know because they sprouted from fallen leaves and stems I gathered from the floor in Walmart).

It is a two-part system. The first part measures the soil moisture level using capacitance and transmits it as analog data over a radio channel. The second part receives the data, calculates the moisture percentage using calibration constants, calculates a color that represents the moisture level, and displays this color across a string of addressable LEDs.

The most challenging aspect of this project was finding examples and libraries with the exact functions I needed, especially for the transceivers. I found sample code and support from the libraries I include links to in this project as well as (https://www.makerguides.com/capacitive-soil-moisture-sensor-with-arduino/), (https://iotdesignpro.com/projects/arduino-uno-with-nrf24l01-send-and-receive-temperature-and-humidity-data-wirelessly), and (https://projecthub.arduino.cc/Heathen_Hacks-v2/cb4f3fe4-0f25-492c-accb-c9effb05b7e7).

Supplies

Two Arduino Uno clones

  • Can be one of many reputable manufacturers
  • One of mine was from the Elegoo Uno Super Starter Kit (https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4), which is an excellent starter kit for beginner Arduino users with a wide array of simple sensors and components. The other Uno I used was from a previous, smaller kit.
  • You can purchase a starter kit, but it is perfectly fine to order just the Arduino Uno clones individually as long as they come with the USB cables needed to connect them to your computer (https://www.amazon.com/ELEGOO-Board-ATmega328P-ATMEGA16U2-Compliant/dp/B01EWOE0UU/ref=sr_1_5)

One Arduino Uno Prototyping Shield

  • This will be used to make the receiver-LED system compact. The transceiver will be soldered directly onto the Shield, and capacitors will be added for both the transceiver and LEDs.
  • The one I used in this project was the one that came in the Elegoo Uno Super Starter Kit (https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4)
  • There are similar shields that will work just as well for this project; just make whatever you order is described as compatible with Arduino Uno (https://www.amazon.com/Gikfun-Prototype-Shield-Arduino-Ek1038x3/dp/B00Q9YB7PI/ref=sr_1_5) or (https://www.amazon.com/Adafruit-Proto-Shield-Arduino-Kit/dp/B00N426HCG/ref=sr_1_19)

Two functioning NRF24L01 + 2.4 GHz Wireless RF Transceivers

  • I HIGHLY recommend buying double the number you need. It is very easy to burn these out by accidentally connecting them to the wrong power supply.
  • I found a good deal on these (https://www.amazon.com/dp/B00O9O868G)
  • Each module is capable of acting as a transmitter AND/OR a receiver using wireless communication. There are many other projects you can do with these, and I highly recommend looking further into what other people are doing!

One functioning Soil Capacitive Moisture Sensor

  • It is highly recommended to buy one or two extra sensors in case the first is defective or is damaged during project assembly.
  • It is preferable to use a capacitive moisture sensor rather a resistive sensor because it is much more durable and will not oxidize as quickly.
  • The one I ordered works but seems rather finicky (https://www.amazon.com/dp/B094J8XD83 )
  • Adafruit makes another version of the component and offers more detailed information (https://www.adafruit.com/product/4026)

One strand of Addressable LEDs, cut to the length of your forearm diameter

  • The most popular addressable LED strip is Adafruit Neopixel, and their site has extensive programming resources (https://www.adafruit.com/category/168)
  • However, you can work with any strip in the WS2812B format

Two breadboards

One medium shrink tube and one large shrink tube

Three 100MicroFarad capacitors

One 330ohm resistor

22 AWG Solid-Core Wire, recommended to have at least six different colors

Two Power Supplies

  • I used a wall-plug-in power supply (https://www.amazon.com/NorthPada-Portable-Turntable-Elliptical-Exercise/dp/B06XXQ1D71/ref=sr_1_2) for the sensor-transmitter system
  • I used a 9V battery for the receiver-LED system (https://www.amazon.com/DZS-Elec-Connector-Experimental-5-5x2-1mm/dp/B07FDS11ZY/ref=sr_1_3)

Jumper Wires

  • Fourteen male-to-female jumper cables, preferably in seven assorted colors
  • Eight male-to-male jumper cables
  • https://www.amazon.com/Elegoo-EL-CP-004-Multicolored-Breadboard-arduino/dp/B01EV70C78/ref=sr_1_5

Safety Glasses

Soldering Station

  • Be prepared to solder electronics with an iron, stand, solder, sponge, pliers, wire cutters, and a safe surface on which to work.
  • I use an inexpensive soldering kit which should contain all necessities other than safety glasses (https://www.amazon.com/dp/B07Q2B4ZY9/)

Small ball of medium-weight yarn

One 4-5mm Crochet Hook

Install Libraries

installing libraries in ide.png

Once you have gathered your supplies, your next step is gathering the code and libraries you will need to use for this project. If you have never used the Arduino IDE before, install the most recent version from (https://www.arduino.cc/en/software) and follow the setup instructions. Make sure you have the IDE set up to communicate properly with your UNO boards. A brief tutorial on this can be found at (https://www.tutorialspoint.com/arduino/arduino_installation.htm).

The two libraries needed for this project can be installed from within the the Arduino IDE using the Libraries Manager tab (circled in pink). Then, make sure "all" libraries are selected in the filters, and search the terms for each library. Search for "adafruit neopixel" and install the one by Adafruit, which should be near or at the top of the results. Search for "NRF24L01" and install the library titled RF24 by TMRh20; for this, you will likely need to scroll down a little.

If you are not able to access these libraries through the IDE, you can also download them from the internet and add them to the IDE as ZIP files. Find the LED library at (https://github.com/adafruit/Adafruit_NeoPixel) and the NRF24L01 library at (https://github.com/nRF24/RF24).

Assemble Components on Breadboards

extended-roots-sensor-transmitter_bb.jpg
extended-roots-receiver-leds-breadboard_bb.jpg
20230427_092211 (1).jpg

Now here comes the really tedious part. Enlarge the images I've attached to this step and, using jumper cables, copy the exact wiring I have illustrated using Fritzer.

BE CAREFUL TO ONLY CONNECT THE NRF24L01 COMPONENTS TO 3.5V. DO NOT CONNECT TO 5V. Doing so will burn out your components (I say as I look at the original three I "couldn't get to work," having not read the instructions closely enough)!

Additionally, take a close look at the wiring order for your soil capacitance sensor and addressable LEDs, as it can differ between manufacturers. In the Fritzing diagram for the receiver-LED system, the small 3-pin header represents the end of your LEDs, as the program did not have WS2812B in a manner I could insert it.

If you are having trouble wiring the NRF24L01 transceivers, the reference site for the RF24 library has some helpful diagrams and tables on the bottom of its home page (https://nrf24.github.io/RF24/index.html).

Run Code & Test Components

code windows side by side.png
testing LEDS.jpg
20230427_092211 (1).jpg
20230423_224906.jpg

Next, you'll download the sketches I built for this project and run them. I have attached these as both Arduino files (which should automatically open in the IDE) and .txt files (which can be opened in Notepad and easily copied into Arduino sketches), in case one version does not download properly.

Once you have downloaded both, open them side by side on your monitor. Set your sensor-transmitter system on one side of your computer (left, in these images) and your receiver-LED system to the other side (right, here). Connect just the sensor-transmitter system to your computer using the USB cable. Connect the window holding the sensor-transmitter code to that Arduino board, carefully noting the name and location of the port, and upload the program. Open the Serial Monitor. There should a line written that shows a number once a second. If this does not occur, check all connections between the Arduino and the sensor, as it should be receiving and writing data for it. If this still does not fix the situation, you may have a faulty sensor; try plugging in a different one. You may need to reset your Arduino using its on-board reset button. Leave that Arduino connected to that port.

Next, plug in the receiver-LED system into another port on your computer. In the receiver-LED code window, connect to the newly-plugged-in Arduino, being careful which port you select, and send the code to the receiver-LED system. Open the Serial Monitor in this window as well.

Watch the Serial Monitor for both systems. Both systems should be writing a line once a second that displays the analog data from the system. If the sensor-transmitter side is writing this data but the reciever-LED system is not, the problem lies within the transceiver connections. Carefully check all transceiver wiring for both systems. It is possible one of them may be defective; try other transceivers you ordered with them.

At this same time, the LED strip should be on and bright. If it is not, double check all wiring and connections between the strip and the Arduino and breadboard.

Soldering Receiver-LED System

extended-roots-reciever-leds-protoshield_bb.jpg
20230502_030136.jpg
20230502_030120.jpg
20230502_030230.jpg
20230502_030201.jpg

Once you've gotten all your components to work together properly, you'll need to make the receiver-LED system more compact and durable so it can be worn. This will be accomplished by arranging and soldering all components onto the Prototyping Shield, which is made to directly fit onto the Arduino Uno.

The connections seen in the Fritzing image here are exactly the same as when it took place on a breadboard, but they have been rearranged to fit compactly onto one of the popular ProtoShields. You can also see that this is actually different from one I built, as I had a different ProtoShield. Either will work. Your arrangement can be flexible as long as the correct connections are made, so be sure to take note of which color wire is being used for what function and do not allow for inappropriate bridges.

Like in the first Fritzing sketch, the small three-pin header here represents the end of the LED strip. You will need to solder wires to this, following the labeling on the strip and being sure to do so at the correct end for the data and power to flow throughout the strip.

Once you have soldered the components to the ProtoShield, carefully attach the shield to the Uno by aligning the headers and pins of each and pushing the shield all the way down onto the board. Be careful to arrange the LED strip wires in such a way that they will not be caught between the headers as you connect these.

Once you have finished soldering these pieces together, plug both the sensor-transmitter system and receiver-LED system back into your computer, with each communicating with their respective Arduino sketch windows. Verify using the Serial Monitors that the receiver-LED system is still receiving and writing the analog data sent by the sensor-transmitter system, and make sure the LEDs are turning on in response. If all of these systems were working before and are not any longer, something almost certainly went awry during the soldering process. While leaving both systems plugged in, press and jiggle various wires and connects on the ProtoShield and LEDs; if doing so changes the system's behavior, pay special attention to those places. Unplug the receiver-LED system and thoroughly check all connections, wiring, and soldering. Repeat until the system communicates properly once more.

Crochet the Arm Warmer

20230502_033523.jpg
20230502_033725.jpg
20230502_034134.jpg
20230502_040708.jpg
20230502_042744.jpg
20230502_043229.jpg
20230502_044652.jpg
20230502_050052.jpg
20230502_050301.jpg
  1. Crochet a chain of 27 stitches.
  2. Turn work. Skip first two chains, then double crochet in every chain across (25 stitches total).
  3. Turn, chain 2, double crochet in every stitch across (25 stitches total, with first 2ch counting as one stitch).
  4. Repeat step 3 until the work is wide enough to wrap loosely around your wrist and forearm. For me, it was fifteen rows.
  5. Chain three, skip the first three stitches, then double crochet in each of the next 14 stitches. Then, for seven more rows, repeatedly turn, chain 2, double crochet in each of the next 14 stitches.
  6. Fold this tab over and sew to main piece to form a pocket.
  7. Insert the Arduino and battery. Thread the LED strip through pocket as shown.
  8. Fold over sleeve and sew along edge to form a tube, leaving the stitches 5-11 (counted from the end far from the Arduino) open for the thumb.
  9. Carefully fit through your arm, plug in, and adjust the LED strip as desired.

Calibrate Soil Moisture Sensing

20230502_053007.jpg
20230502_053142.jpg
20230502_052938.jpg
calibrate sensor.png

Connect the receiver-LED system to the computer and open the Serial Monitor. Plug in the sensor-transmitter system.

Place the sensor into a glass of water. Watch the serial monitor, and replace the WaterReading constant with the value reported. The LEDs should be bright blue.

Remove the sensor from the water and dry it off. Dangle it in the empty air, being careful not to let it touch anything and making sure it is clean. Watch the serial monitor, and replace the OpenAirReading constant with the value reported. The LEDs should be an orange or red color.

Now, when you place the sensor into your plant's soil, it should show a color whose hue indicates the relative moisture level, with blue being waterlogged, green being moderate, and red being dry. When you are satisfied with your calibration, you can unplug the receiver-LED system from the computer, power it up with the 9V battery, and call it a day!