MagicRaven
This is our Halloween project, the MagicRaven, an automated raven that scares anyone who comes close enough…
Constructed with recycled cardboard for the full body parts (including the head), methacrylate combined with nuts and bolts for the internal structure, black spray paint and feathers, combined with the dry leaves on his floor leaves us with a project with real scary environment.
For the electronic parts, we used two servomotors for the head and wings respectively, as well as two red leds for the eyes, all this system comes to life when anyone comes by near enough to activate the ultrasonic sensor which is also connected to the arduino and is the ‘starter’ for our system.
Supplies
Here you can see some of the tools and materials we used in this project;
-Materials list:
- Recycled cardboard and egg-cups
- methacrylate
- Nuts and bolts
- Metallic ball joint
- Metallic sergeants
- Servo motors
- Wires
- Arduino board
- Ultrasonic sensor and red leds
- Feathers
- Black spray
-Tools list:
- Cutter
- Super Glue
- Regular white glue
- Pen
- Laser cutter
- Scisors
- Screwdrivers
- File
- Tape
TinkeraCad Schematic
Our electronics schematic for the arduino connections with the different sensors used in our project resumed and rendered on the page TinkerCad
Code
#include <HCSR04.h>
#include <Servo.h>
//We include the sensor and the servomotors from the library
const byte triggerPin = 6;
const byte echoPin = 5;
//We put 6 and 5 as input and output constants to the sensor
//triggerpin sends an ultrasound pulse (input) and the Echo (output) takes care of receiving it.
UltraSonicDistanceSensor distanceSensor(triggerPin, echoPin);
Servo myservo; // create servo object to control a servo
Servo myservo1; // create second servo object to control a servo
int pos = 0; // variable to store the servo position
int led1=8; //variable for my leds
int led2=7;
void setup() {
pinMode (led1, OUTPUT); pinMode (led2, OUTPUT);//we said that led one has and output in the position 7
myservo1.attach(10);// attaches the servo on pin 10 to the servo object
myservo.attach(11);// attaches the servo on pin 11 to the servo object
}
void loop() {
float distance = distanceSensor.measureDistanceCm();
if(distance<20){//if the distance is less of 20 cm
digitalWrite(led1, HIGH);//the leds turn on
digitalWrite(led2, HIGH);
delay(1000);// waits 1000 ms for the sensor for the sensor to tell you if the condition
//of being closer than 20 cm is still met and the light continues to turn on
for (pos = 0; pos <=180 ; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(5); // waits 5 ms for the servo to reach the position
myservo1.write(pos); // tell servo to go to position in variable 'pos'
delay(5);
}
for (pos = 30; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(5); // waits 15 ms for the servo to reach the position
myservo1.write(pos); // tell servo to go to position in variable 'pos'
delay(5);
}
}
else if(distance>20)//if the distance is bigger than 20 cm
digitalWrite(led1, LOW);//the leds turn off
digitalWrite(led2, LOW);
for (pos = 90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees =don't move
myservo.write(pos);
delay(5);// waits 5 ms for new orders
myservo1.write(pos); // goes from 180 degrees to 0 degrees =don't move
delay(5); // waits 5 ms for new orders
}
}
Downloads
Guide: How to Build It
- Cut the cardboard with the structural requirements we fitted (different forms and patterns of the raven)
- Put all the different parts together to form a 'case' for the mechanical parts
- Laser-cut with our dwg document the structural parts
- Put the laser-cut methacrylate parts together with bolts and nuts
- Insert the servo motors on the built in holes
- Connect the wings and head with metal bendable bars to the servos
- Create a 'base support' box with recycled wood to hide all the electronic components
- Connect the different sensors to the arduino board and try the code with what you have built
- Once the code is fine and all parts move and shine correctly, apply the cardboard case to the structure
- Paint everything visible in black
- Apply black feathers
- Apply the dryed leaves to the box (base support) floor
- Attach every sensor to its destination: Leds on the head (eyes)
- Try everything out, and enjoy your super scary automated Raven!
Conclusion
This project has been scary since the first day, but through hard work we made it. Starting with the arduino knowledge we had, he thought on what can be done for this project. Ultrasonic sensor, servo motors and leds, lead us to this raven idea which we made real.