Difference between revisions of "Current sensor"

From PaparazziUAV
Jump to navigation Jump to search
(Redirecting to Sensors/Current)
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.
#REDIRECT [[Sensors/Current]]
 
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.
 
 
== Hardware ==
 
[[Image:Example.jpg|thumb|right|float|Connected current sensor to the Twog]]
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels 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 the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.
 
== Airframe integration ==
 
Add to the adc section of the airframe file following line:
<define name="SUPPLY_CURRENT" value="ADC_3"/> With the right ADC where you connected the wire.
 
  <section name="adc" prefix="ADC_CHANNEL_">
    <define name="IR1" value="ADC_1"/>
    <define name="IR2" value="ADC_2"/>
    <define name="IR_TOP" value="ADC_0"/>
    <define name="IR_NB_SAMPLES" value="16"/>
    <define name="SUPPLY_CURRENT" value="ADC_3"/>
  </section>
 
Not sure the abouve lines are really necessary ( i will check it later).
 
In the BAT section add this lines:
 
  <define name="ADC_CHANNEL_CURRENT" value="ADC_3" />
  <define name="MilliAmpereOfAdc(adc)" value="(88*adc)"/>
 
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:
 
'''1000 / precision * A_at_max_voltage'''
 
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 => 1000/1024*90.15 = 88.037
 
== Display on ground station ==
 
After following the instruction the energy consumed during the flight is send in the BAT message use the Messages application to show it.
In the fbw_status message the current value show the actual current flow through the current sensor.
 
You can display the energy or current on the GCS by just drag and drop them on the 2d map.

Latest revision as of 02:46, 18 December 2011

Redirect to: