When Wizzy guards the Halloween candy bowl at our house, I use an RC transmitter / receiver - which allows me to interact 'personally' with trick-or-treaters.
Electronically, Wizzy is pretty simple... two servos and an audio trigger.
This setup will perform a tail-wag, head movement, and offer a snarky comment. Make sure to use a 5V power supply that can provide a constant 2 AMPs or better.
You can use just about any Arduino compatible!
#include <Servo.h>
// head and tail servo objects
Servo head;
Servo tail;
// variables used to track the position of the head and tail servos
int hpos = 0;
int tpos = 0;
void setup() {
// attach head and tail servo to digital pins 9 and 10 respectively
head.attach(9);
tail.attach(10);
}
void loop() {
delay(5000);
// wag the tail back and forth - adjust range as needed
for (tpos = 0; tpos <= 180; tpos += 1) {
tail.write(tpos);
delay(15);
}
for (tpos = 180; tpos >= 0; tpos -= 1) {
tail.write(tpos);
delay(15);
}
delay(5000);
// rotate head left and right - adjust range as needed
for (hpos = 0; hpos <= 180; hpos += 1) {
head.write(hpos);
delay(15);
}
for (hpos = 180; hpos >= 0; hpos -= 1) {
head.write(hpos);
delay(15);
}
delay(5000);
// trigger random audio playback
analogWrite(0, -255);
delay(15);
analogWrite(0, 0);
}
Use these audio files if you like... the Audio FX board will randomly play one of them when Trigger 0 goes LOW.
So many ways to drive Wizzy... Bluetooth, PIR sensors, laser triggers, flex-sensors, vibration switches, Infrared, and accelerometers.
If you make your own animatronic pet, I would LOVE to hear about it!
Page last edited November 12, 2014
Text editor powered by tinymce.