Enginesday: Last-Minute Halloween


It’s the day before Halloween, and we’ve moved up our weekly Enginursday post to give you time for some final pre-treat tricks. If you’re like me, you haven’t started getting ready for the occasion. While you don’t have time for anything extravagant like a multicopter ghost, I have a few ways to add electronics to your decorations this year. Most of these are super simple, as I had thrown them together in years past right after getting home from work on Halloween. So get out that box of extra parts (or maybe overnight shipping if you’re desperate).

The first idea is a pretty obvious one; LEDs in the Jack-O-Lanterns. Don’t get me wrong, I love the flicker of a flame, but there’s some pretty cool tricks you can do with LEDs. Different color light is only the beginning when it comes to using LEDs. Add an Arduino and you can add different blinking and fading patterns like the flickering of a candle (kind of counter productive, but it might be a safer option, especially if you have it indoors). One year I used the Arduino fade sample sketch to simulate a breathing pattern which turned out pretty neat. My favorite is a pretty simple option of a breadboard, a CLR, a LiPo battery, and a few (I usually use about five) of our cycling LEDs. This creates an awesome multicolor effect, as the LEDs rarely cycle in the same color order.

Cycling Color LEDs in Jack-o-Lantern

Along the same lines as the LED option, EL material works great with pumpkins and similar decorations. If you check out our EL section, you’ll find a ton of products that work well for decorations. The pumpkin below was made using two strands of our EL wire and a simple battery pack inverter.

Pumpkin with EL Wire Face

One project I’m trying this year is to make the candy bowl a little more interesting. My first thought was to do something wild like attach a larger motor with an unbalanced weight to the bowl. When people would reach their hand in to grab the candy, it would start rocking violently sending the candy flying everywhere. The more I thought about it, I’d rather not have go cleanup candy every two seconds. However, the rustling of the candy bar wrappers in a bowl can be pretty unnerving on its own. So a few of our vibration motors should be enough.

For the motion detection, I only need to know when a hand is present. It doesn’t need to know how close the hand is, just that something is there. So for this, we’ll just use the PIR motion sensor. If you want to get a little fancier, you can go with one of our ultrasonic sensors and have the vibration get stronger the closer you put your hand to the bowl.

Now, in the spirit of last minute and the fact that I do want to use these parts for another project at a later date, I’m going to breadboard the project rather than making something more permanent. Also, of all the parts needed for this project, I couldn’t find a bowl to use in a timely manner. So we’re going to use the inside of the EL pumpkin instead. The plus side of this is that it’s an especially deep bowl and with the overhang at the top, it should cut down on false triggers for the PIR sensor.

Electronics for the Motion Trigger

Thanks to the work of Learning about Electronics and bildr, the hard parts of hooking up the vibration motors and the PIR Sensor are a breeze. Since the vibration motors just need to be on or off, I used a 3.3v Regulator for the vibration motors rather than the more complex (and more proper) circuit layout detailed by Learning about Electronics. In addition, each provided stellar sample code, so it was just a case of combining and modifying the code to work for us. The weird delay pattern allows for the motors to run for five seconds, then wait another five seconds before it’s ready to go again.

// This Sketch is released under Beerware License (freeware). If you like what you see here, buy me a beer or some other food or beverage. I am easy to please.
// This sketch is provided as is with no warranty or additional information.
// Additionally; use, change, and share as you please.
// Parts of this sketch are released under the MIT license and created by bildr. The original can be found here: http://bildr.org/2011/06/pir_arduino/
// Other parts were provided by Learning about Electronics (released under no license) and can be found here: http://bildr.org/2011/06/pir_arduino/
// 
// Both provide excellent hookup diagrams for the parts needed. If you feel the need to exercise the above parts of the beerware license, please consider these people first. 



int pirPin = 2; //digital 2
int vibonePin = 3; //digital 3, Vibration motor 1
int vibtwoPin = 4; //digital 4, Vibration motor 2

void setup(){ 
 pinMode(pirPin, INPUT); //Set the Pin Modes
 pinMode(vibonePin, OUTPUT);
 pinMode(vibtwoPin, OUTPUT);
}


void loop(){
  int pirVal = digitalRead(pirPin);

  if(pirVal == LOW){ //was motion detected
    digitalWrite(vibonePin, HIGH); //turn on vibration motors for 5 Seconds
    digitalWrite(vibtwoPin, HIGH);
    delay(5000);
    digitalWrite(vibonePin, LOW); //turn vibration motors off, wait 5 seconds
    digitalWrite(vibtwoPin, LOW);
    delay(5000); 
  }
  else{
    digitalWrite(vibonePin, LOW); //if no motion, keep vibration motors off
    digitalWrite(vibtwoPin, LOW);
  }
}

To maximize the vibration, I was going to cut two slits into the pumpkin to insert the vibration motors. Turns out, pumpkin is the material we should be using to dampen vibration on the next generation of space shuttles and won’t amplify the vibration at all. Luckily (and this will sound cliché, but I totally had one) I had an extra mint tin sitting on my desk and attached the vibration motors to that. This gave me a large, free floating, vibrating mass to put in with the candy. It also added a great metallic noise to the vibration.

Mint Tin Vibration Mass in the Pumpkin

In the end, the project worked great and didn’t cost a lot ($29, assuming all you had was the Arduino). I unfortunately didn’t have time to get a video of it in action, but I’m sure I’ll be doing a quick tutorial on it for learn.sparkfun.com and I should have a video setup for that.

If you guys have any other projects or ideas like these, please share them in the comments. Halloween has so much DIY potential and I always love to see what people are doing with electronics.

Finally, I feel I owe you guys an apology. I mentioned on Adafruit’s Ask an Engineer that we would be stocking a product called ELastoLite and that it would be ready for Halloween. Unfortunately, the documentation is taking a little longer to get together than we had anticipated, but it should be available shortly. The plus side is it gives you ample time to figure out how you could use it for next Halloween.


Comments 19 comments


This Week

This Month

Heartbleed

Happy Arduino Day!

SXSW Create 2014