Module/Airspeed ETS

= Introduction =
Modules
The EagleTree Airspeed Sensor is a low cost module and comes with a good pitot tube (Prandtl style, pitot-static tube) that includes static and dynamic ports. It has an I²C interface that connects directly to the Autopilot I²C port.
NOTE: the sensor has two operating modes which determine what value is sent to the autopilot. In the default mode the pressure diference between the 2 ends of the pitot is sent. Supposedly this could be used to calculate airspeed but in reality temperature must also be taken into account. The rest of this page assumes that a temperature reading is not needed and the usefullness is in question. Do not use it for any serious stuff.<BR>
In the other mode, called "third party mode", the actual speed value is sent as shown in the sensor. The sensor is said by the manufacturer to take temperature into account to arrive at this value so this should be used as the correct speed. Unfortunately the Paparazzi code does not work in this mode and additional hardware (an EagleTree elogger) is needed to put the sensor in this mode.
Module name 	sensors/airspeed_ets
Sensor type 	air speed
Range 	4m/s .. 150m/s
Resolution 	0.3m/s
Refresh rate	10Hz
I2C address 	0xEA
Product data sheet
= Hardware =
The sensor can directly be connected to an I2C port of and autopilot. The + supply voltage can be between 3V and 16V. 
When you buy the airspeed sensor it is set to operate in the default mode. 
Caution! Make sure you did not set it somehow to 3rd party mode.
== Wiring ==
The ETS Airspeed sensor has an I2C cable with the following layout:
Tiny/TWOG I2C pin	Autopilot I2C	ETS Airspeed wire colour
1 	GND 	white
2 	+5V 	red
3 	+3.3V 	
4 	SDA 	yellow
5 	SCL 	brown
Please refer to your boards documentation to find out the correct pinout on your board (which cable to connect to which pin). 
As an example the correct pinout for the TWOG v1.0 and Tiny has been given in the table above.
= Usage =
Please refer to the generated docs for the exact configuration options of the version you are using!
http://docs.paparazziuav.org/latest/module__airspeed_ets.html
To use it load the airspeed_ets module:
For versions older than v5.8
For versions older than v5.8, also define the used I2C device:
Depending on your board and the I2C interface you are using, you may need to
enable I2CX, where X is 0,1,2,etc., if you are not using it already:
== Configuration ==
You can also set some optional parameters to change the default configuration. 
For example to use I2C1 instead of I2C0, a scale of 1.44 (default is 1.8) and offset of 50 (default is 0) is needed:
== Usage as sensor for speed control ==
To use the sensor to control the speed of your aircraft add the aggressive climb flag, define which I2C device you are enabling and enable airspeed control:
Where ofcourse the board value is just an example here, use the name of the hardware you use.
=== Airframe configuration ===
 
Now to use real airspeed values for adjusting your aircraft autopilot behavior there are several way to accomplish this. A simple classic way is to add the following to the end of the "VERTICAL CONTROL" section of your airframe file:
 
Note that the SETPOINT values may need to be adjusted to suit your aircraft.
Note that depending on whether you set the AIRSPEED setpoint or the GROUNDSPEED setpoint higher, either constant airspeed or constant groundspeed, respectively, will be the goal of the controller.
See paparazzi/conf/airframes/easystar_ets_example.xml for an example airframe configuration.
Better even is to start using ETECS, Enhanced Total Energy Control System
Take a look at See ~/paparazzi/conf/airframes/examples/MentorEnergy.xml for an example airframe configuration.
=== Debugging and logging the airspeed values ===
To debug or log the raw values from the ETS airspeed sensor define AIRSPEED_ETS_SYNC_SEND in your airframe file to send the message AIRSPEED_ETS on every sensor reading. 
Note that defining this sends the AIRSPEED_ETS message at the sensor read rate as defined in conf/modules/airspeed_ets.xml. 
This does not have any bearing on the AIRSPEED message (if both AIRSPEED_ETS_SYNC_SEND and USE_AIRSPEED are defined, then both messages are sent). 
Caution! Please note: if you are using and old branch of before July 16, 2013, please replace AIRSPEED_ETS_SYNC_SEND with SENSOR_SYNC_SEND
Also note that as of 15 Oct 2023 the default debug message is no longer available in the PPRZlink messages.xml file.
Therefore to determine your possible sensor offset add this temporary debug message to the ~/paparazzi/sw/ext/pprzlink/message_definitions/v1.0/messages.xml
 <message name="AIRSPEED_ETS" id="57">
 <field name="adc" type="uint16"/>
 <field name="offset" type="uint16"/>
 <field name="scaled" type="float"/>
 </message>
After adding that don't forget that this is needed before you upload you firmware to the flightcontroller to make sure changes are included:
 make clean && make
The general airspeed can be displayed in the Messages tool by adding the AIRSPEED message to the telemetry file as follows:
The AIRSPEED_ETS message does NOT need to be added to the telemetry configuration since it is sent directly by the module if AIRSPEED_ETS_SYNC_SEND is defined.
=== NOTES ===
# In the GCS, the strip displays ground speed and not airspeed by default. In order to display airspeed, drag-and-drop the airspeed message field from the Messages tool onto the 2D map of the GCS. 
# The telemetry name AIRSPEED" should actually be called SPEED and contains Groundspeed and airspeed return values.
== Measurement only ==
To use the sensor for airspeed measurement is also possible. This Measurement only mode does thus not input to the control loops to have effect to the aircraft behavior.
To see the sensors data in the log file set the SENSOR_SYNC_SEND in your airframe file. Every time new data is available it will be sent directly.
Caution!Please note: if you are using and old branch of before July 16, 2013, please replace AIRSPEED_ETS_SYNC_SEND with SENSOR_SYNC_SEND
===Result message===
The raw data (adc), estimated offset at init time (offset) and the converted result (scaled) is written to the log file.
Sample log file lines
 149.529 123 AIRSPEED_ETS 1626 1606 8.024844
 149.633 123 AIRSPEED_ETS 1626 1606 8.024844
 149.730 123 AIRSPEED_ETS 1627 1606 7.942226
 149.841 123 AIRSPEED_ETS 1628 1606 7.942226
=Issues= 
Some people report that the sensor only works after a fresh upload, not after a regular power on. Adding a AIRSPEED_ETS_START_DELAY setting could help getting it to work. For this to work need at least version 5.2 of Paparazzi.
Add the following to your module part in your airframe XML document. Where value can be anything from 0.01 to 4seconds. Some users report that a value of 1 fixes the issue for them.
 <module name="airspeed_ets">
 
 ...
 <define name="AIRSPEED_ETS_START_DELAY" value="1"/>
 ...
 
 </module>
Category:User_Documentation Category:Modules