Frankenbot With Sound Effects and Lights
by snorlaxprime in Circuits > Arduino
1228 Views, 2 Favorites, 0 Comments
Frankenbot With Sound Effects and Lights
I was inspired by the cute Frankenbot papercraft, so I thought why not make it truly alive by giving it some blinking lights and sounds effect. Here is the plan:
- Connect 2 LEDs for the eyes (different colours of course) and only one eye can be on at a time
- Connect 3 LEDs to the chest so that it can run lights left and right
- Play some scary halloween music for the full effect.
So here goes my Frankenbot ready for Halloween.
Create Your Cute Frankenbot
Use the following instructables to make your own Frankenbot. I used normal paper and stick it to thick cardboard like cereal boxes before cutting it out, so it is more sturdy.
Cut Out the Eye Holes and Insert LEDs
Cut out the eye to make holes for LEDs, I use two different colour to give it more dramatic effect. It is made from recycled LEDs that I join together with one 220 ohm resistor. I connect different legs to the same resistor so only one eye will be on at a time, and you have to switch the polarity to light up the second eye.
Connect the Head to the Body
Wire up the LED using wirewrap cables, this is very tiny and can be slipped in to the slit holes on the neck quite easily. In this photos you see I slip the cables through the holes to the body.
Preparing the Chest Holes
Cut out 3 more holes on the chest. It is much easier to cut it out when you had the robot chest disassembled. the second photos, show the hollow chest ready for LED insertion.
Prepare the Electronics
I used my previous circuit that I built for "Light Activated Valentine Gift" and also the completion of the code here. I had included the circuit here for completeness.
For simplicity, I won't repeat the steps to build the light activated circuit here. Things to note, the way the light activated will need to be reversed, in this we want the Frankenbot to stay idle when there is sufficient light detected by the sensor, and when the light is off, it will came alive blinking it's eyes and the chest lights and also playing the horror music at the background. So minor modification to the source code is necessary.
Connecting the LEDs
What I had done here is essentially as follows:
- Eyes is connected through pin D2 and D6
- Chest LEDs is connected through pin D3, D4 and D5
So the following additional modification to the code is necessary
You can use the music that I had included or find other music in youtube or create your own.
const int LDRpin = A0; // LDR connected to pin A0<br>const int EyeCommon = 6; // low = off const int Eyepin = 2; // Eye LED pin D23 const int Chest1 = 3; const int Chest2 = 4; const int Chest3 = 5;
It's ALIVE!!
There are several final modification to the code is necessary as follows:
In the setup section add the following:
pinMode(LDRpin, INPUT); // setup LDR
pinMode(EyeCommon, OUTPUT); pinMode(Eyepin, OUTPUT); pinMode(Chest1, OUTPUT); pinMode(Chest2, OUTPUT); pinMode(Chest3, OUTPUT); mp3.playFolderTrack(7,Song);
in the loop section add the following:
if (ldrStatus <300){
//digitalWrite(LED_BUILTIN, LOW); digitalWrite(EyeCommon, LOW); // eye LED had different polarity so that digitalWrite(Eyepin, HIGH); // only one eyes can be on at one time delay(100); digitalWrite(EyeCommon, HIGH); digitalWrite(Eyepin, LOW); timeoutTimer ++; //Serial.print("LED Light"); if (DEBUG) Serial.println(timeoutTimer); mp3.start(); digitalWrite(Chest1, LOW); // chest LED had common cable connected, digitalWrite(Chest2, HIGH); // my common cable is connected to Anode, digitalWrite(Chest3, HIGH); // so EyeCommon needs to be HIGH delay(100); digitalWrite(Chest1, HIGH); digitalWrite(Chest2, LOW); digitalWrite(Chest3, HIGH); delay(100); digitalWrite(Chest1, HIGH); digitalWrite(Chest2, HIGH); digitalWrite(Chest3, LOW); delay(100); digitalWrite(Chest1, HIGH); digitalWrite(Chest2, LOW); digitalWrite(Chest3, HIGH); delay(100); onStatus = true; if (timeoutTimer > 200) { if (DEBUG) Serial.println(timeoutTimer); timeoutTimer = 0; resetCount = 0; } }
The section above is when the light intensity is low, so we flicker the eyes LED and the chest LEDs. The following section is when the light is high, we only have one eyes turned on.
} else {
digitalWrite(EyeCommon, LOW); digitalWrite(Eyepin, HIGH); digitalWrite(Chest1, HIGH); digitalWrite(Chest2, HIGH); digitalWrite(Chest3, HIGH); mp3.pause(); timeoutTimer ++; }
And don't forget to upload the scary scene music to the sd card. In this example I put it in the folder "07" and the song is called "001.mp3"
Now upload the code and test it, if all goes well, when you flick the switch your Frankenbot will come alive. Cover the sensor or turn off the lights, it's eyes should flicker and the chest LED will flicker too.
Enjoy and Happy Halloween!!!