10
PROTOTYPE SUMMER SCHOOL How to make a robot that waters a plant if its soil is dry You will need A computer or Raspberry Pi with s4A ‘Scratch 4 Arduino’ installed. An Arduino with the S4A firmware uploaded.

Prototype Summer School: How to make a plant watering robot

Embed Size (px)

Citation preview

Page 1: Prototype Summer School: How to make a plant watering robot

PROTOTYPE SUMMER SCHOOL

How to make a robot that waters a plant if its soil is dry

You will need

A computer or Raspberry Pi with s4A ‘Scratch 4 Arduino’ installed.

An Arduino with the S4A firmware uploaded.

Page 2: Prototype Summer School: How to make a plant watering robot

Breadboards

Breadboards can be used to connect wires, lights, sensors and motors together.

Columns go up and down and are numbered 1 – 30, with letters a to j.

If you connect two wires into the same numbered column they will be connected.

Page 3: Prototype Summer School: How to make a plant watering robot

Rows going sideways are used for either (+) positive or (-) negative.

If you place two wires in the same (+) or (-) row they will be connected.

Plant Watering Robot Schematic

LED

Take your LED and place the long leg in the ‘Digital 13’ pin on the

Arduino and the short end in the ground pin on the Arduino called

‘GND’.

Breadboard

Connect a red wire from the 5V pin on the Arduino to the 1st hole on the

positive (+) sideways row at the bottom of the breadboard.

Page 4: Prototype Summer School: How to make a plant watering robot

Connect a black wire from the GND pin on the Arduino to any hole on

the negative (-) sideways row at the bottom of the breadboard.

Connect a red wire from hole 20A on the breadboard to any hole on the

positive (+) sideways row at the bottom of the breadboard.

Connect a resistor to holes 20B & 20C on the breadboard.

Connecting the Soil Moisture Sensor

Connect the red ‘VCC’ to hole 20D on the breadboard.

Page 5: Prototype Summer School: How to make a plant watering robot

Connect black ‘GND’ wire to any hole on the negative (-) sideways

row at the bottom of the breadboard.

Connect white ‘A0’ wire on the sensor to the ‘A0’ Arduino pin.

Programming the Motor to turn and the Light to

shine when the soil is dry.

Open the orange ‘Controls’ blocks drawer.

Drag out an orange ‘When green flag

clicked’ block.

Drag out an orange ‘Forever’ block and

connect it to the orange ‘When green flag

clicked’ block.

From the Looks drawer drag out a Say

block and place it inside the Forever

block. From the Motion drawer drag out a

Value of Sensor block and place it inside

the Say block.

TEST: Click the green flag to test. Place the two prongs of the

sensor onto different materials and observe how the sensors

number changes. Test your hands, paper or a glass of water.

Page 6: Prototype Summer School: How to make a plant watering robot

Drag out an orange ‘If Else’ block and

place it inside the orange ‘Forever’ block.

From the ‘Operators’ blocks drawer drag

out a green ‘>’ more than block and place it

in the top slot of the orange ‘If Else’ block.

Page 7: Prototype Summer School: How to make a plant watering robot

Open the blue

‘Motion’ blocks

drawer.

Drag out a blue

‘Value of sensor’

block and put it

inside the 1st slot of

the green ‘>’ more

than block.

Type the number

‘50’ in the 2nd slot in

the blue ‘Value of

sensor’ block.

Open the blue

‘Motion’ drawer.

Drag out a ‘Digital

on’ block and place it

inside the 1st space in

the orange ‘If Else’

block.

Page 8: Prototype Summer School: How to make a plant watering robot

Drag out a ‘Digital

off’ block and place

it inside the 2nd

space in the orange

‘If Else’ block.

TEST: Click the Green flag to see what happens when the sensor is

place in wet and dry soil.

CHALLENGE: Create an algorithm that only lights the LED light if

the plants soil is dry.

How to make a robot arm water a plant if it’s soil is

dry.

Page 9: Prototype Summer School: How to make a plant watering robot

Connecting the Servo Motor

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.

Page 10: Prototype Summer School: How to make a plant watering robot

Programming the Servo Motor

Drag out a ‘Motor angle’ block and place it inside the 1st space in the

orange ‘If Else’ block.

This block tells the motor to move to an angle. We can tell it to move to

any angle. For now type ‘180’ in the number slot.

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.

TEST: Click the green flag to test your robot arm.

Hint: You might find it helps to insert a wait block in between the

Forever block and the If block so that your system only tests the soil

every 5 seconds.

Challenge: Use Knex or Lego to build a robot arm holding a

small bottle or cup of water. Connect the arm to the motor so

that it pours water into a plant pot without spilling. The system

should work by itself and should not spill any water.