Introduction: A(T)tiny StarBird

About: Send me a message if you're interested in Technology or Science Workshops in Flanders, Brussels or the Southern of the Netherlands. I have over 20 years of experience in developing and giving creative workshop…

This Ible describes the design and build of miniature tribute to the 70’s StarBird toy by MB. It mimics the original Starbird’s sound effects, which is an electronic “engine” noise that rises in pitch when the craft’s nose is tilted upwards and lowers when the nose is tilted downwards. It also has a button to fire two red “main cannons”, accompanied by a classic space gun sound.

Here's a video:

The project features a self-made tilt switch and a resistive touch switch. The sketch and the circuit are kept quite simple. The intention is to use it in "starships" built by children. At this stage it is a module built by me (requires some experience in cutting printed circuit boards and soldering) and a paper StarBird silhouette coloured by my youngest daughter aged 4 to make it into a "starship".

I’m still working on a version where the circuit is to be built in a workshop for children aged 6 to 12 (where soldering is not practical with 20 kids). I hope their parents will forgive when they bring this noisy toy home. However my version is not only smaller, but also less loud than the original one.

I’m also planning on making an even smaller one, based on a laser cut StarBird silhouette and a circuit made with Bare conductive ink or paint (something to share with my oldest daughter, Ibles member Tika.

Some words on how I came to doing this project:

When I was a kid MB created the StarBird especially for me ;-)
They even went through the trouble of making a box picturing a boy that looked just like me at that age. My parents offered me the StarBird and I played a lot with it. Later on, it became what was probably one of my first hacks, when I dismantled it to use the electronics in starship builds of my own. At some time, it became lost in space…

Last year I came across a StarBird in reasonably good shape at a good price and bought it for my youngest daughter. Not surprisingly my oldest daughter (and I) played with it too.
I wanted to build toys around the sound effect module again, but considered a vintage StarBird to precious to hack. When I recently picked up Arduino “making”, reproducing the StarBird sound effects became my first project.

When Ugifer’s Morse Throwie ible showed me how simple and cheap an ATtiny based circuit can be (THANK YOU UGIFER!), I started on planning to use them in my creative workshops for children. The StarBird light and sound effect again made the first project.

If you like this Ible, please give it your vote.

English is not my native language, nor are electronics and programming my core competence, so please feel free to point out any mistakes.

Step 1: Parts, Materials and Tools

Note: As we will be touching the bare wires when playing with the A(T)tiny StarBird, it is important to use lead free parts en solder (look for the "Rohs" label, which is about standard these days).

Parts and Materials::
an ATtiny 25, 45 or 85
an IC socket with 8 contacts
two 3 mm LEDs
a small piezo speaker (17mm diameter or smaller)
a 10mm steel ball
4 long connector pins (15 mm or longer)
two 100 Ohm resistors, ¼ W
three resistors around 10 MOhm (exact value is not critical)
a 3V coin battery (e.g. CR2032)
a battery holder for this battery
two pieces of prototyping printed circuit board, so called stripboard or “common bus” pattern (like this):
- one piece about 90 mm long and 13 mm wide (36 holes long, 5 wide, tracks in longitudinal direction).
- a smaller piece 13 mm wide and 15 mm long (6 holes long, 5 wide)
a small switch (preferably with angled pins for print mounting)
some clear heat shrink tubing, 1” nominal diameter, about 10 cm long
lead free solder for electronics

Tools:
a soldering iron for electronics
3mm and 6mm drill bits and a drill (or Dremel style tool)
small cutting pliers
flat nosed pliers
a small sharp hobby knife
an Arduino, breadboard and jumper wires or other hard- en software to program ATtiny
a computer
a heat source to shrink the shrink tubing (hot air gun, paint stripper...)
a hacksaw and sanding paper or file to cut out and finish the circuit board

For decoration:
Whatever you like, for example paper, colour markers, scissors, (double sided) tape and a printer

Step 2: Breadboarding With the Arduino

I started exploring the sounds made by the tone function on the Arduino, changing pitch, duration and delays (for a good intro on Arduino, see this Ible).

