Āé¶¹“«Ć½

Electronics projects for beginners: Make an automatic plant waterer

Learn to make a simple automatic watering device that will ensure your plants never go thirsty again

Plant waterer
David Stock for Āé¶¹“«Ć½

YOU have gone seven days with a moody plant after we left it complaining last week. Now we can give it both the means and a reason to be happy.

First, tweak your code to show a smiley face when the plant’s conditions are good. Open your code in the editor – now the variables we created last week will come in handy. Take another ā€œifā€ block with no ā€œelseā€ part, and snap it under the first two. Then slot in a ā€œ\<\> and \<\>ā€ block from the ā€œLogicā€ menu, and two ā€œ0 = 0ā€ comparisons. Slot the ā€œ0 = 0ā€ blocks either side of ā€œandā€.

Next, take your variables, DRY and WRONG TEMP, as well as two ā€œfalseā€ blocks from the ā€œLogicā€ menu and make a line that says ā€œif DRY = false and WRONG TEMP = falseā€. Nestle a ā€œshow iconā€ from ā€œBasicā€ inside the ā€œifā€ block and select the smiling face.

Now it is time to build an automatic waterer to stop your plant drying out. For this we need a transistor. A transistor can act like an electronic switch. It has three legs, two of which are connected or not depending on the current going into the third.

Grab your breadboard (for a refresher, see ā€œHow to be a makerā€œ, 25 May), and place the transistor so its legs each sit in different rows. Connect the middle leg, called the ā€œgateā€, to pin 1 on the micro:bit. On my transistor, when the flat side is facing me, the right leg is the ā€œdrainā€ and the left is the ā€œsourceā€. Yours will probably be the same, but check the packet to be sure. Connect the drain to the pump’s ground wire, which should be white, and the source to micro:bit’s ground. Connect the pump’s red power wire to micro:bit’s 3v pin.

Now, when the micro:bit sends a 1 to the transistor’s middle leg, it will complete the circuit, while a 0 will break it. This lets us switch the pump on and off.

Let’s add to our code to do this. From the ā€œPinsā€ menu, grab a ā€œdigital write pinā€ and select P1 from the drop-down. Leave the 0 at the end and clip the block into ā€œon startā€. This will make sure that the pump is off to begin with.

Next, under the block that says ā€œset DRY to trueā€, add another ā€œdigital write pin p1ā€, but this time change the 0 to a 1. Underneath that, slot in a ā€œpauseā€ from ā€œBasicā€ and select 2 seconds from the drop-down. Add another ā€œdigital write pin p1ā€ underneath, leaving the 0 in the box. This will switch on the pump for 2 seconds then off again when the soil is dry. Add one final ā€œpauseā€ below, typing in 10,000. This makes the system wait 10 seconds for the water to percolate. Once again, if you get stuck, online.

Finally, put the pump in a bowl of water and attach a length of tube between it and the plant pot. And you’re done! Now you can go on holiday and return to a happy houseplant.

To download a printable version of this page click here


New stuff you need

For next week

Old smartphone

Phone stand


Next in the series

1 Moisture-sensing plant

2 Moisture and temperature-sensing plant

3 Plant auto-waterer

4 Tweeting wildlife camA motion-controlled animal spotter

5 Pest scarer

6 BBQ thermometer

7 Rain alarm

8 Mini weather station

9 Remote controlled pest-proof bird feeder part 1

10 Remote controlled pest-proof bird feeder part 2

Email: maker@newscientist.com

Topics: Electronics / Plants