|
| 1 | +# Trisonica LI-550 Mini Wind Sensor Logger |
| 2 | + |
| 3 | +This Lua script reads and logs wind sensor data from the **Trisonica LI-550 Mini** ultrasonic wind sensor connected via serial. It decodes ASCII-formatted key-value pairs and logs the data using dynamic field tags on the `W3D` logging stream. |
| 4 | + |
| 5 | +For sensor details, visit: |
| 6 | +🔗 https://www.licor.com/products/trisonica/LI-550-mini |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +- Parses and logs ASCII data strings from the Trisonica LI-550 Mini in BIN logs |
| 11 | +- Logs fields using a dynamically generated tag list from the **first packet** |
| 12 | +- Ignores extraneous fields in subsequent messages not present in the first |
| 13 | +- Compatible with **ArduPilot scripting serial port** interface |
| 14 | +- Supports high-speed 230400 baud data stream |
| 15 | +- Uses BIN log name `W3D` for all data |
| 16 | + |
| 17 | +## Parameters |
| 18 | + |
| 19 | +Set the following parameters: |
| 20 | + |
| 21 | +| Parameter | Value | Description | |
| 22 | +|----------------|----------|--------------------------------| |
| 23 | +| `SCR_ENABLE` | `1` | Enable Lua scripting | |
| 24 | +| `SERIALx_PROTOCOL` | `28` | Scripting protocol for SERIALx | |
| 25 | + |
| 26 | + |
| 27 | +> Replace `SERIALx` with the appropriate serial port used on your hardware. |
| 28 | +
|
| 29 | +## Sensor configuration |
| 30 | + |
| 31 | +Use Trisonica's [CLI](logger:write) to configure the unit. On Linux, you can use `screen` to interract with the device: |
| 32 | +```bash |
| 33 | +screen /dev/ttyUSB0 230400 |
| 34 | +``` |
| 35 | +You should see data displayed. Enter configuration mode with `Ctrl+C`. |
| 36 | +You should now see data streaming stop and a terminal prompt `>`. |
| 37 | + |
| 38 | +Set the Trisonica sensor baudrate to **230400** in its configuration software using the `baudrate` command like so: |
| 39 | +```bash |
| 40 | +baudrate 230400 |
| 41 | +``` |
| 42 | + |
| 43 | +You must also **enable all fields you want to log**. A recommended set is as follows. See the `Enabled` column. |
| 44 | + |
| 45 | +```bash |
| 46 | +display |
| 47 | +``` |
| 48 | + |
| 49 | +``` |
| 50 | +----------------------------------------------------------------------------------------- |
| 51 | +| Name | Description | Tagged | Tag | Decimals | Enabled | Units | |
| 52 | +----------------------------------------------------------------------------------------- |
| 53 | +| IDTag | ID Tag | Yes | | | | | |
| 54 | +| S | Wind Speed 3D | Yes | S | 2 | | m/s | |
| 55 | +| S2D | Wind Speed 2D | Yes | S2 | 2 | | m/s | |
| 56 | +| D | Horiz Wind Direction | Yes | D | 0 | | Degrees | |
| 57 | +| DV | Vert Wind Direction | Yes | DV | 0 | | Degrees | |
| 58 | +| U | U Vector | Yes | U | 2 | Yes | m/s | |
| 59 | +| V | V Vector | Yes | V | 2 | Yes | m/s | |
| 60 | +| W | W Vector | Yes | W | 2 | Yes | m/s | |
| 61 | +| T | Temperature | Yes | T | 2 | Yes | C | |
| 62 | +| Cs | Speed of Sound | Yes | C | 2 | | m/s | |
| 63 | +| RHTemp | RH Temp Sensor | Yes | RHST | 2 | | C | |
| 64 | +| RH | RH Humidity Sensor | Yes | RHSH | 2 | | % | |
| 65 | +| H | Humidity | Yes | H | 2 | Yes | % | |
| 66 | +| DP | DewPoint | Yes | DP | 2 | | C | |
| 67 | +| PTemp | Pressure Temp Sensor | Yes | PST | 2 | | C | |
| 68 | +| P | Pressure Sensor | Yes | P | | Yes | hPa | |
| 69 | +| Density | Air Density | Yes | AD | | Yes | kg/m^3 | |
| 70 | +| LevelX | Level X | Yes | AX | | Yes | | |
| 71 | +| LevelY | Level Y | Yes | AY | | Yes | | |
| 72 | +| LevelZ | Level Z | Yes | AZ | | Yes | | |
| 73 | +| Pitch | Pitch | Yes | PI | 1 | Yes | Degrees | |
| 74 | +| Roll | Roll | Yes | RO | 1 | Yes | Degrees | |
| 75 | +| CTemp | Compass Temp | Yes | MT | 1 | | C | |
| 76 | +| MagX | Compass X | Yes | MX | | | | |
| 77 | +| MagY | Compass Y | Yes | MY | | | | |
| 78 | +| MagZ | Compass Z | Yes | MZ | | | | |
| 79 | +| Heading | Compass Heading | Yes | MD | 0 | Yes | Degrees | |
| 80 | +| TrueHead | True Heading | Yes | TD | 0 | Yes | Degrees | |
| 81 | +----------------------------------------------------------------------------------------- |
| 82 | +``` |
| 83 | + |
| 84 | +You can enable tags like so: |
| 85 | +```bash |
| 86 | +show T |
| 87 | +``` |
| 88 | + |
| 89 | +Or disable them from the data stream like so: |
| 90 | +```bash |
| 91 | +hide T |
| 92 | +``` |
| 93 | + |
| 94 | +You must not enable more than 12 outputs due to limitations in this script and ArduPilot's dataflash logger. |
| 95 | + |
| 96 | +Finally, increase the output rate to the maximum of **10 Hz**. |
| 97 | +```bash |
| 98 | +outputrate 10 |
| 99 | +``` |
| 100 | + |
| 101 | +Once configuration is complete, exit screen with |
| 102 | +```bash |
| 103 | +ctr+A k y |
| 104 | +``` |
| 105 | + |
| 106 | +If you take longer than a minute to configure, the unit will re-enter streaming mode. |
| 107 | + |
| 108 | +## SITL Testing |
| 109 | + |
| 110 | +You can connect a real serial device to SITL using a passthrough UART setup. |
| 111 | +For example, using SERIAL5 connected to ttyUSB0. |
| 112 | + |
| 113 | +```bash |
| 114 | +./Tools/autotest/sim_vehicle.py -v Plane --console --map -A "--serial5=uart:/dev/ttyUSB0" -D |
| 115 | +``` |
| 116 | + |
| 117 | +Then view the `W3D` entries in your favorite dataflash (BIN) log analyzer. |
| 118 | +For MAVExplorer, try graphing wind speeds against airspeed. |
| 119 | + |
| 120 | +```bash |
| 121 | +graph W3D.U W3D.W W3D.V ARSP.Airspeed |
| 122 | +``` |
| 123 | + |
| 124 | +## Future Improvements |
| 125 | + |
| 126 | +* Use the wind data as input to the EKF for wind speed |
| 127 | +* Use the Trisonica API to have ArduPilot configure the correct data outputs and rates |
0 commit comments