For the engine I started checking the lowest pitch parameter value played, which seems to be 50 (but turned to be around 100 for the ATtiny core). I got the idea to set the delay between the tones played a little longer than the tone from the toneMelody example. A tone of 10 ms and a delay set at 11ms longer gives it an “engine-like ripple”.

I made a little test program changing the pitch of two tones, looking of combination that gave a classic “space gun sound” reminiscent of the StarBird (see sketch included below). As input I used two double tilt switches as input. At that time I was still experimenting with three state switches only using one analogue input each (see the circuit diagram), a concept I dropped later as explained in the step on the tilt switch.

The durations and delays where tested by changing and re-uploading the program. I noticed here it was best to set the delay a couple of ms shorter than the tone duration, for a smooth sound.

Then I added some simple on-off switching of the LEDs following the sound pattern.

Here is the test program:
/*
StarBird Sound Test
created 3 August 2012
by masynmachien

This code is in the public domain.

*/
const int tonepin = 3; // tone outputpin later to be changed
// to avoid interfering with uploading
int thisPitch = 820;
int Pitchdelta = 55;
int time = 60;
int timeminus = 57;

void setup() {
// initialize serial communications (for debugging only):
Serial.begin(9600);
}

void loop() {
// read the threestate switch:
int sensorReading = analogRead(A0);

if(sensorReading > 800)
{
// increase pitch when pulled towards 5 V
if (thisPitch < 20000)
{// maximumum pitch
thisPitch = thisPitch + 1;
}
}
else if (sensorReading < 200)
{
// decrease pitch when pulled towards 5 V
if (thisPitch > 700)
{// minimum pitch
thisPitch = thisPitch - 1;
}
}

// read the threestate switch:
int sensorReading2 = analogRead(A5);

if(sensorReading2 > 800)
{
// increase pitch when pulled towards 5 V
if (Pitchdelta < 10000)
{// maximumum pitch
Pitchdelta = Pitchdelta + 1;
}
}
else if (sensorReading2 < 200)
{
// decrease pitch when pulled towards 5 V
if (Pitchdelta > 0)
{// minimum pitch
Pitchdelta = Pitchdelta - 1;
}
}

// play the pitch:
tone(tonepin, thisPitch, time);
delay(timeminus); // delay in between reads for stability
tone(tonepin, thisPitch-(Pitchdelta/2), time);
delay(timeminus); // delay in between reads for stability
tone(tonepin, thisPitch-Pitchdelta, time);
delay(timeminus); // delay in between reads for stability
tone(tonepin, thisPitch-(Pitchdelta/2), time);
delay(timeminus); // delay in between reads for stability

Serial.println(thisPitch);
Serial.println(Pitchdelta);
}

Step 3: The Switch to ATtiny and Final Sketch

I used the Arduino to program the ATtiny following the instructions here. However I made sure to use the core found here, because it is documented to support the tone function.

I build the circuit on a breadboard to do further testing. An important difference is that the tone function on the ATtiny does not work with a parameter value of 50. The sound starts only at a value of about a 100.

(If you look closely at the pictures below, you can that at that stage I used a pull-down resistor for the touch switch, instead of a pull-up resistor on all inputs as in the final version for a more consistent build.)

When testing, I noticed the analogue input can be influenced by each other. For example the the tilt contact would trigger the firing. lowering the touch switch trigger value to 333 in stead of 500 (about 1/3 instead of half way) solved that. I did not investigate further into the cross influences. If anyone can explain the phenomena and/or knows how to avoid this, please let me know.

Here is the final sketch:
/*
A(T)tiny Starbird
A reproduction of the classic MB StarBird
engine noise changing in pitch when tilted,
featuring a self made tilt switch and
for "firing" LEDs a resistive switch.
For a full description see: www.instructables/

created 23 August 2012
by masynmachien

This code is in the public domain.

*/
int EnginePitchBy3 = 300;
// The pitch indicator variable used is the actually
// pitch parameter for the Tone function multiplied by 3.
// This is to match pitch changing speed and sound interval,
// (see further). There is actually a minimum for the Tone
// function to work and it seems to be higher for the ATtiny
// than for the Arduino.
int fire[] = {820,795,770,795};
// pitch firing sound
boolean LED[] = {HIGH,LOW,HIGH, LOW};
// LED lighting pattern

