Whilst Duplo trainsets clearly rock, the teeny-weeny switch needed to activate them is no use for kids with mobility problems. As such, I thought I'd try to make my daughter's train noise activated using an Arduino and a sound detector.
This inital version is very basic - it takes an average of a series of readings to establish a background noise level and then just runs for a set duration after being triggered.
It's worth making use of the serial print function at the prototype stage to see how stable your background noise levels are - a noisy background may benefit from a more complex smoothing or filtering process - there are plenty of examples out there on the interweb.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts List
Duplo train set
Adafruit motor shield for Arduino v2
SparkFun Electret microphone breakout sound detector (www.sparkfun.com/products/12758)
Power supply cable
Step 2: Dissasemble the Train
First thing to do is to open up the train.
Remove the battery cover from the underside of the train by unscrewing the two screws.
Remove the batteries.
Unscrew the three screws holding the battery case to the chassis.
Turn the train upside down and support the front (the train's 'bumpers') and rear (the bit that connects to the carriage behind) of the chassis on wooden blocks.
Using a large flat screwdriver push down on the plastic tabs to seperate the body from the chassis.This might take a bit of effort!
Prise the two sections apart using a flat screwdriver.
Step 3: Prepare the Train
Remove the existing switch and cut the wires close to the PCB.
Strip the ends of the wires and connect longer pieces of wire to these.
Drill a hole in the back of the train to run the cables through.
Thread the cables through the hole. Reassemble the train. Solder the slider switch to the cable connected to the positive battery terminal.
Step 4: Prepare the Arduino
Solder a section of header to the sound detector.
Position the sound detector on the central area of the motor shield and solder into place.
Solder wires from the sound detector to the pins on the shield as follows:
VCC on the breakout to Arduino 3v
GND on the breakout to Arduino gnd
AUD to pin A0
Place headers onto Arduino, postion the shield on top and solder into place.
Step 5: Position the Arduino
I positioned the 9v battery in one of the carriages and a 2x2 Duplo block in the other.
The Arduino is secured onto the flat middle section using velco.
The train motor is connected to the M1 terminals on the motor shield.
The power from the train's battery pack is connected to the power terminals on the shield.
Step 6: Code
The code reads an analogue input from the detector then calculates an average to establish a background noise level.
A trigger is then defined as being a set level above background.
You will need to experiment to determine an appropriate level above background at which to trigger a signal.
Step 7: Play!
Upload the sketch and off you go! You may need to tweak the levels a bit to set an appropriate trigger.