This simple project adds data logging abilities to a GpSpeed motor speed controller. It is a small daughter board that plugs into the GpSpeed's P4 connector. It includes 512 kBytes (524288 Bytes) of non volatile EEPROM memory that the GpSpeed can use to store data samples. It also has a real-time clock chip with small rechargeable battery to allow the date and time to be kept and stored with the data samples. It is easily used from either Picaxe basic or 'C' software running on the GpSpeed.
The board is powered from the GpSpeed's 5V supply and communicates with the GpSpeed's CPU over a simple I2C serial bus. The design can be manually built using a prototype board such as Vero board or we can provide a small PCB for £5.00 including P&P and VAT (just PCB components need to be purchased by you(about £10 + VAT)).
For Greenpower use, it is useful to store samples of measured values like, Battery voltage, current, speed, throttle position etc. as the car travels around a track. The samples can be measured and stored at a suitable rate for the type of use. We would recommend between 1s and 10s as this provides a good compromise between enough data and storage requirements as well as allowing measurements to be averaged for enough time to give meaningful values. We recommend storing each value in binary to save space. Typically 16 bit or 8 bit 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:
|Date||24bits||Date: year, month, day|
|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 traveled in 10's of metres|
|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.
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 32 byte sample packets at a rate of 1 second per packet to store all of the data for one days practice and racing.
If you also intend to use telemetry, it is worth calculating and adding some lap averaged data to the data packet. When using telemetry you are unlikely to get the data from all around the circuit. Perhaps you will only get it when the car is traveling close along the pit straight. If you calculate and store some critical parameters, such as the average current usage for a lap, then this will be provided in each telemetry packet. To average items over a lap you need to know when a lap is started/ended. We have used a GPS unit for this purpose, but instead a simple entry of the distance of a lap into the system can be used and the system can calculate the averape every time that disptance is passed. The unit would bee to be able to measure distance tranvvelled using a suitable cycle read relay or similar for this.
This circuit uses four 1MBit (128 kByte) I2C EEPROM chips (U1, U2, U3 and U4) to store the data samples. The are connected to the I2C communications bus so the GpSpeed computer can read and write data to them. Between the 4 EEPROM chips they can store up to 512 kBytes of data accessible on a per Byte basis.
There is also a DS1307 or equivalent real time clock chip that keeps a track of the date and time to the nearest second. It has a small rechargeable battery, BT1 that allows it to maintain the date/time even when the system is powered off. This battery is charged through the diode D1 and resistor R1. D1 make sure the battery does not discharge when the power is off and R1 limits the charge current to the battery. The crystal X1 runs at 32768 Hz (a convenient binary multiple of 1 second) and is used as the accurate time clock source. The DS1307 is connected to the I2C serial bus so that the GpSpeed's CPU can read and set the date/time.
The power for the board is provided from the GpSpeed's 5V line. It has 4 capacitors spread amongst the chips on the board to provide power for current spikes and thus smooth the power supply voltage level preventing glitches to the boards operation.
The components used are:
Note this component list is for the PCB based design and uses surface mount components for the IC's and crystal. For a Vero board based design through hole versions of these components would be required. For the IC's 8 pin, PDIP packages are available.
A temperature controlled soldering iron (soldering station) is best as this will reduce the likely hood of damage to the PCB while soldering. Non temperature controlled ones can heat the board to a temperature that damages the adhesive holding the copper tracks to the PCB. Something like the following are fine:
Farnell:TENMA 21-10115, 2064549, £37
RS: RS AT60D, Soldering Station, 220V ac 60W, 799-8939, £66
Maplin 60W Mains LCD Solder Station, Code: A55KJ, £40
Have a look at: http://www.pcb-soldering.co.uk/
The tools needed are:
Soldering iron with a fine tip. Ideally electronics temperature controlled type, this will reduce the likely hood of damage to the PCB.
Solder. Thin-ish multi-core solder. Solder paste is also an option.
A “solder sucker” is useful when the soldering goes wrong !
A length of “solder wick” is likely to be useful to remove excess solder.
Small side cutters.
A “helping hand” and/or PCB support tool can be useful to hold the board while soldering.
A multi-meter to test the board.
This lists a rough order in which to assemble the components onto the PCB. See the information in the GpSpeed manual and elsewhere on the Internet on soldering techniques. The design uses some relatively small surface mount devices to add a bit of difficulty! A fine tip soldering iron, thin solder and small tweezers as well as young eyesight is useful :) Some schools have used solder paster rather than solder and have siad this was easier for them.
Check that the 5V power line is not shorted by using a DVM set to ohms to measure the resistance between ground (One of the connectors odd numbered pins, and the anode of D1 (or across any of the capacitors). This should be higher that 500 Ohms.
The board can then be plugged into the GpSpeed controller's P4 connector. Pin 1 of both connectors should line up. It is difficult to put the board in the wrong way round as the PCB will hit components on the GpSpeed board.
There is a simple GpSpeed Picaxe test program named: gpspeed-test-datalog.bas that will perform a simple test of the board and provide a basic demonstration of its usage with Picaxe Basic.
Datasheets for the IC's used are at:
This provides some basic information on how to access and use the board from Picaxe Basic. It can obviously also be accessed when using the 'C' programming language if you are using this on a GpSpeed controller board.
See the Pixaxe manuals for how to access I2C devices and especially I2C EEPROM's and theBQ32000DR (like a DS1307) RTC chip.
We have provided a simple borad test program: gpspeed-test-datalog.bas which tests the board and shows basic access to the on-board chips and a demo program: gpspeed-demo-datalog.bas that gives an idea on how to use the board for data logging on a GpSpeed controller. These are in the GpSpeed software directory ../GpSpeed/softwarePicaxe
Some general pointers:
Once you have the data logger working and some simple low level software code to access it, you can now add this to the main GpSpeed running program. The functions you will want to provide are: