Arduino

After I got the idea for the Mission Control Desk, it almost immediately occurred to me that we should have a spaceship of some kind to go with it. My son really did need a desk for school, though, and I had to finish that before starting on the spaceship.

This spacecraft is my favorite project ever. Not only was it challenging and educational for me, it will be great fun for the boys, while also encouraging them to work a lot of teamwork into their play.

You can read more details at the original post on the Makezine site.

Part of what makes me a maker is that I prefer to do things myself when I can. I even cut my own hair. Nothing fancy, mind you, just a quick buzz cut with a trimmer. The tricky part, though, is cutting a good line across the back of the neck. It’s not only hard to trim, even using multiple mirrors, but it’s quite obvious when I haven’t been keeping up. Usually I ask my wife to help me, but I like to be self-reliant, and decided to see if there was a fun and educational way to trim it myself.

Pondering this problem, the two things that came to my mind were computer vision and automated heavy equipment. I figured I could use computer vision to track my head and the trimmer, and besides, I have long been looking for an excuse to learn about computer vision. I thought of construction equipment as a model because some control systems for bulldozers use GPS to locate the machine, and then adjust the blade according to the requirements of the site plan. In theory, the bulldozer operator could just drive back and forth over the site many times, and the control system would handle the height of the blade to result in a perfectly sculpted site. I set out to build a trimmer that I could blindly run up and down the back of my neck, and have it automatically turn on or off in accordance with its position.

Read more details on my post at Make Magazine.

The Cat’s Meow

As a gift for the person watching our cats while we were on vacation, I whipped up a charming little electronic kitty cat.


I already had most of the circuit soldered together, as it was one of my failed (too big, physically) prototypes from my office chair lowrider enhancement. To make it more feline, I added some cat parts and reprogrammed the ATTiny85 (running the Arduino core) to make the closest approximation of a meow that I could manage. It’s not easy to express a meow in C, believe me. If only you’d heard some of the horrible sounds I rejected, you might think more highly of the sound I settled on. I had a greeting-card-style digital recorder module in my parts bin, but it seemed like cheating to use it. I wanted to give a gift that could be be repurposed into all kinds of things, and an Arduino circuit is that. I even put a programming header on the cat.

Take a look at my code and email me if you can think of any better way to programmatically meow.

/*

Cat’s Meow, by Jeff Highsmith

circuit:
* 8-ohm speaker on digital pin 3
* Power supplied by contact switch when tail is pressed.

*/

void setup() {
}

void loop() {
// Meee
int i=60;
while( i < 1500) { tone(3, i,1); delay(1); i=(i+2); } i = 1100; // ooo while (i>400) {
tone(3,i,3);
delay(3);
i=i-(i/80)+1;
}
// ww!
while(i<600) { tone(3,i,4); delay(4); i=i+(i/40); } noTone(3); } [/code] Finally, here's a circuit diagram that would be easier to understand if I didn't insist upon making it vaguely cat-shaped. Cat's Meow Circuit Diagram

Now I’m imagining a whole desktop menagerie of circuit board animals. I also have a much greater appreciation for all the rough sounds emitted by my kids’ toys.

Dispatchatron Junior Portrait

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.

Micro Chargers Package

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.

Servo Slot

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.

Sensor and Servo

Inside the Fire Station

Here’s a quick and dirty diagram of the circuit layout:
Dispatchatron Junior Circuit Diagram

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.