Bob Cole - 0-60 mph timer

Introduction

My project started out as a device for your car that would record 0-60 times. My original idea was to use an accelerometer to figure out the speed of your car. After doing some research, I realized that accelerometers were not nearly accurate enough, so I decided to use GPS. I still wanted to use an accelerometer, so I changed my idea for my project slightly. Not only was it going to be able to record zero to sixty times, but it would also be able to record lateral g forces, and figure out the maximum that your car can reach.

Description

The first piece of my project I decided to work with was the GPS reciever. I needed something that would be easy to interface with the Arduino, and I also needed it to have a fairly quick update rate. A large portion of GPS units have a 1 Hz update rate, because nothing faster is needed. For my device, I'm trying to record the time it takes my car to reach 60 miles per hour, and I wanted something that was accurate down to the tenth of a second. I found a 10 Hz GPS receiver on Sparkfun that seemed like it would be perfect. Interfacing with the receiver was reletively straightforward. There were only 5 pins, and below is a picture with each of the pins labeled.

I decided to use an Arduino Mega instead of the Uno so I could have more serial pins. To interpret the GPS data coming from the receiver, I used a library for the Arduino called TinyGPS.

The accelerometer was next on the list. It was by far the easiest part, and with a couple lines of code, I had it up and running in no time. Here is a picture of the accelerometer I used.


After I got the GPS and accelerometer working, I decided I wanted a nice user interface, and I also wanted an easy method of input. I decided to use the TouchShield Slide.

After seeing some example code online, I thought that using this touch screen would be really simple. It turned out to be pretty complicated. First off, as you can see above, the shield actually has an Atmel ATMEGA2560 chip on it. This chip has to be programmed seperately from the Arduino Mega that I'm using. Each chip has to have seperate code, and the Touchshield also uses a different IDE than the regular Arduino IDE. You can find the link to download that IDE here. After I downloaded that IDE, I tried using the Touchshield directly on top of the Arduino Mega. The TouchShield was designed for the Uno, but I assumed it would work for the Mega. It turns out it does work fine, but all of the example code uses pins 2 and 3 as serial ports, but the serial ports are implemented in software using libraries. Apparently these libraries don't support the Mega, so I had to mount the Touchshield on a breadboard and hand wire all the pins into the Mega. Instead of using pins 2 and 3 for the software serial communication, I used two of the actual serial pins that the Mega has. Once I had all of that working, I came upon my next problem, comunication between the Arduino Mega and the Touchshield. Any data that the Mega received from the GPS or the accelerometer had to be transmitted serially to the Touchshield so it could be displayed. Here's a video of the final product:

 


 

Log:

March 23-Bought Arduino Mega

March 26-Bought GPS Receiver

March 29- Interfaced GPS receiver with Arduino Mega and was able to display speed in binary with LEDs (6 hours)

April 10 - Initial testing of 0-60 timer, with display on TouchShield Slide(failed miserably) (3 hours)

April 15 - Second round of testing with TouchShield Slide. I was able to display the time in milliseconds, but I had no GUI and it only ran once and then needed to be reset (5 hours)

April 19 - Finished working on GUI so user could reset after doing 0-60 (4 hours)

April 21 - Added functionality on touch screen so that user could measure g-forces with an accelerometer (8 hours)

April 23 - Put accelerometer on board and tested all the devices together(again, failed miserably) (2 hours)

April 23-26 - Debugging and redesign of Arduino code(12 hours)

April 27 - Tested successfully and recorded video of working device (1 hour)

Total hours: 41 hours


 

Cost Estimates:

Arduino Mega: $65

10 Hz LS20031 GPS receiver: $65

ADXL335 Acelerometer: $25

TouchShield Slide: $175

 

Total: $330

 


 

Code:

Source Code