As a Christmas present for Jasper this year, I made him a smaller version of my Dispatchatron invention, sized just right for the train table. Dispatchatron Senior was rather large and had to be put in storage when we could no longer spare the space. Dispatchatron Junior, however, can fit in a hat.
In short, the Dispatchatron Junior monitors the computer-voice (no humans) dispatch radio frequency of the county fire department and launches a toy fire truck onto our train table whenever the county dispatches a real fire truck. Even though the radio dispatches are just a computer voice giving addresses and unoffensive descriptions of the problem, I normally keep the volume just loud enough to be an effect, not loud enough that the boys will start parroting the dispatches.
I was inspired to make the Junior version after seeing a handheld car launcher for sale in Target. The dime-sized car uses a capacitor which is quickly charged (in 5-8 seconds) by two AAA cells in the launcher. One button charges the car, and another button levers down a gate, releasing the car.
To incorporate the toy into my contraption, I cracked it open and replaced the charge switch with a relay & transistor circuit to be operated by a microcontroller. I discarded the release button and connecting rod, leaving only the spring-loaded gate. I drilled the bottom of the launcher case and put a tiny eye-screw into the bottom of the gate. I mounted the launcher to the plywood base of the fire station, having cut a slot in the base to allow a string to run from the gate eyelet to a small servo.
The small ham radio handy-talkie is mounted to the base with a scrap of thin aluminum. The microcontroller is an Arduino MICRO that I won in a trivia contest on Adafruit’s Ask An Engineer show for being the first to answer the question, “What material was used to make the case for the NeXT Cube?” I attached a light sensor (a light-dependent resistor) to the status light on the radio, so the microcontroller can sense when a radio call is coming through. When a dispatch occurs, the radio sends the live audio out of its speaker and simultaneously lights the status light.
Here’s a quick and dirty diagram of the circuit layout:
In the future, I might consolidate the various batteries into a single one with multiple regulators for easier recharging.
The code for the Arduino MICRO is quite simple:
// Dispatchatron Junior
#include <Servo.h>
Servo carGateServo;
long lightLevel;
long lastLaunch;
long ambientLight;
const int lightSensor = A5;
const int launchRelay = 11;
const int GATEDELAY = 600;
const int CHARGEDELAY = 5000;
void setup()
{
pinMode(launchRelay, OUTPUT);
pinMode(lightSensor, INPUT);
digitalWrite(launchRelay,LOW);
Serial.begin(9600);
carGateServo.attach(3);
carGateServo.write(50);
lastLaunch = 0;
ambientLight = analogRead(lightSensor);
Serial.println("Setup complete.");
}
void loop()
{
// Record the light level from the sensor...
lightLevel = analogRead(lightSensor);
// If the light level has increased AND it has
// been a minute since the last launch...
if((lightLevel > (ambientLight+100)) && ((lastLaunch + 60000) < millis())) {
// Wait until the radio dispatch is over...
while(analogRead(lightSensor) > (ambientLight+100)) { // While the light is on...
delay(500); // Wait another half-second.
}
launchCar(); // Then launch the car when the light goes off
}
delay(1000); // No need to waste energy checking too often
}
void launchCar()
{
lastLaunch = millis(); // Record the time of this launch
digitalWrite(launchRelay, HIGH); // Charge the car
delay(CHARGEDELAY); // Wait for the car to charge
digitalWrite(launchRelay, LOW); // Stop charging the car
carGateServo.write(100); // Lower the gate, releasing the car
delay(GATEDELAY); // Wait for the car to leave
carGateServo.write(50); // Close the gate to allow reloading
}
I built the fire station walls and roof out of thin plywood and painted it with a simple brown and red mix of kids’ craft paint. I pencilled in brickwork with a white pencil and (somewhat sloppily) painted the name of the fire station on the front. The car that came with the launcher was a yellow, rocket-powered, Prius knockoff. I painted it to look like a fire truck using glossy red and silver craft paint. Neither paint job is perfect, but both are plenty good enough for a two-year-old.
Now the boys’ daily train play is augmented by the occasional excitement of a toy fire truck driving itself around the table.