Angry Bird: Control Servo using Ultrasonic Sensor

Angry Bird: Control Servo using Ultrasonic Sensor
About This Project

This project will show you how to control a servo using an ultrasonic sensor by making an interesting Scratch Angry Birds project in PictoBlox

Project Info

Introduction

When the Angry Birds game was first launched it created a major hype. We’ve come a long way since the first game which is one of the most loved games. Could a popular game like this one be used for STEM learning? Turns out it can! Presenting to you the Scratch based Angry Birds project! An interesting servo motor project, it shows you how you can control a servo using an ultrasonic sensor by making an Angry Bird-like project. All you need for making this project is the evive Starter Kit and some other DIY material. And since this is a Scratch project, we’re going to code it in PictoBlox – a Scratch based graphical programming software with advanced interaction capabilities.

Ready. Set. Save the egg!

 

Components Required

Building Guide

Step 1: Taking the Cutouts

Before we start making our Angry Birds theme project, let’s first collect all the necessary cutouts that we need in our project.

  1. Take one cardboard and cut it in the dimension of 30 cm x 30 cm. This will act as our base upon which we will place our entire assembly of servo and ultrasonic sensor.Control Servo using Ultrasonic Sensor
  2. A small strip of the dimension 2.5 cm x 30 cm to place the servo and the ultrasonic.Control Servo using Ultrasonic Sensor
  3. And a small square of 15 cm x 15 cm to stick our angry bird to it.

Step 2: Assembling the Base

The main aim of this project is to show how can we trigger or control a servo motor using an Ultrasonic Sensor. The Angry Birds theme is to add an extra pinch of edutainment to your STEM learning.

Take the base sheet of the size 30 cm x 30 cm and place the strip at a distance of 10 cm away from the front edge. Glue the strip to the base using a Hot Glue Gun.Control Servo using Ultrasonic Sensor

Step 3: Attaching the Ultrasonic Sensor and the Servo

Now as the main aim of the project is to control the servo using an ultrasonic sensor, thus we need to add them into the project.

  1. Take the ultrasonic sensor and attach it on the red strip on one side of the base using Hot Glue.Attach the Ultrasonic Senor to Control Servo
  2. On the other side of the red strip, attach the servo motor using Hot glue.Conrol Servo using Ultrasonic

Step 4: Setting the Servo Angle

Now, to set the initial servo angle, we are going to use evive. Setting the servo angle has never been this easy. 

Just connect the servo to the Servo channel 1, switch ON evive, choose Controls, select Servo and then select Servo 1 from the option.

You can now change the servo angle using potentiometer 1 to 180 degrees. You can see the servo angle on evive’s TFT display.

Step 5: Making the Angry Bird and it’s Egg

  1. Now take a square cutout of 15cm x 15cm and glue the angry bird cutout on it. Cut the square cardboard in the shape of the angry bird. Scratch Angry Bird
  2. Now, as we need our angry bird to hit the person as soon as he/she tries to take the egg away. We will attach an ice cream to the bird. 
  3. At the other end of the ice-cream stick attach the servo horn as we need to attach it to the servo head.Scratch Angry Bird Scratch Angry Bird
  4. Now fix this entire assembly onto the servo head.
  5. Now, all we need is the Egg! Take the small cardboard piece and cut it in the shape of the egg and fix it on the base at some distance from the servo and the ultrasonic sensor.Scratch Angry Bird

With this, our entire assembly is completed.Angry Bird Control Servo using Ultrasonic Sensor

Step 6: Making the Connection

Now, we need to connect them to the microcontroller, evive is the one in our case. 

Control Servo using Ultrasonic ConnectionConnect 

  1. Servo to channel 1 i.e S1 of evive
  2. Ultrasonic sensor as:
    1. VCC  to 5V of evive
    2. GND to Ground of evive
    3. Trig to digital pin 2 of evive
    4. Echo to digital pin 3 of evive
evive Explore
Want to interface actuator and sensors to Arduino? Check out our Arduino with PictoBlox tutorials here.

Step 7: Writing the Code

As this is a Scratch based Angry Bird, we will be coding it in PictoBlox- a Scratch based programming software. Just drag and drop a few blocks and upload the code to your hardware:

Scratch code for Angry Bird

Also, Codeavour is live now! Participate for free and get a chance to win exciting prizes.

Step 8: Working of the Project

The HC-SR04 Ultrasonic sensor detects any intrusion occurring and sends a signal to the brain. The brain then sends the signal to the servo motor. 

Now, in this project, as soon as the intruder tries to steal the egg, the angry bird which is attached to the servo pricks the intruder. How exactly does our angry bird pricks? The initial servo angle is set to 180 degrees, now as soon as the ultrasonic sensor trigger the servo, the servo angle changes to 100 degrees. 

To find more servo motor project, click here.

 

Step 9: Conclusion

With this, your scratch based Angry Bird project is ready. Have fun!

Circuit Diagram

DescriptionCircuit Diagram

Connect 

  1. Servo to channel 1 i.e S1 of evive
  2. Ultrasonic sensor as:
    1. VCC to 5V of evive
    2. GND to Ground of evive
    3. Trig to digital pin 2 of evive
    4. Echo to digital pin 3 of evive

Code

DescriptionDownload Code
PictoBlox Program to Control Servo using UltrasonicDownload
Share this Project
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Featured Projects
All articles loaded
No more articles to load
Close Menu
×

Cart

Every New Project
is an exciting
Adventure!

Subscribe to our newsletter and go on an exciting project-making adventure with us every week.