+ All Categories
Home > Art & Photos > How to make a plant watering robot using Scratch4Arduino

How to make a plant watering robot using Scratch4Arduino

Date post: 15-Feb-2017
Category:
Upload: neil-winterburn
View: 182 times
Download: 0 times
Share this document with a friend
9
“Robots have taken over our school!” How to make a robot that waters a plant if it’s soil is dry You will need A computer or Raspberry Pi with s4A ‘Scratch 4 Arduino’ installed. An Arduino with the S4A firmware uploaded.
Transcript
Page 1: How to make a plant watering robot using Scratch4Arduino

“Robots have taken over our school!”

How to make a robot that waters a plant if it’s 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: How to make a plant watering robot using Scratch4Arduino

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 toj.

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

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

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

Page 3: How to make a plant watering robot using Scratch4Arduino

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 thepositive (+) sideways row at the bottom of the breadboard.

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.

Page 4: How to make a plant watering robot using Scratch4Arduino

Connecting the Soil Moisture Sensor

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

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.

Page 5: How to make a plant watering robot using Scratch4Arduino

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 flagclicked’ block.

Drag out an orange ‘Forever’ block andconnect it to the orange ‘When green flag

clicked’ block.

From the Looks drawer drag out a Sayblock and place it inside the Forever

block. From the Motion drawer drag out aValue 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.

Drag out an orange ‘If Else’ block andplace it inside the orange ‘Forever’ block.

Page 6: How to make a plant watering robot using Scratch4Arduino

From the ‘Operators’ blocks drawer dragout a green ‘>’ more than block and place itin the top slot of the orange ‘If Else’ block.

Open the blue‘Motion’ blocks

drawer.

Drag out a blue‘Value of sensor’

block and put itinside the 1st slot ofthe green ‘>’ more

than block.

Type the number‘50’ in the 2nd slot in

the blue ‘Value ofsensor’ block.

Page 7: How to make a plant watering robot using Scratch4Arduino

Open the blue‘Motion’ drawer.

Drag out a ‘Digitalon’ block and place itinside the 1st space in

the orange ‘If Else’block.

Drag out a ‘Digitaloff’ block and place

it inside the 2ndspace 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.

Page 8: How to make a plant watering robot using Scratch4Arduino

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

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 9: How to make a plant watering robot using Scratch4Arduino

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.


Recommended