This guide will show you how to make a robot that feeds a plant when it’s soil is dry.

It is aimed at children aged 7 and over, but under 10’s might want to ask an adult to help set up.

You will need…

To download a .pdf version of this guide click here.

 

s4a 01

An Arduino is a bit like a Raspberry Pi, it is a ‘computer on a chip’ but is different in two ways.

You can’t download different programs like Minecraft, Scratch or Firefox and run them on Arduinos. They don’t have an operating system with files, folders and windows like Raspberry Pis do.

s4a 02

You can’t control Arduinos with a mouse and keyboard in the same way that you can with a Raspberry Pi, you have to write special programs for it.

Arduinos are better at controlling powerful motors, lights and sensors than a Raspberry Pi is.

We are going to mix using the Arduino and the Raspberry Pi to get the best of both.

Setting Up

s4a 03

Before you boot up the Raspberry Pi, connect your Arduino to your Pi using a USB cable.

If you haven’t already installed the S4A firmware on your Arduino, open the Arduino app on your Raspberry Pi. Open the S4A firmware sketch and upload it, you can download the firmware sketch from here.

Connecting the Sensor to the Arduino

s4a 04

Connect your moisture sensor to it’s mini circuit board. It doesn’t matter which way round you connect this bit.

Connect the 3 wires from the sensors mini circuit board to your Arduino.

s4a 05

Connect ‘VCC’ on the sensor to ‘3.3V’ on the Arduino.

Connect ‘GND’ on the sensor to ‘GND’ on the Arduino.

Connect ‘AO’ on the sensor to ‘A0’ on the Arduino analogue pins.

Connecting the LED light to the Arduino

s4a 06

This is an LED light. It has a light at the top with two wires below to connect it to a circuit or an Arduino.

The long one is the positive, we connect that to the power source. The short end is the negative, we connect that to the ground.

s4a 07

Take your LED and place the long end in the ‘Digital 13’ pin in the Arduino and the short end in the ‘Ground’ pin.

Connecting the Servo Motor to the Arduino

s4a 08

Connect the red wire from the motor to ‘5V’ on the Arduino.

Connect the black wire from the motor to the ‘GND’ on the Arduino.

Connect the white wire from the motor to digital pin ‘8’ on the Arduino.

Programming the Motor to turn and the LED Light to shine when a plants soil is dry.

Open Scratch4Arduino.

Open the orange ‘Controls’ blocks.

Drag out an orange ‘When green flag clicked’ block.

s4a 0

Drag out an orange ‘Forever’ block and connect it to the orange ‘When green flag clicked’ block.

s4a 09

Open ‘Operators’

Drag out a green ‘>’ more than block and place it in the top slot of the orange ‘If Else’ block.

s4a 10

Open the blue ‘Motion’ blocks.

Drag out a blue ‘Value of sensor’ block and put it inside the 1st slot of the green ‘>’ more than block.

sens_led_motor_demo04

Type ‘50’ in the 2nd slot in the blue ‘Value of sensor’ block.

sens_led_motor_demo05

Open the blue ‘Motion’ blocks.

Drag out a ‘Digital on’ block and place it inside the 1st space in the orange ‘If Else’ block.

sens_led_motor_demo06

Drag out a ‘Digital off’ block and place it inside the 2nd space in the orange ‘If Else’ block.

These block test of the soil is too dry and then turn the power to the LED on if it is too dry.

sens_led_motor_demo07

Drag out a ‘Motor angle’ block and place it inside the 1st space in the orange ‘If Else’ block. Type ‘180’ in the number slot.

sens_led_motor_demo08

Drag out a blue ‘Motor angle’ block and place it inside the 2nd space in the orange ‘If Else’ block. Type ‘0’ in the number slot.

Use Knex or Lego to build a robot arm holding a small bottle or cup of water. Connect the arm to the motor and the sensor to your plant. Click the green flag to test your robot.

sens_led_motor_demo09

Testing

You will need 2 pots of soil, one pot should have dry soil, the other should be very moist.

Click the green flag on the top right hand side of the Scratch4Arduino display.

To test your robot, place the two prongs from your moisture sensor in the wet soil and then take the sensor out.

The servo motor should move and the led light should flash when the sensor is NOT in moist soil.

If this does not happen then you might need to change the number that you use for the ‘>’ more than comparison.

Experiment by using a bigger and smaller number in the 2nd slot of the green ‘>’ block. Test to see how the change in this number effects how dry the soil has to be to trigger the servo motor to move.

Once this is working, all you have to do is build a body & an arm for your robot using Lego, Knex or another construction kit.

Attach the servo to the robots body using tape, glue or velcro, then create an arm with a bottle or some other water holder.

Set the robot arm up so that when the soil is dry, the robot arm is programmed to move to an angle that pours water into your plant.

Advertisements