// The setup routine runs once when you switch on the power
// Reset is not usable with the hardwre design used):
void setup() {
// initialize serial communications (for debugging only):
pinMode(0, OUTPUT); //output pin O is to drive two LEDs in parallel
pinMode(1, OUTPUT); //output pin 1 is to drive the piezo speaker
//These setups are probably not needed on ATTINY?
//They remain from prototyping on Arduino and do not harm.
}

void loop() {

// Read two tilt switches, set up as an analogue
// input pulled up to VCC by high ohm resistor.
// No deliberate debouncing is applied as any irregularities
// larger than filterd by the 11 ms time interval when
// producing the desired sound just adds to the sound effect.
if(analogRead(A2) < 500)
{ //when "up" tilt switch pulls analog input towards Gnd
if (EnginePitchBy3 < 2400)
{// only if a choosen maximum is not yet reached
EnginePitchBy3 = EnginePitchBy3 + 1;
// increase pitch indicator
}
}
else if (analogRead(A3) < 500)
{ //when "down" tilt switch pulls analog input towards Gnd
if (EnginePitchBy3 > 300)
{// only if minimum pitch i not yet reached
EnginePitchBy3 -= 1;
// decrease pitch indicator
}
}

// Read the touch switch "firing button", set up as an analogue
// input pulled to GnD by high ohm resistor.
// No deliberate debouncing is applied, but de time taken by the
// sound played gives some rough debouncing.
if(analogRead(A1) > 333)
{ // When the touch switch analog input is not pulled up by
// touching it together with a contact at Vcc, this means no "firing",
// and the flying noise is played:
tone(0, EnginePitchBy3/3, 10);
delay(11);
// The delay set a ms longer than the play length of the tone
// makes it sound more like an engine.
}
else
{
// Else, the firing noise is played.
for (int patternCounter = 0; patternCounter < 4; patternCounter++)
{
tone(0, fire[patternCounter], 60); // modulating the firing sound
digitalWrite(1, LED[patternCounter]); // modulating LEDs
delay(57); // delay is set slightly shorter for continuous sound.}
}
}
}

Step 4: Circuit and the Setup of the Board

The circuit I decide to after breadboarding is shown below.

The circuit board is based on of a piece of prototyping board of the “common bus” type. It is pretty compact and uses only a limited number of bridges and cuts in the prefab paths.

Drilling a shallow hole with a 3mm drill bit makes the “cuts”. For this build I made these during assembly, still choosing where to cut, but it is more practical to do this as early as possible.

However, a good start is to first put the IC socket in place, as a reference for the other components. First the leg corresponding to the reset pin is cut. It will still work when you do not this, as the reset pin will be constantly connected to VCC, but that will draw some current, which would be a waste.

Important is that a wire bridge connecting the top and bottom path runs is first put under it (I actually forgot it at first myself and had to fiddle it in afterwards). It runs from the GND leg of the IC socket/ATtiny to the other side. I used a scrap end cut from a resistor leg to make it.

The last picture shows the cuts/holes and soldering on the finished board, but it is easier to clamp the circuit and drill at this early stage. Check if the path is completely cut and there are no burrs making contact with other paths.

Step 5: Tilt Switch

Building a reliable tilt switch proved to be not as simple, but ready-made tilt switches are relatively expensive.

I found a low cost double tilt switch that should be suitable when adapting the circuit, so the middle pin is connected to GND.

But I kept to making one myself as a preparation for the in the workshop version. the tilt switch is a part that promises to be great fun for the kids to build by themselves.

As shown on the breadboard version it is easy to make a tilt switch with a steel ball and 4 pins. It works, but not always. You can get pins with a surface that makes good electrical contact (silver, nickel, gold), but the commonly available steel balls are not optimised for electrical contact. They are commonly made out of chrome alloyed steel, optimised for mechanical load bearing. I couldn't find coated balls. I learned that new balls, cleaned with steel wool work well enough for a "toy". Steel balls from used bearings doe not work well, even after thouroughly degreasing and cleaning.

