Difference between revisions of "Current sensor"

From PaparazziUAV
Jump to navigation Jump to search
Line 6: Line 6:


[[Image:Example.jpg|thumb|right|float|Current sensor connected to the TWOG v1]]
[[Image:Example.jpg|thumb|right|float|Current sensor connected to the TWOG v1]]
Typically, the current sensor is used to measure the current flowing through the main battery (rather than the motor). Connect the + and - pole of the sensor through the battery red lead and the wire for the current measurement. The + and - have to be soldered directly to the cables which came from the power supply. The 3rd wire is connected to the "VI" pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On a TWOG v1 or Tiny v2 board, you connect the current sense output wire ("IA" on the AttoPilot sensor) to the ADC_3 or ADC_4 pin.
Typically, the current sensor is used to measure the current flowing through the main battery (rather than the motor). Connect the + and - pole of the sensor through the battery red lead. The + and - have to be soldered directly. A wire is connected to the "VI" pin on the Sparkfun breakout board. It must have a voltage between 0 and 3.3V. On a TWOG v1 or Tiny v2 board, you connect the current sense output wire ("IA" on the Sparkfun sensor) to the ADC_3 (or ADC_4) pin.
 
On the Novak Sentry current sensor, the red wire is connected to +5 volts. The black wire is ground. The yellow wire is the output (40mV/amp. 0.6v=0amps, 5.0v=110amps).


== Airframe integration ==
== Airframe integration ==
Line 18: Line 20:
   <define name="MILLIAMP_AT_FULL_THROTTLE" value="4000" unit="mA"/>
   <define name="MILLIAMP_AT_FULL_THROTTLE" value="4000" unit="mA"/>


The correct multiplier for the raw measurement conversion depends on the current sensor. The Sparkfun sensor returns a linear voltage of 0 V - 3.3 V and at 90.15 A it reaches the maximum of 3.3 V. The TWOG v1 or Tiny v2 have a A/D converter with 10-bit precision (1024 different values)to represent the voltage. So you can calculate the multiplicator with the following formula:
The correct multiplier for the raw measurement conversion depends on the current sensor. The Sparkfun sensor returns a linear voltage of 0 V - 3.3 V and at 90.15 A it reaches the maximum of 3.3 V. The TWOG v1 or Tiny v2 have a A/D converter with 10-bit precision (1024 different values) to represent the voltage. So you can calculate the multiplier with the following formula:


'''1000 / precision * A_at_max_voltage'''
'''1000 / precision * A_at_max_voltage'''
Line 24: Line 26:
For the Sparkfun sensor, the precision is 1024 and A_at_max_voltage is 90.15 => 1000/1024*90.15 = 88.037
For the Sparkfun sensor, the precision is 1024 and A_at_max_voltage is 90.15 => 1000/1024*90.15 = 88.037


For the ACS755LCB-100 sensor, there is a 0.6 volts offset. At 3.3v, the current is 67.5A. The formula is thus: <define name="MilliAmpereOfAdc(adc)" value="(*(adc-186)"/>
For the ACS755LCB-100 sensor, there is a 0.6 volts offset. At 3.3v, the current is 67.5A. The formula is thus: value="(80.55*(adc-186))"


In the makefile section, the following lines, "-DUSE_ADC_3" must be added (ADC_0 - ADC_2 are used for the IR sensors):
In the makefile section, -DUSE_ADC_3 (or -DUSE_ADC_4) must be added (-DUSE_ADC_0 and -DUSE_ADC_2 are used for the IR sensors):


   ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
   ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
   ap.srcs += $(SRC_ARCH)/adc_hw.c
   ap.srcs += $(SRC_ARCH)/adc_hw.c


== Display on ground station ==
== Display on Ground Control Station (GCS) ==
 
Use the Messages application to show it.
 
The total energy consumed during the flight (in mAh) is sent in the "BAT" message.


The total energy consumed during the flight (in mAh) is sent in the "BAT" message. Use the Messages application to show it.
The actual current flowing through the sensor (in mA) is sent in the "fbw_status" message.  
The actual current flowing through the sensor (in mA) is sent in the "fbw_status" message.  


You can display the energy or current on the GCS by just drag and drop them on the 2d map.
You can display the energy or current on the GCS by just dragging and dropping them on the 2d map.

Revision as of 13:39, 23 October 2009

It is very easy to get the Paparazzi system working with a current sensor.

Examples are the one from Sparkfun (AttoPilot Voltage and Current Sense Breakout Current sensor or a linear hall-effect device such as the Allegro ACS755. The Novak Sentry current sensor is based on the ACS755LCB-100 hall-effect sensor and has a range of 100A.

Hardware

Current sensor connected to the TWOG v1

Typically, the current sensor is used to measure the current flowing through the main battery (rather than the motor). Connect the + and - pole of the sensor through the battery red lead. The + and - have to be soldered directly. A wire is connected to the "VI" pin on the Sparkfun breakout board. It must have a voltage between 0 and 3.3V. On a TWOG v1 or Tiny v2 board, you connect the current sense output wire ("IA" on the Sparkfun sensor) to the ADC_3 (or ADC_4) pin.

On the Novak Sentry current sensor, the red wire is connected to +5 volts. The black wire is ground. The yellow wire is the output (40mV/amp. 0.6v=0amps, 5.0v=110amps).

Airframe integration

In the BAT section of the airframe file add these lines:

 <define name="ADC_CHANNEL_CURRENT" value="ADC_3" />
 <define name="MilliAmpereOfAdc(adc)" value="(88*adc)"/>

and remove the line:

 <define name="MILLIAMP_AT_FULL_THROTTLE" value="4000" unit="mA"/>

The correct multiplier for the raw measurement conversion depends on the current sensor. The Sparkfun sensor returns a linear voltage of 0 V - 3.3 V and at 90.15 A it reaches the maximum of 3.3 V. The TWOG v1 or Tiny v2 have a A/D converter with 10-bit precision (1024 different values) to represent the voltage. So you can calculate the multiplier with the following formula:

1000 / precision * A_at_max_voltage

For the Sparkfun sensor, the precision is 1024 and A_at_max_voltage is 90.15 => 1000/1024*90.15 = 88.037

For the ACS755LCB-100 sensor, there is a 0.6 volts offset. At 3.3v, the current is 67.5A. The formula is thus: value="(80.55*(adc-186))"

In the makefile section, -DUSE_ADC_3 (or -DUSE_ADC_4) must be added (-DUSE_ADC_0 and -DUSE_ADC_2 are used for the IR sensors):

 ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
 ap.srcs += $(SRC_ARCH)/adc_hw.c

Display on Ground Control Station (GCS)

Use the Messages application to show it.

The total energy consumed during the flight (in mAh) is sent in the "BAT" message.

The actual current flowing through the sensor (in mA) is sent in the "fbw_status" message.

You can display the energy or current on the GCS by just dragging and dropping them on the 2d map.