Introduction: $8 Racecar Data Logger
Nowadays many different companies produce data logging systems for racing applications. However, these systems typically start around $200-$300 and go up from there. Today I'll show you how to build a simple acceleration data logger that'll provide you with enough data to begin evaluating your driving technique, aerodynamic and mechanical efficiencies, and even your engine torque. (Calibration info will be in the video)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Benefits of Data Logging
So, why do we want to record data in the first place? Let's start with an example. More than likely many of you have done small upgrades to your car such as new air intake, new exhaust, etc. The company you bought the part from promises X more horsepower when you install the part, but when you drive your car afterwards you can't really tell how much you've gained if anything at all. Or maybe you've gone racing and couldn't tell what you were doing right on your faster laps and what you were doing wrong on your slower laps. In either case, a data logger allows you to observe what happened during your run using whatever sensors you decide to use. In this case, we'll be recording data from a 3-axis accelerometer. Even with just this one sensor we can tell a lot about our vehicle and our driving technique.
First let's look at just the accelerometer data. We can create a scatter plot of the lateral acceleration versus the linear acceleration over a given lap. This will give us a cluster of points which will show where the car's strengths are as well as how well we're following the traction circle. Overall, this plot is mostly useful for analyzing our own driving technique.
Next, we can start performing some basic tests. By finding a quiet road to do a pull from second gear, we can use the accelerometer to back calculate real world torque curves. (Keep in mind that rolling resistance and aerodynamic drag will alter this number. These can be found through a simple coast down test.)
Plotting acceleration versus time will allow us to further analyze our driving by showing where we gain and loose time from lap to lap.
And of course we can do simple comparisons in data to analyze various modifications we wish to test. So now that we've got an idea of the benefits of recording data, let's look at how to build an inexpensive data logger.
Step 2: Tools and Materials
To start we'll need the following:
- CD4050 Line Driver
- LM1117 3.3v Regulator
- L7805CV 5v Regulator
- ADXL335 Accelerometer
- 4 A-4516 .47microFarad Capacitors
- 28 Pin DIP Socket
- Prototype Board
- SD or Micro SD Socket (I used a micro SD adapter)
- Some Wire
The cheapest place to buy these parts is from Tayda Electronics. They have everything but the SD socket, which can either be purchased through Amazon or if you've got a spare micro SD adapter lying around that'll work too. Next we'll need some tools:
- Arduino Uno
- Soldering Iron
- Wire Strippers
A helping hands device will make the process easier if you've got one. If you like electronics projects like this and don't have one I highly recommend purchasing one. Also, some dielectric grease will help when working with the AtMega chips. They tend to be a but difficult to pull from their sockets and a little grease will save you a lot of headache down the road.
Step 3: Assembly and Code
We'll start by using an arduino to program the AtMega chip. Below is the complete code for reading the data from the accelerometer and writing it to the sd card. Arduino's tutorial does an excellent job of walking you through the process of programming the chip. In this case we'll be using the internal 8MHz clock. With no delay written into the code, the unit will write data to the card at 30-40Hz. Once the chip is programmed we can focus on putting the circuit together.
The circuit consists of four parts: the voltage regulator, the accelerometer, the micro controller, and the memory card.
The voltage regulator will consist of a 5v regulator to power the micro controller, a 3.3v regulator to power the sd card, accelerometer, and provide a reference for the micro controller, and some capacitors (caps) to filter out any fluctuations in the voltage coming in and coming out of the regulators. Soldering these components is pretty straight forward, just keep in mind that the pinout is different between the two regulators and be sure to check the polarity of the caps before soldering.
Assembling the accelerometer will include the accelerometer and two caps. I chose not to filter the z-axis as I'm not taking any measurements other than ride frequency using this axis. If you wish to look for specific frequencies the accelerometer's data sheet gives capacitance values to cut off a given frequency. Remember to connect the 3.3v line, not the 5v line to the sensor.
Soldering the micro controller may look intimidating, however keep in mind that we will not be using all of the pins. Pay close attention when making the connections in this step as the micro controller can easily be damaged if power is sent to the wrong pins. I would also highly recommend taking some dielectric grease and coating the pin slots in the socket. This makes it much easier to install and remove the chip and reduces the likelihood of damaging it in the process (I've actually had the slots pull out of the socket without the grease!).
Finally, there's the memory card circuit. This applies to the rest of the circuit, but especially when dealing with the memory card keep your wires as short as possible. I've found that this part of the circuit is very sensitive to noise and will act up if there's any questionable solder connections, excessively long wires, or anything else that could introduce noise into the circuit. So go slow and double check each connection as you go.
Step 4: Future Improvements
Overall I'm very happy with how this data logger turned out. After performing a number of tests and bringing it to several autocross events it has proven to reliable and accurate. However, I do plan on making a few improvements in the future. First, I'd like to improve the logging speed. 30-40Hz isn't bad for what I'm trying to measure, but I would prefer to be able to log around 100Hz. This will more than likely be a matter of reprogramming the controller a bit. I also plan on using a different accelerometer which also features a 3 axis gyro, this way I can record yaw acceleration as well as body roll and pitch. As I plan to use this logger to record more data such as wheel speed, throttle position, intake pressures and temperatures, I'd also like to implement an easy way to add or remove sensors to the system. I'll also likely print a case for the circuit board with a place to connect a 9v so that the logger can be easily moved from vehicle to vehicle. If you'd like to see these upgrades let me know in the comments below.