I also learned that it works best when the ball has some length to run before it impacts on the contacts, it works better. At some times the switch worked better after shaking it (maybe by cleaning of some oxidation built on the ball surface).

I also experimented with higher value for the pull-up resistors to compensate for the high contact resistance. But while it is clear the for the pull-up resistors should have a high value, this does not solve everything. Still using the three state switch shown in Step 2, I ran in another problem: The neutral middle state was influenced by any residue (like sweat) on the circuit. So I settled for a relatively, but not extreme high value of 10 MOhm and went for two separate inputs. I had an input left anyway and this allowed to set the trigger value independently (both at half way worked fine).

separate the connector pins, keeping a piece of plastic on each pin. To solder on the tilt switch pins I used a breadboard to keep them in place.

In the middle of the "running area" for the ball, I drilled out shallow hole with a 6mm drill bit, to provide a stable neutral position.

With the ball in place to check the height (allow some room to spare) I shifted up the plastic parts to support a small 5x6 circuit board and soldered it in place. Do not forget to cut the path between the two input pins.

The plastic parts are removed by crushing them with flat nosed pliers. This avoids damaging the pins wit cutting pliers. After crushing, the plastic can be pried off.

The pull-up resistors are put in place in Step 7.

Step 6: The LEDs and Speaker

Bend the LED legs just behind the markings. Make sure you bend them the right way, taking in account the - leg should be at the bottom side of the board when held as shown in the picture.

The LEDs are put in the second row of holes, becaus otherwise the legs would have to be bent too short. After soldering the LEDs are shifted to the middle of the board front, bending the legs. This is actually not good practise when making reliable circuits, but it works. Keep the legs cut off from the underside of the circuit board to make wire bridges

It would have been obvious to use one resistor for both LEDs together, but as  an extra bridging wire would be needed on the "common bus" board, I went for a  resistor for each LED.

To save room on the print (keeping things tiny) one of the resistors is mounted over the LEDs, It goes in the front row hole connecting the - leg of the "top" LED to the GND path at the bottom.

The speaker is put in place, making sure there is one row of holes free between it and the IC socket. It is soldered to the top (connecting to output 0) and bottom path (GND).

Step 7: Touch Switch and Pull-up Resistors

The touch switch is minimalistic in approach. The pull-up resistor is soldered to the analogue input and VCC, in such way the resistor is at the VCC side and the bent down leg at the input pin side. This means that touching the top is touching the input. A doubled cut off LED leg is soldered to GND right next to it, so touching both tops means pulling the input towards GND.

Note: a simple capacitive switch would not work, as the device is not grounded.

One side of the tilt switch is on a GND path. At the other side, the path is cut and each pin is connected to an input with a wire bridge and to VCC with a pull up resistor. The wire bridges are put closest to the tilt switch and kept low, as the ball protrudes a little from the switch and should not be hindered.

Step 8: Battery and Switch

Cut one of the double pins off the battery holder, as shown. If you do not do so, you will not be able to switch off the device. So if you want to drop the switch and remove the battery for powering off, you can keep this pin on.

Add the switch at to the last row of holes, with the middle pin on the VCC path.

Put in the programmed ATtiny, the battery and ball and you're ready for testing.

Step 9: Wrapping Up

Put in a cleaned steel ball and slide over the shrink tubing. Shrink it, taking care the ball remains in place.

With a sharp hobby knife, cut a hole at the touch switch and at the speaker opening.

Wen the battery needs to be replaced, a large enough hole will have to be cut. But for now, I left it like that.

Step 10: Up to the Kids Now (further Developments)

I made a silhouette pattern, derived from a top view picture taken from our StarBird.. I slightly widened the pattern to take in account ten bending of the wings (as on the original).

After colouring and cutting out, it was stuck to the electronics module with some double sided tape.

The last picture shows an experiment with a tilt switch made with screws on wood, looking for a simple way for kids to build it themselves. But it needs some work still.

Hurricane Lasers Contest

Participated in the
Hurricane Lasers Contest

LED Contest with Elemental LED

Participated in the
LED Contest with Elemental LED