Sunday, December 25, 2011

Data Logging Part 3 - Data Logged !!!

I have finally logged some data to the SD Card. To make life super easy I am logging the data is CSV format, this is a very simple text based format that can be imported by any spreadsheet application, in my case I am using Excel. The charts are simply generated by selecting the data and clicking the Excel chart icon.

The first test - Figure of 8 and Max Acceleration, Max Braking.

This first chart plots the X,Y,Z Axis as red, orange, pink. I would not have expected to see much movement in the Z axis as the car is running on reasonably flat tarmac however I am running smaller tyres than normal and so the car is dragging on the road where I haven't yet raised the suspension to compensate. Bumping along small stones is one possible cause for the movement in the Z Axis. For the remaining charts I have removed the Z - Axis so that we can see whats happening in the X and Y Axis (lateral G-Force and acceleration/braking).


I am quite pleased with the data here. For the first half of the test I was driving in a steady figure of 8, you can see this in the graph where on the left side the pink (acceleration/braking) line is steady and the lateral G-Forces swing from positive to negative as the car corners to the left and then to the right.

For the second half of the test I changed to accelerating and braking, again this shows up clearly as the pink line now moves from the positive to the negative, accelerating to braking. Interestingly you can see that the M03 is able to brake much harder that it can accelerate - pretty much what you would expect but its nice to see it captured consistently. I can also see from the red line that at the end of my acceleration and braking runs I always turned to the right to start the next run. The final point of interest is that the test strip was on a slope, and you can see this in the acceleration and braking runs where the peak G-Force under braking is higher on the first and third runs (uphill) than on the second and fourth runs (downhill).


Scatter Graph
This last graph plots each data point on an X and Y Axis, with more data it should provide a reasonable representation of the traction circle.

Again you can see that I spent more time turning left and that the brake force was about 50% higher than the acceleration.
Thats the easy bit finished. Now I need to develop a test protocol to confirm the quality of the test data. I also need to run some tests comparing spinout data with controlled high speed cornering, its pretty useless data if spinouts can't be determined from successfully negotiated high speed corners.

Thursday, December 22, 2011

Data Logging Part 2 - A User Interface

My first attempt at a micro controller user interface -
I am pretty happy with it, its a thousand times better than the horrible interfaces you get on your average Electronic Speed Controller. Take the example of a Tamiya TEU104BK, the user interface consists of a single 1*2 mm grey button hidden in a 4mm recess in the case. The button and indicator light are in highlighted area in the pic below, a 10mm push button is included for size comparison.


While I have used a great big bright red 10mm push button, I haven't completely broken away from tradition, the interface still relies on the users ability to count and interpret a sequence of flashing lights. The reason for this is that mirco controllers provide a limited number of inputs and outputs. Each of these inputs/outputs can be extremely powerful so using them up with indicators, displays and multiple push buttons is an unacceptable waste of resources.

The data logger user interface


1 Big Red 10mm Push Button
1 Bright Red LED to signal 'Recording'
1 Bright Green LED to signal 'Sending recorded data over the serial interface'

The system has 5 states -

StateMeaningRecord IndicatorSerial Indicator
IdleNot currently doing anythingBrief flash every 2 secondsAs Record
RecordRecording Data to SD CardOnOff
SerialReading SD Data and writing to serialOffOn
Memory FullNo more data can be recordedOn 1 Second/Off 1 SecondAs Record
ErrorSomething is wrongRapid Alternate with SerialRapid Alternate with Record


To move between states the push button must be held for 1 second or more. To enter record from idle 1 Second, to enter Serial from idle 4 Seconds, to exit either record or idle 1 second.

All I need now is a Micro SD Card and the data logger is up and running.

Monday, December 19, 2011

Data Logging Part 1 - Acceleration

Its so easy to build circuits and programs with the Arduino that I have a few projects progressing side by side on the same hardware. In this project I intent to record performance data on board my RC Racer then upload the data for analysis on the PC. Something which I see as very simple but very useful is the ability to record and visualise the traction circle for different setups. For my purposes the traction circle will be plotted from the X and Y G-forces acting on my car, to sense and record these forces I am using an ADXL335 3-Axis Accelerometer and a Micro SD Card. Both of these are available on easy to use 'breakout' boards that can be plugged directly into the Arduino UNO.
The two plots above are produced from live data coming from the Arduino into my PC, I am using 'Processing' to display the results. The screen area represents +-1G in the X and Y Axis, Z is not plotted. The first plot is generated with the board flat on the table. The second plot is the result of me tapping the side of the table to generate some movement in the X-Axis, then tapping the front of the table to get some action on the Y-Axis, but the really interesting plot is the next one -

Here I have used the constant 1G acceleration provided by good old fashioned gravity. By tilting the board from one side to the other I can use gravity to apply 1G of acceleration to the left and then the right. You can see the result of this in the lines running right, up and down from the center. The diagonal line running from the center to the top right is the result of me trying to 'draw' the line by progressivley tilting the board and letting gravity do the work. This was surprisingly difficult, it had that addictive quality that the simplest of games have - something thats quick and easy to understand, takes a while to master and can always be improved upon. I can think up a dozen gaming applications for this - for example physical tetris where you actually have to rotate the controller to rotate the tiles and then swing the control to the left or right to position tiles. Another application would be target based sports simulations, the sensor is sensitive enough to pick up hand tremors.

Getting back to the main purpose of this project, the left side of the screen shows a sample of a traction circle I have generated by rotating the board which is sensing the constant 1G force of gravity over a range of angles. In practice most of the plot points would be toward the center of the screen but this provides a quick bench test and proof of concept. The sensor I am using can sense up to 3G, and also records the z-axis which I am recording but not currently plotting. I have no idea what to expect in the car, probably less than 1G but will get some plots up with different tyres in the next day or so - I know that racing tyres are worth every penny compared to stock tyres and soon I will be able to prove it !