 Wiki Groups

# Voltage and Current Measurement

### Reasons

One of the core things to get right in a Greenpower race is to manage the average energy consumption of your car so that you just about use up all of the energy in the batteries. In order to do this we need to measure some things. The core electrical measurements will be the batteries voltage and the current being taken from the batteries.

### Basics

There are two sides to this. First you need to know how much energy your batteries actually have and second you need to measure the average energy taken from the batteries during the race.

The amount of energy contained within the batteries is relatively difficult to determine. It depends on the type of battery, its condition, how well charged it is, the temperature etc. However we can perform tests and measurements to get a usefully accurate figure. The core measurements to do this are voltage, current and temperature.

The voltage across the battery terminals is an indicator of their level of charge. But it is only an indicator and is subject to wild variations based on the current flowing, the batteries condition and the temperature of the batteries amongst other things.

Keeping a tally of  the average current being drawn from the battery allows us to determine how much energy has been used and thus (if we know how much energy the batteries contain) how much is left. This is a good measurement to manage the cars power during a race, but does need a good knowledge of your batteries condition and energy content.

For information on batteries and testing them see the Batteries and the TestRigs.html information.

### How to

Measuring voltage is relatively eay. There are many ways to do this. These include:

• Using an electrical multi-meter. This is the simplest method, multi meters are pretty cheap and readily available. These are best used in the workshop or at the end of a race to see how much energy was left in the batteries. Note that the cheaper multi meters are not that accurate. So you should either calibrate one against a known good meter or just use your readings in a relative fashion.
• Using an in-car voltmeter: You can either purchase a small LCD module to measure the voltage or design and make your own.
• In car volts and amps: Something like a WattsUp module can be used to measure both battery voltage and current.
• Use an on-board computer with measuring ability to measure and perhaps log the battery voltage and current. Something like the GpSpeed controller kit can do this.

### DIY Voltage Measuring

Commonly a small Micro-controller device such as a PIC processor, an Atmel device as used in Ardinos or an ARM based chip will be used to perform measurements. These devices have an analogue to digital convertor in them that allows the conversion of a voltage into a digital number. Greenpower uses two 12 Volt batteries connected in series to produce 24 Volts. It is likely any electronics device will only allow a 0 - 5V range to be input (pr peehaps 0 - 3.3V) and so the 0 - 24V range of the batteries has to be reduced using a simple resistive potential divider. This circuit has a capacitor across its output. This is to filter out noise on the voltages measurement so the final reading is more stable.

### DIY Current Measurement

There are two main ways of measuring a current. One is to place a small valued resistor in series with the current flow and measure the voltage drop across it caused by the resistance to the flow of current (I = V / V (Ohms Law)). This can be problematic for the battery current in Greenpower. The motor can, in a stalled starting from the grid condition, take over 130 Amps which is a lot of current. In order to measure this level of current a very small resistor value is needed, perhaps 0.0001 ohms, otherwise the resistor will heat up enormously and loose lots of battery energy even if it doesn't blow up. Also the amount of measured voltage is likely to be low (perhaps 0 - 0.013 Volts. This would need amplification before using a micro processors ADC to measure it. However this method is possible.

A more useful and efficient method is to use a Hall Effect device. This measures the current by measuring the magnetic field produced by the current flow. They are available to mount on a PCB and take the current through their pins or have a hole to allow the wire carrying the current to be passed through. Some, like the one on the GpSpeed controller, have in-built amplification and signal conditioning to provide a simple variable voltage proportional to the current flow.

### Current Averaging

Its not often good enough to be able to measure just the instantaneous current flowing into the motor. As a Greenpower car travels around a track the current used can vary wildly due to wind and hills as well as slowing down and speeding up. (See rotary racers data logging data at: http://www.greenpower.beamweb.co.uk/files/RotaryRacer/performance). The current can vary from 8 Amps to over 40 Amps in a single lap as the car goes into/down wind and/or up/down hills. So it can be very difficult for a driver or the pitside engineer via telemetry data to determine what overal current is being taken from the batteries.

Ideally what we need is some form of averaged current reading. The question is over what period to average over. Some ideas:

• Overall current average for the race: This is easy to calculate. Just measure the time of the race and sum the current say, every second,  into a suitable total register say avgCurrent. The average current at any point is the value in the avgCurrent register divided by the number of instantainious current values added. Some problems with this is that early in the race the average current is high as a lot was used getting the car up to speed, so it is difficult to determine if you are actually racing with a reasonable current. Also later in the race, changes to current do not have much effect on the overall average current value so it is difficult to see if the current being used is ok to last the race.
• Average current per lap: This is probably the best current average as it gives you lap by lap how much energy you are using. This allows to to increase or decrease energy usage as needed. To do this you would again sum the current into a suitable total register say avgCurrent and then at the end of each lap divide this value by the number of instantainious current values added. This avgCurrentLap value can then be displayed to the driver and sent over a telemetry link with the other data. The problem here is how to determine when a lap starts/ends. The driver could press a button which is not good from a saferty/reliability perspective, an automatic scheme based on a GPS position can be used or a programmed in lap distance can be used were the car computer has a distance measurement function. Unfortunately sending data to the car via telemetry is disallowed under Greenpower rules, so that option is not available. The distance based one is the easiest to implement.
• Rolling Average: This can calculate a rolling average (average over the last n metres). However this often is not ideal due to the greatly varying current over a lap.

### Current Average Per Lap Distance

This is probably the easiest way to implement current averaging. To implement this the cars electronics need a method of measuring distance. This is normally performed by counting the pulses from a cycle computer type reed magnetic switch. The measured instantainious current is then summed into a total register counting how many have been added. Once the lap distance has been covered the total register is divided by the number added to yield the average current per lap. So we have the following processes happening (in rough 'C' programiing language code):

Init

distance = 0;

distanceLap = 2300; // The number of wheel rotations per lap

avgCurrent = 0;;

avgCurrentNumber = 0;

avgCurrentLap = 0;

On wheel relay pulse:

distance = distance + 1;

Once per second (or perhaps 10 seconds)

current = measureCurrent(); // Measure the current

avgCurrent = avgCurrent + current; // Sum the currents

avgCurrentNumber = avgCurrentNumber + 1;

if(distance >= distanceLap){

avgCurrentLap = avgCurrent / avgCurrentNumber;

avgCurrentLap = 0;

avgCurrentNumber = 0;

distance = 0;

}

Note that some of these variables will need to store quite large numbers. The distance and average toral registers will probably need to be 32bit. So when using smaller 8 or 16 bit micocrontrollers using some programming languages, more work has to be done to implement these 32bit storage registers (Picaxe).

### Pupil Work

• Get to use and understand a multi-meter.
• Understand how batteries work
• Understand voltage and current and energy flow