Maker.io main logo

Arduino-Powered Pinewood Derby Race Car

11

2016-06-08 | By John M. Wargo

License: General Public License Arduino

Attend a Pinewood Derby with style by racing this flashy Arduino-Powered Pinewood Derby race car. This car will surely catch everyone’s attention as it is adorned by a set of ten colored LEDs flashing in various patterns depending on the orientation of the car. The setup utilizes an ADXL335 accelerometer sensor and an Arduino-compatible Teensy 3.0 to control the LEDs.

The LEDs are programmed to change blinking patterns in 3 particular conditions. First is when the car sits flat in the pits, LED lights are expected to flash in a certain pattern. Second is when the car is situated at the starting gate and on the angled portion of the track, the light pattern changes and becomes more active. Since there is a possibility of the car going off track, the third additional “danger” pattern has been programmed in cases when the car tips on its left or right.

Components

Below is a list of the basic components needed.

1. Arduino-compatible board
    •  With at least 10 digital outputs and 3 analog inputs
    •  Size/weight must be suitable for the Pinewood Derby Car with 8 oz. max weight

2. Adafruit’s 3.7V 1200mAh LiPo battery
    •  You can use other types/brands

3. Adafruit’s #259 USB
    •  Allows you to charge the battery directly on the car with standard smartphone charger

4. Push-button with mounting holes and LED indicator

5. Adafruit ADXL335 5V Ready Triple-axis Accelerometer
    •  To allow the Arduino to measure the car’s orientation

6. 3.7V LEDs
    •  In clear capsules (blue, yellow, and orange)

7. Resistors

Code

The code starts by defining some constants for pins, accelerometer inputs and threshold values. Each of the light groupings (blue, yellow and orange) is defined as an array so that the application simultaneously affects all the lights of the same color.

The application calls a simple function called “doAll” to make sure that the output voltage for all of the LED pins is LOW (0). I noticed that the accelerometer would sometimes start with rogue values, so during setup, application reads all initial values and discards them. You will know what threshold values to use when the circuit is ready. Open the serial port for output and add a simple code that outputs the axis and value to the computer screen.

Arduino-Powered Pinewood Derby Race Car

Project Source

 

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.