The Harry Potter Pumpkin is a social pumpkin that interacts with you based on proximity. From far away, he is sad and sits quietly with red eyes. If you move a little closer, his eyes change to green and he turns on the light from his magic wand. When you are REALLY close, his eyes change to blue, his wand lights up completely, and he hums the Harry Potter theme.
Final Video
Final Pumpkin
Parts used:
LEDs
RGB LEDs
8 Ohm mini speaker
mini photocell
Whats happening:
The photocell values dictate what the other components do. The largest value keeps the RGB LEDs (the eyes) red. The medium range changes the RGBs to green and lights the tip of the wand. The lowest range changes the RGBs to blue, lights up the entire wand, and plays the Harry Potter theme from the speaker. I looked up the sheet music for HP to compose the tune.
Testing out the circuit
I had to tweak my original concept, which was having the pumpkin shoot different spells the closer you approached it. The Twig sound recorder was so difficult to work with. I was able to record spells, but controlling it through the arduino was tough. The sounds kept looping instead of playing one at a time, so I decided to change my concept a bit.
If I could redo this project, I would use the sound shield, which seems to be easier to control with the arduino, so that the pumpkin will actually shoot spells.
CODE:
#include “pitches.h”
int analogPin = 4; //Set value for analog pin input from photocell into arduino
int red = 3; // If serial reads val <= 700, red will go HIGH
int green = 4; // If serial reads val >= 701 or val <= 825, green will go HIGH
int blue = 5; // If serial reads val >= 826, blue will go HIGH
int wand1 = 9;
int wand2 = 10;
int wand3 = 11;
int wand4 = 12;
int wand5 = 13;
int val = 0; // Store value of pin input (i.e. photocell) for serial to read
Reply