Data Logging
Data Log From Rotary Racer at Finals Race1 in 2015
Knowledge is power, so they say. Well certainly when trying to improve the performance of a Greenpower car having reliable information on how the car is performing is very useful. The simplest method of doing this is to use simple lap timing with either a stopwatch or Greenpower's live timing system when at races. However, you can go further than this and measure and store more detailed data about the cars performance during a race. Data logging is used to store a sets of measurements taken at some repetitive rate, say once per second.There are four aspects to this:
- You have to choose and be able to measure the parameters of interest at some rate.
- You have to store these parameters in some non volatile memory (keeps the data even when the system is powered off).
- You have to be able to retrieve the data at some time in the future.
- You have to be able to analyse the data.
For Greenpower use it is useful to store samples of measured values like, Battery voltage, current, speed, distance, throttle position etc. as the car travels around a track. The samples are measured and then stored at a suitable rate for the type of use. We would recommend a rate of between 1s and 10s as this provides a good compromise between enough data, but not too much to save issues with storage size and speed of data transfer. This sort of time also allows measurements to be averaged for enough time to give meaningful values. We recommend storing each value in binary, rather than human readable ASCII text, to save space and make it easier for small microprocessors to do. However if you are using a more powerful computer such as a Beaglebone Black or Raspberry PI running the Linux OS, this would not be an issue.
Note that data logging can go hand in hand with telemetry. The same data you are writing to the data log can be sent by some wireless means back to a laptop computer in the pits for the pitside engineers to view. Telemetry normally only functions line of sight and over shortish distances, so you often won't get data from all around the circuit. The data log will however be storing all of the information for later retrieval.
Typical Parameters to be Measured
Date and Time | Some measure of the time of sample is needed. This can be the year, month, day, hour, minute and second values from a RTC (real time clock) chip, or perhaps a single 32bit value defining the number of seconds from some Epoch like that used by the Unix/Linux operating systems of 1970-01-01. |
Motor Current | The current being taken by the motor. This is one of the most important parameters for Greenpower as it gives a measure of the energy flow and can be used to gauge if you are using the right amount of power to last a race. It is typically measured using a Hall effect device such as the one on a GpSpeed controller. |
Battery Voltage | The battery voltage can give a guide into how much energy your battery has. It is difficult to judge from just the voltage as the battery voltage varies with charge level, current and temperature, but with some mathematical compensation can be used to good effect. See the information on batteries for this. |
Average Current | One of the most useful parameters. This is a calculation of the average current usage. The only question is over what period to average over. See the section on current measurement for more information. |
Distance | The distance can be measured using a simple cycle speedometer read relay with magnet system. This provides an electrical voltage pulse each time the wheel rotates a turn. You can simply increment a processors integer counter variable to store this, but make sure you don't overrun the counters maximum value ... |
Speed | This can be measured again using a simple cycle speedometer read relay with magnet system. It can be calculated using the formula speed = distance/time on the cars computer. Note you could leave this value out of the data log and calculate it later using the time and distance values stored. |
Throttle | If you have a variable speed throttle, storing its level perhaps as a percentage from 0 to 100 can be useful. It is a useful measure of how well the driver is using the power available. |
Motor Temperature | Monitoring the motor temperature can be useful, especially if you have fans cooling it. It can provide information on how well your cooling system is doing. |
Brakes | Monitors the brake light switch to see when drivers are braking etc. |
Charge | A value for the amount of energy remaining in the battery as calculated by some algorithm in the cars computer |
GPS Position | If you have a GPS unit in the car this can store the X, Y, Z location of the car |
Power Setting | If you have some means to restrict the cars power, a variable resistor knob for example, this can record the setting in use |
Gear | If you have changeable gearing this can record which gear is in use, alternatively the Motors RPM can be stored and compared with the cars Speed to determine this |
A Set of data samples
If using binary with a small microprocessor, typically 16bit or 8bit sample values are useful scaled so as to give the best resolution available (fixed point). Given this a suitable set of data samples could have the following structure:
Name | Size | Usage |
---|---|---|
Date | 24bits | Date: year, month, day |
Time | 24bits | Time: hour,minute,second |
Voltage | 16bits | The battery voltage scaled by 100. So 2410 is 24.10 Volts. |
Current | 16bits | The motor current scaled by 100. So 16.50 is 15.50 Amps |
Distance | 16bits | The distance perhaps in wheel rotations or 10m increments |
Speed | 16bits | The speed in km/hour scaled by 100. So 4860 is 48.6 km/hour. |
Throttle | 8bits | The throttle position 0 to 100% |
Temp | 8bits | The motors temperature in degrees. |
The total size of this sample "packet" would is 16 bytes. It makes things easier in software/hardware to use sizes that are a binary multiple.
Assuming a sample rate of 1 second the GpSpeedDataLog can store 524288 / 16 = 32768 sets of samples. This would be: 32768 / (60 * 60) = 9 hours worth of data.
For a typical Greenpower racing day you need storage for about: (Practice: 1.0 hours + race1: 1.5 hours + race2: 1.5 hours = 4 hours).
So the GpSpeedDataLog could store 32byte sample packets at a rate of 1 second per packet to store all of the data for one days practice and racing.
Software
Some software is needed both at the car end and at the pitside Laptop, tablet or phone to recieve the data and display it in a suitable form.
See the section on software for more info.
Further Information
GpSpeedDataLog | A small PCB module for the GpSpeed speed controller to store measurement data |
Wikipedia | Wikipedia information on data logging |
BBC | BBC information on data logging |
Rotary Racer data logs | Rotary Racers data logs from various races |