Here’s a high-precision timer I wrote. I get roughly <1ms avg precision on 25ms interval. But if Windows is busy it may come in late. It’s fairly lean on CPU utilization. Feel free to use. It uses Sleep(1) when the next tick is more than 15ms away and then SpinUntil (which yields as needed) to keep CPU usage at bay. Uses .NET4 features.
4 channel USB data logger. They are even giving away free loggers for 4th graders and up.
Not great quality, it’s hard to shoot in the dark, with fog. But hopefully you’ll see some details of the display. We had a blast last night with a lot of kids (and adults) enjoying it! Many screaming, some crying
Just a picture of the pressure-sensitive mat I created for halloween. It’s placed in the stairs leading to our porch. When visitors step on it it triggers the main sequence. I pretty much followed the instructions on this link: http://supersoda.com/detail.php?id=00000000036). It seems flaky with just the cardboard keeping the distance between the foil, but it’s actually working very well.
Main functional blocks:
- Custom controller-application written in C#, running on my PC.
- Audio-player application, also written in C# using managed DirectX (www.sharpdx.org) and XAudio2. Multi-channel/Polyphonic.
- I/O Expander created using a Parallax Propeller (8 core microprocessor, 80 MHz), communicating with PC over serial/USB port. Handles all Input/Output like pressure mat input, relay-control for spider, PWM and quadrature encoding for skeleton motor, plus DMX light control.
- DMX-controlled light fixtures and dimmer pack
- Spider lift using pneumatics (air cylinder powered by air compressor and solenoid valve)
- Skeleton on track in ceiling
- When no visitors are present the system will play random tracks from this CD. Some of the lights will flicker/pulsate.
- Visitor walks up the stairs leading to our porch. A DIY pressure mat (http://supersoda.com/detail.php?id=00000000036) triggers a digital input on the Propeller controller, which sends a command over a serial port to a PC running my custom C# application.
- All lights turn off, a sound effort of a creaking door is played, mixed with the violin screech sound from the Psycho movie.
- After a few seconds the spider is coming down and a red strobe that is pointing to it will flash. The spider is then raised again.
- Flashing multi-color strobe light directed at stationary skeleton and another sound effect played
- After a few moments another flashing multi-color strobe light turns on, combined with audio.
- Finally a laughter is played, white strobe light is going and the fish line mounted skeleton is moving towards the visitor! The skeleton will stop after a few feet and then go back after a few seconds.
- The visitor can now grab some candy. The system resets back for another visitor after a minute to allow some time to step off the porch without triggering another sequence.
Sample code from main controller C# application:
audioPlayer.PauseBackground(); audioPlayer.PlayEffect("Door-creak"); instance.WaitFor(TimeSpan.FromSeconds(2)); audioPlayer.PlayEffect("Violin screech"); blinkyEyesLight.JumpToLevel(0); instance.WaitFor(TimeSpan.FromSeconds(2)); audioPlayer.PlayEffect("Scream"); spiderLight.SetStrobe(Color.Red, 200); spiderMover.SetOutput(true);
Time to write about some details about our Halloween 2012 project. First off is the Spider Lift. This is a simple mechanical design, basically a hinged wedge driven by an air cylinder. The double-acting air cylinder is hooked up to a 5-port 4-way 12v solenoid valve with speed-adjustable mufflers. This valve either directs air to the top or bottom of the cylinder, so it will go to either position with pressure force. Applying 12 volts will send the air to the opposite side. I have the resting position at the top, so when the spider is triggered it will come down/towards the visitor, while a red strobe flashes and scream sound effects are played. Most equipment from http://www.frightprops.com. Yes, those are old cabinet doors
Some of the highlights of our 2012 Halloween installation:
- Custom-written C# controller on PC
- Network Audio Player using managed DirectX (XAudio2)
- Propeller/Spin IO Expander (handles all IO including DMX)
- Custom SPIN application with support for DMX, Relay, Inputs, Motor PWN and Quadrature Encoder
- Pneumatic lifter for spider, triggered by solenoid valve
- DMX lights: 4x LED RGB-lights, 1x LED strobe light, 1x dimmer pack 4chn
- Skeleton on track in ceiling, controlled by motor and quadrature encoder (built in lego)
- DIY pressure mat in stairs
- Background music and multi-channel sound effects
More details to come soon!