September 2015 35
Scary Lane Haunt
( ScaryLane.com) started out
as a simple home Halloween
display over a decade ago. It
wasn’t long before it was the
must-see attraction for the
Listing 1.
Whittier community in
;The following lines of code are used to initialize the I/O lines
;going to the MSGEQ7 chip. Use at the start of the program...
High MSGEQ7Strobe ;initialization output to the MSGEQ7
Low MSGEQ7Reset
Southern California.
About six years ago, we
added a two-story Ghost
;This subroutine is used to reads the 400HZ, 1000 HZ and 6.25 KHZ bands
;and opens or closes the jaw based on that band's output level.
Town façade that hides the
house and has plenty of
places for audio-animatronics, skeletons,
props, and set dressing. The
key to making this haunt
great has been the use of
electronics to run the show.
ReadEQU:
pulsout MSGEQ7Reset,1;strobe the reset pin for 10ms
pauseus 8 ;wait 80us for reset to end
gosub SkipBand ;skip 63 hz band
gosub SkipBand ;skip 160 hz band
Using more than a dozen
custom-designed show and
prop controllers, the Ghost
Town literally comes alive on
its own to entertain the
neighborhood. The
controllers time the fog
machines, the lighting, and
other effects based on the
time and the weather
conditions. Even the audio-animatronics changes based
on the time of day or if it’s
the big night of Halloween.
gosub GetBand ;get the 400 hz band
if Jaw_Temp>threshold then ;higher than threshold voltage?
High Jaw1motor;yes, then open jaw
else
low Jaw1motor ;no, close Jaw
endif
gosub GetBand ;get the 1000 hz band
if Jaw_Temp>threshold then ;higher than threshold voltage?
High Jaw2motor;yes, then open jaw
else
low Jaw2motor ;no, close Jaw
This year, I will be adding
more sensors along the side
walk so the show elements
know where people are. Just
imagine ... a person is
walking by and the talking
skeleton follows them. I will
post the videos of the freaked
out passers-by.
gosub SkipBand ;skip 2,500 hz band
gosub GetBand ;get the 6,250 hz band
if Jaw_Temp>threshold then ;higher than threshold voltage?
High Jaw3motor;yes, then open jaw
else
low Jaw3motor ;no, close Jaw
endif
return
The Interface
GetBand:
low MSGEQ7Strobe ;Strobe line Low
pauseus 4 ;wait 40.0 us till data is good
readadc MSGEQ7Data,Jaw_Temp ;get the band's audio level
High MSGEQ7Strobe ;Make Strobe line high
pauseus 4 ;wait 40 us
return ;now safe to strobe again.
The MSGEQ7 uses the
reset and strobe inputs to
control the multiplexer for
spectrum band selection. Each
time the strobe line is pulsed,
the output will select the next
band with the reset line starting a sequence back to the
first spectrum band. This interface only needs two output
lines and one analog input line, and is a piece of cake for
just about any controller (like the Raspberry Pi, Arduino,
SkipBand:
pulsout MSGEQ7Strobe,4 ;strobe line 40.0 us
pauseus 4 ;wait another 40.0 us
return ;now safe to strobe again.
The strobe timing diagram (Figure 7) shows how to
use the reset and strobe lines to select the 63 Hz
spectrum band and move along to the other six. To start
reading the first spectrum band, the reset and strobe lines
need to be set high. About 200 or more nanoseconds
later, the strobe line should go low. Wait another 72 or
more microseconds before changing the strobe line to
read the analog input for the seven bands.
When reading the bands, the chip responds to the
high to low transition on the strobe line, but there is a
short delay of 36 microseconds before the output is
stable. The microcontroller can read the current level via
the controller’s analog input line.
Now, return the strobe line back to its high state and
wait another 36 microseconds. Continue using the strobe
line till all the bands have been read.
PICAXE, or BASIC Stamp) to handle.
Timing is Everything
Almost Time
Trying to get timing down to the microsecond can be