Magic 8-Ball Pumpkin

Overview

The Magic 8-Ball Pumpkin was my 2012 entry in the Rosenwinkel pumpkin carving competition (which only John and I know is a competition at all).  John has won the last few with some pretty awesome pumpkins.  My entry this year was a working Magic 8-Ball, powered by an Arduino Mega and a set of sensors to detect motion.  A gyroscope and an accelerometer are used to detect when the 8-Ball has been picked up and/or shaken, while an IR receiver is used to power on or off in response to a remote control.  Here is a video of the working electronics, before it was installed into the Pumpkin.

And here are some pictures of the fully assembled pumpkin and it’s electronics.

Hardware

Arduino Mega ( datasheet )
Memsic 2125 Dual-axis Accelerometer ( datasheet | tutorial )
SerCLD v2.5 Serial Enables LCD ( datasheet | tutorial )
Gyroscope Module 3-Axis L3G4200D ( datasheet | tutorial )
IR Receiver Module TSOP38238 ( datasheet | tutorial )

Layout

Device Data Pins
LCD -> PWM 10
IR Reciever -> PWM 2
Accelerometer -> PWM 6 and 7
Gyroscope -> SDA (20) & SCL (21)

 

 

Algorithms

Motion Sensing

The motion sensing algorithm is the only non-trivial algorithm in the pumpkin.  The pumpkin identifies that it has been picked up by evaluating the maximum magnitude of the angular velocity vector from 20 measurements spaced 50 ms apart (i.e. 1 second of data).   If the max value is greater than 1e7 (units unknown) then the 8-Ball declares itself “picked up”.  If the max value is greater than 2.5e4 and the 8-Ball was already in a picked-up state, it remains “picked up”.  Only if the max angular velocity is below 2.5e4 does the 8-Ball deem itself “put down”.  This prevents the 8-Ball from thinking it has been put down when it’s only being help still in your hand.


The 8-Ball detects that it has been shaken using a different algorithm, mostly because I wanted to learn how to use the two-axis accelerometer, but also because people tend to shake the 8-Ball side-to-side, which you can’t detect with a rotation sensor.  The 8-Ball decides that is has been shaken if it is currently picked up and is the current magnitude of the acceleration in either axis is above 400 (units unknown).

 

 

IR Power On/Off

The power on/off algorithm it very primitive.  It just looks for more than 5 IR detections in the last 0.1 seconds, so any IR controller sending any IR signal will pretty much turn it on and off.

Arduino Code

MagicEightballPumpkin.ino

 

Leave a Reply