In this tutorial you will be simulating the automatic watering of a plant by using a Kookaberry to process an input signal from an analogue sensor to turn an external device On and OFF
You will be using the WaterMe app which measures the moisture of the soil by the current flowing between the two prongs of a resistive soil moisture sensor. When the moisture falls below an adjustable threshold level. a control signal is sent to a relay which connects power from a separate battery to a 3v mini-pump. When the moisture level rises to above the threshold level, the pump is switched off.
Many learning outcomes across the curriculum can be mapped to the use of the WaterMe app Find out more→
Video Tutorial
This is a video of the WaterMe app using a capacitative sensor and an earlier version of the pump connection arrangements
Step 1
Connect a resistive moisture sensor to P4 to a Kookaberry and run the WaterMe app.
What is showing on the screen?
The screen is showing a histogram or “tank” icon which is used to show the strength of analogue signals - in this case the percentage of moisture in the soil.
Three zones are shown depending on the moisture measured - Dry/Moist/Wet. The algorithm turns the pump on when below the Moist threshold (ie, Dry); and Off when the Wet threshold is reached. Dry is set at below 25% moisture, and Wet at above 60%. Moist is in between…. The thresholds are indicated by horizontal lines on the tank.
The connectors for the sensor and pump are shown as P4 and P2 respectively
- Button C (Enbl) makes the pump operational at the start of the simulation.
- The indicator P (in the middle on the right) will show On if the sensor shows Dry (as it will at the start) and the pump will start running
- It will show Dis when it reaches the Wet zone. This stops the pump until it is enabled again. This feature allows the sensor to be removed from the wet soil (or container of water) without the pump starting again because the sensor thinks it is Dry.
- Press Button C again to start a new simulation.
- Button D (Sens) toggles between two different types of sensors - Resistive or Capacitive. You will be using the Resistive sensor - which is the default.
- Button B (Log) starts the data logging function which samples the measured data at an interval set in the Kappconfig file and then stores the data in the on-board USB memory. The sampling interval is shown at top right.
Step 2
Attach the relay to the connector board (this board avoids the requirement for bare wire connection). The wires go into the NO and Com terminals of the relay.
You will need a length of plastic pipe to attach to the pump; the pump; a USB/jst battery lead; and a battery.
Step 3
Plug the pump into the USB connector on the connector board; the battery into the jst connector; and the relay to P2 on the Kookaberry.
The pump is Off (because you haven’t pressed Button C yet…..) and you are now ready for the action step
Step 4
Get two glasses, and fill one with enough water to comfortably cover the pump. Put the pipe and the sensor into the empty one. The moisture level will be showing Dry.
Enable the pump by pressing Button B and the pump will begin filling the empty glass (simulating watering a garden bed or pot plant). It will stop when the water reaches the sensor and the screen will show Wet and P indicator will show Dis.
You can now return the water to the first glass and start another simulation by pressing Button B
Data logging
This is the logged data measured when the Kookaberry and pump were used to water a plant in a pot filled with fine gravel and sand