Introduction: Moving Raven (that Breathes Fire!)
For a school project in which we could use an arduino to make whatever we wanted, I made this moving raven robot that breathes ''fire'' if you make a lot of noise! If you ever want to recreate this project, say, to make a cool halloween prop or just for fun, here's an easy guide to do it! Naturally this is a project with a lot of freedom. I made a moving raven, but why not make a dragon? or a chicken? or something entirely different? For this project I'll be working with servo motors to make moving wings, so as long as your subject can fly, anything goes!
Step 1: Assemble Materials
Sadly, I forgot to take a picture of all my materials, but this is what you'll need if you want to create a moving, firebreathing creature.
(1x) Arduino Uno
(1x) Breadboard
(1x) Yellow LED
(2x) Orange LED
(2x) Red LED
(5x) 220 ohm Resistors
(20x) Jumper wires
(1x) Grove Sound Sensor
(2x) Servo Motor SG90
Step 2: Setup
This image shows the setup of the project. (I didn't have a sound sensor in fritzig, but this motion sensor has the same wires, so let's just pretend)
The cirquit should be setup as followed:
- Both red LEDS should be connected to pin 1
- The three firebreathing LEDS (2x orange, 1x yellow) should be connected to pin 5
- The two servo motors should be connected to pin 9 and to 5 volts
- the Grove sound sensor should be connecter to analog pin A0 and 5 volts
- All LEDS need a 220 ohm resistor between the positive side of the LED and the wire leading to their respective pins
- lead a black wire from the negative channel of your breadboard to the GND pin on your arduino and connect all negative sides of your LEDS and black/brown wires from your servo motors and sound sensor to this channel
Step 3: Code
The setup is finished, it's time to code your Arduino!
It's a fairly easy code, there's just one kind of strange thing about it. While I was making this project I noticed my servo motors were messing up my serial monitor whenever I attached them. Apparently this was due to the delay I added to my code. With some help from others I managed to bypass said delay. Your wings might not be as smooth now, but you can add some cool animation in it! I made my wings go up and down unevenly, kind of like a parabole, for a more realistic animation.
#include
Servo servo;
unsigned long previousMillis; byte servoSweep = 0;
int eyePin = 1; int firePin = 5; int audioPin = A0;
int value = 0; int loud = map(value, 0, 1023, 0, 255);
void setup(){ servo.attach(9); Serial.begin(9600); pinMode(audioPin, INPUT); pinMode(firePin, OUTPUT); pinMode(eyePin, OUTPUT);
digitalWrite(eyePin, HIGH); //red glowing eyes will always glow }
void loop(){ //this is where I read a value from the serial monitor to decide when my firebreathing leds will glow. value = analogRead(audioPin); Serial.println(value);
if (value > 750) { digitalWrite(firePin, HIGH); } else { digitalWrite(firePin, LOW); }
//delays were messing with my sound sensor, so I asked some students to help me come up with an alternative //they found a way for me to make the wing movement in small parts //I'm trying my best to make it look somewhat smooth, but at least it's working! if (millis() >= previousMillis){ previousMillis = previousMillis+300; servoSweep = servoSweep +1;
if (servoSweep == 7){ servoSweep = 1; } } switch (servoSweep){ case 1: servo.write(20); break; case 2: servo.write(40); break; case 3: servo.write(60); break; case 4: servo.write(70); break; case 5: servo.write(80); break; case 6: servo.write(70); break; case 7: servo.write(60); break; case 8: servo.write(40); break; } }
Step 4: You're Done! or Are You...
This is the end of the technical part of the project! If you've done everything properly and downloaded the code to your Arduino, all respective parts should move, glow or react to the sound of your voice. Now this little pile of wires and LEDs is nothing yet to look at, here's where your creative mind comes into play. It's time to assemble your bird! Any light material for the body and wings will do. I used a combination of foam, triplex and worble. The wings were made of painted paper, as I was afraid the servo motors wouldn't be able to carry them otherwise. It's all up to you what your creature will look like!
Have fun creating!