Introduction: Pinewood Derby Police Car

It's Pinewood Derby season!  This year I am building one with an arduino chip inside.  This car has LED head and tail lights.  Also it has red and blue flashing lights that are controlled by the arduino chip.



I'll show you how to build one of your own.

Step 1: Prep and Parts List

First thing we need to do some prep.  The main things we need to sort out is what the power source will be and what chip will control the LEDs.  There is not much room in a pinewood car so the smaller the battery the better.  I used an old cell phone battery.  It was fairly small and fit well inside. It is also rechargeable so I can use it again.

For the arduino chip I am using a ATtiny85.  This chip is smaller than the regular arduino chip which is good because of the room we have to work with.  This chip is a little differant to program than the regular arduino chips but it is fairly easy.
Hear is a link that shows you how to program the ATtiny.
ATtiny

Pats List
Pinewood derby kit
Battery
4 bright white LEDs for headlights
2 red LEDs for tail lights
Red and blue LED for flashing lights
ATtiny85 and arduino
any other electronics to complete the circuit. (wire, switch.)

Tools
For making the car I used a hack saw and a dremel and it seamed to work just fine.
soldering iron and solder
Paint
hot glue gun

Step 2: The Car

Take your pinewood derby kit.  You will see that it is just a block of wood.  You can carve it into any shape you want.  I chose to make a Dodge Charger.  It seams like there are many of those in police form.  Now we need to make a place for the battery and circuitry to live.  The best way to go is to hollow out the car from the bottom.  You can make a cover for the cavity out of the scrap wood you have form carving the car.

Now we need to drill holes where the LEDs are going to go.  I used my dremel for this and it was pretty easy.  I also put a hole on top of the car between the flashing lights for a switch.  Make sure you dry fit the parts before moving on.

Step 3: The Circuit

I have made a diagram of the circuit.  The positive lead from the battery is going to the power input on the chip and there is a switch hear to turn the lights on and off.  With the power plug positive is going to positive of the battery and negative is going to negative of the battery.  The LED near the power plug will turn on when a power cord is plugged in.  This will verify that the battery is charging.  The diode is needed.  If it was not there then the led would be lit up even if the power cord was not plugged in. 

Step 4: Write the Code.

If you want to wright the code yourself the main idea would be to get the red and blue lights to blink in a way that a real cop car does.  I found that there are many blink patterns for cop cars so you can pick one or even a couple. 

If you do not want to wright it yourself or do not know how, hear is the code that I used.  Just copy and past in the arduino software.

// Code for pinewood derby cop car
// This code is for the ATtinny85 chip
// To modify the code to work for any other chip all that
// is needed is to change the pin numbers
int blue = 3;      // Blue LED on top of car         
int red = 2;       // Red LED on top of car       
int headLight = 1; // Four LEDs in front of car wired in parallel
int tailLight = 4; // Two LEDs in rear of car wired in parallel


void setup(){
  pinMode(blue, OUTPUT);       
  pinMode(red, OUTPUT);     
  pinMode(headLight, OUTPUT);
  pinMode(tailLight, OUTPUT);
 
}
void loop(){
// This will keep the headlights and tail lights on
// and blink the red and blue lights like a real police car
  digitalWrite(headLight, HIGH);
  digitalWrite(tailLight, HIGH);
  int num1 = 0;
  while(num1 < 2){ 
    digitalWrite(blue, HIGH);
    delay(75);
    digitalWrite(blue, LOW);
    delay(75);
    num1++;
  }
  int num2 = 0;
  while(num2 < 2){
    digitalWrite(red, HIGH);
    delay(75);
    digitalWrite(red, LOW);
    delay(75);
    num2++;
  } 
}

To upload the code to the ATtiny85 you need to use the arduino as an ISP.  The link in step 1 are instructions on how to do this.
Make sure you test the code on a breadboard first before going any further.   Nothing is worse than to get it all put together only to find out that it does not work. 

Prototyping is far better than troubleshooting.

Step 5: Prototyping

Once you have all the parts that you will need for the circuit, it is a good idea to make sure it will work before you solder and glue every thing in.  First write the arduino code and program the chip.  Use a breadboard to test out the circuit.  You should make sure that every thing lights up and blinks how they should and the battery lasts as long as you need it to.  For a pinewood derby 4 hours of battery life should be more than plenty.

Step 6: Putting Is All Together

Now that you have the car carved out and the circuitry all together and working you can start to put it all together.  I started by getting a perf board and cutting it to the right size.  Solder the chip onto the board.  Then start installing the leds and connecting them to the board.  Make sure you use plenty of wire.  You can run out of room.

I wired the leds in parallel grouping the 4 headlight leds together as well as the 2 tail light leds together. 

Once you have finished soldering every thing make sure you test it before you close every thing in.  If it works then close it up with that panel and some hot glue.

All you need to do now is put the wheels on, any decals you have and have a fun time at the pinewood derby.