Link Search Menu Expand Document

Using VOXL ESCs with PX4

Table of contents

  1. Overview
  2. PX4 1.14 and Newer (eg. VOXL2) using Voxl ESC
    1. Actuator Setup using QGC
      1. Example Screen Shot with Labels
      2. Instructions using QGC
    2. Actuator Setup Using Command Line
    3. Actuator Testing Using Command Line
    4. PX4 Params (1.14 and newer)
  3. PX4 1.14 and Newer (eg. VOXL2) using Modal IO
    1. Actuator Setup using QGC
      1. Example Screen Shot with Labels
      2. Instructions using QGC
    2. Actuator Setup Using Command Line
    3. Actuator Testing Using Command Line
    4. PX4 Params (1.14 and newer)
  4. PX4 1.13 and Older
    1. Overview
    2. Video Tutorial
    3. Hardware Connections
    4. PX4 Setup (1.13 and older)
      1. Enable UART ESC
        1. TELEM3
    5. PX4 Params (1.13 and older)
    6. RGB LED Codes
  5. Debugging Tips
    1. Setting Up PX4 Motor ID to UART_ESC_MOTORX
  6. Development

Overview

The VOXL 2, VOXL Flight and Flight Core systems provides the ability to easily and quickly interface with UART ESCs. The following guide provides you the necessary details on doing so.

PX4 1.14 and Newer (eg. VOXL2) using Voxl ESC

The modal_io driver was renamed to voxl_esc starting in SDK 1.1.1 and voxl-px4 version 1.14.0-2.0.58 or newer, additional information can be found in the release notes. The voxl_esc driver is used to interface with the VOXL ESC and can be configured using the QGroundControl Actuators tab or manually using the command line on target.

The driver is located at src/drivers/actuators/voxl_esc.

Actuator Setup using QGC

Example Screen Shot with Labels

WARNING - we’ve not yet seen the “Identify & Assign Motors” work with any flight controller at the time of this writing so please do not rely on using this.

Instructions using QGC

  • Click on the Actuators tab
  • In the Configure drop down (#1 in graphic above), select VOXL ESC
    • reboot the vehicle
  • Inspect the wiring of your ESC to motors, e.g.:

  • Use this for configuring the ESC Function (#2 in graphic). Note the silkscreen is 0 based… In the following example we have:
    • silksreen ID0 –> ESC 1 –> wired to PX4 motor 1 –> ESC 1 = Motor 1
    • silksreen ID1 –> ESC 2 –> wired to PX4 motor 4 –> ESC 2 = Motor 4
    • silksreen ID2 –> ESC 3 –> wired to PX4 motor 2 –> ESC 3 = Motor 2
    • silksreen ID3 –> ESC 4 –> wired to PX4 motor 3 –> ESC 4 = Motor 3
  • Do not use “Rev Range” option
  • Configure the Bitrate if needed (#3). For VOXL2, the default is 2000000, for FCv1/v2, use 250000.
  • Configure the RPM Min and RPM Max based on your motor selection
  • Using the Actuator Testing section, you can enable using a slider (#4) and use the motor sliders (#5) to spin the motors manually
    • Note: currently VOXL2 needs to use command line for this
  • If needed, change the ESC Spin Direction for a given ESC ID (#6)

Actuator Setup Using Command Line

  • Configure mapping using VOXL_ESC_FUNCX params, where:
    • Motor 1 = 101
    • Motor 2 = 102
    • Motor 3 = 103
    • Motor 4 = 104
  • In the above example, we’d have:
    VOXL_ESC_CONFIG = 1
    VOXL_ESC_MODE = 0
    VOXL_ESC_FUNC1 = 101
    VOXL_ESC_FUNC2 = 104
    VOXL_ESC_FUNC3 = 102
    VOXL_ESC_FUNC4 = 103
    VOXL_ESC_SDIR1 = 0
    VOXL_ESC_SDIR2 = 0
    VOXL_ESC_SDIR3 = 1
    VOXL_ESC_SDIR4 = 0
    VOXL_ESC_RPM_MAX = 8000
    VOXL_ESC_RPM_MIN = 3000
    

Actuator Testing Using Command Line

  • To spin motor 1 at 10% for 1 second, the following command can be used, in which we’d expect the front right motor to spin:

    actuator_test -m 1 -v 0.1 -t 1

PX4 Params (1.14 and newer)

The following are the PX4 parameters that are used by the voxl_esc driver:

NameDescriptionMin > Max (Incr.)DefaultUnits
VOXL_ESC_CONFIGUART ESC Configuration
Values:
- 0: Disabled
- 1: VOXL ESC

Reboot Required
 0 (Disabled) 
VOXL_ESC_BAUDBaud rate between FlightController and Actuator(1)250000Bits/sec
VOXL_ESC_FUNC1info0, 101-1040 
VOXL_ESC_FUNC2info0, 101-1040 
VOXL_ESC_FUNC3info0, 101-1040 
VOXL_ESC_FUNC4info0, 101-1040 
VOXL_ESC_SDIR1Reverse spin direction of ESC ID 00 > 10 
VOXL_ESC_SDIR2Reverse spin direction of ESC ID 10 > 10 
VOXL_ESC_SDIR3Reverse spin direction of ESC ID 20 > 10 
VOXL_ESC_SDIR4Reverse spin direction of ESC ID 30 > 10 
VOXL_ESC_RPM_MAXMaximum RPM, used by actuator output to determine thrust fullscale.(1)15000RPM
VOXL_ESC_RPM_MINMinimum RPM, used by actuator output to determine thrust fullscale.(1)5500RPM

The following are use to control “Turtle Mode” (flip over after crash, which is currently in test):

NameDescriptionMin > Max (Incr.)DefaultUnits
VOXL_ESC_MODEUART ESC Mode:
Values:
- 0: None
- 1: Turtle Mode enabled via AUX1
- 2: Turtle Mode enabled via AUX2
Reboot Required
0 > 20 
VOXL_ESC_T_PERCTurtle Mode Crash Flip Motor Percent (percentage of motor range to use in flip over mode)1 > 100
(1)
90Percentage (as int)
VOXL_ESC_T_DEADPercentage of fullscale RPM that is in a deadband when in Turtle mode1 > 100
(1)
20Percentage (as int)
VOXL_ESC_T_MINFMinimum stick percentage in the dead zone needed to move0.0 > 1.00
(0.01)
0.15Percentage (as float)
VOXL_ESC_T_EXPOFlip power expo value1 > 100
(1)
35Percentage (as int)
VOXL_ESC_COSPHIValue used to specify the sensitivity for isolating a single motor for spinning0.000 > 1.000
(0.001)
0.990Percentage (as float)

PX4 1.14 and Newer (eg. VOXL2) using Modal IO

The UART ESC / modalai_esc driver was renamed to modal_io starting in 1.14. The modal_io driver is used to interface with the VOXL ESC and can be configured using the QGroundControl Actuators tab or manually using the command line on target.

The driver is located at src/drivers/actuators/modal_io.

Actuator Setup using QGC

Example Screen Shot with Labels

WARNING - we’ve not yet seen the “Indentify & Assign Motors” work with any flight controller at the time of this writing so please do not rely on using this.

Instructions using QGC

  • Click on the Actuators tab
  • In the Configure drop down (#1 in graphic above), select VOXL ESC
    • reboot the vehicle
  • Inspect the wiring of your ESC to motors, e.g.:

  • Use this for configuring the ESC Function (#2 in graphic). Note the silkscreen is 0 based… In the following example we have:
    • silksreen ID0 –> ESC 1 –> wired to PX4 motor 1 –> ESC 1 = Motor 1
    • silksreen ID1 –> ESC 2 –> wired to PX4 motor 4 –> ESC 2 = Motor 4
    • silksreen ID2 –> ESC 3 –> wired to PX4 motor 2 –> ESC 3 = Motor 2
    • silksreen ID3 –> ESC 4 –> wired to PX4 motor 3 –> ESC 4 = Motor 3
  • Do not use “Rev Range” option
  • Configure the Bitrate if needed (#3). For VOXL2, the default is 2000000, for FCv1/v2, use 250000.
  • Configure the RPM Min and RPM Max based on your motor selection
  • Using the Actuator Testing section, you can enable using a slider (#6) and use the motor sliders (#7) to spin the motors manually
    • Note: currently VOXL2 needs to use command line for this
  • If needed, change the ESC Spin Direction for a given ESC ID (#8)

Actuator Setup Using Command Line

  • Configure mapping using MODAL_IO_FUNCX params, where:
    • Motor 1 = 101
    • Motor 2 = 102
    • Motor 3 = 103
    • Motor 4 = 104
  • In the above example, we’d have:
    MODAL_IO_CONFIG = 1
    MODAL_IO_MODE = 0
    MODAL_IO_FUNC1 = 101
    MODAL_IO_FUNC2 = 104
    MODAL_IO_FUNC3 = 102
    MODAL_IO_FUNC4 = 103
    MODAL_IO_SDIR1 = 0
    MODAL_IO_SDIR2 = 0
    MODAL_IO_SDIR3 = 1
    MODAL_IO_SDIR4 = 0
    MODAL_IO_RPM_MAX = 8000
    MODAL_IO_RPM_MIN = 3000
    

Actuator Testing Using Command Line

  • To spin motor 1 at 10% for 1 second, the following command can be used, in which we’d expect the front right motor to spin:

    actuator_test -m 1 -v 0.1 -t 1

PX4 Params (1.14 and newer)

The following are the PX4 parameters that are used by the modal_io driver:

NameDescriptionMin > Max (Incr.)DefaultUnits
MODAL_IO_CONFIGUART ESC Configuration
Values:
- 0: Disabled
- 1: VOXL ESC

Reboot Required
 0 (Disabled) 
MODAL_IO_BAUDBaud rate between FlightController and Actuator(1)250000Bits/sec
MODAL_IO_FUNC1info0, 101-1040 
MODAL_IO_FUNC2info0, 101-1040 
MODAL_IO_FUNC3info0, 101-1040 
MODAL_IO_FUNC4info0, 101-1040 
MODAL_IO_SDIR1Reverse spin direction of ESC ID 00 > 10 
MODAL_IO_SDIR2Reverse spin direction of ESC ID 10 > 10 
MODAL_IO_SDIR3Reverse spin direction of ESC ID 20 > 10 
MODAL_IO_SDIR4Reverse spin direction of ESC ID 30 > 10 
MODAL_IO_RPM_MAXMaximum RPM, used by actuator output to determine thrust fullscale.(1)15000RPM
MODAL_IO_RPM_MINMinimum RPM, used by actuator output to determine thrust fullscale.(1)5500RPM

The following are use to control “Turtle Mode” (flip over after crash, which is currently in test):

NameDescriptionMin > Max (Incr.)DefaultUnits
MODAL_IO_MODEUART ESC Mode:
Values:
- 0: None
- 1: Turtle Mode enabled via AUX1
- 2: Turtle Mode enabled via AUX2
Reboot Required
0 > 20 
MODAL_IO_T_PERCTurtle Mode Crash Flip Motor Percent (percentage of motor range to use in flip over mode)1 > 100
(1)
90Percentage (as int)
MODAL_IO_T_DEADPercentage of fullscale RPM that is in a deadband when in Turtle mode1 > 100
(1)
20Percentage (as int)
MODAL_IO_T_MINFMinimum stick percentage in the dead zone needed to move0.0 > 1.00
(0.01)
0.15Percentage (as float)
MODAL_IO_T_EXPOFlip power expo value1 > 100
(1)
35Percentage (as int)
MODAL_IO_COSPHIValue used to specify the sensitivity for isolating a single motor for spinning0.000 > 1.000
(0.001)
0.990Percentage (as float)

PX4 1.13 and Older

Overview

NOTE! This feature is currently in developer preview and requires you to load the PX4 FW from a branch

Video Tutorial

For those of you who prefer videos, we have a video tutorial here that covers the software configuration and usage. Note, you’ll want to look at the hardware connections below as that part is skipped in this video.

TL;DR

Hardware Connections

The guide here describes the connectivity: VOXL ESC v2 Manual

PX4 Setup (1.13 and older)

Enable UART ESC

To enable the UART ESC feature, set the UART_ESC_CONFIG parameter to a value of 1 and power cycle the vehicle.

You can use QGroundControl’s Parameter feature to query and modify the UART_ESC params.

The remainder of the settings can be left as default if you followed the hardware connections described in the previous section.

TELEM3

The UART ESC uses /dev/ttyS1, same as TELEM3. On bootup, if any MAVLink instance is configured to use TELEM3, it will be disabled via boards/modalai/fc-v1/init/rc.board_defaults.

PX4 Params (1.13 and older)

See the section above for 1.14, replacing MODAL_IO prefeix with UART_ESC, for example MODAL_IO_CONFG in 1.13 and older is UART_ESC_CONFIG.

RGB LED Codes

This is currently a work in progress. The standard LED codes should output to the all the LED channels in a similar way as other PX4 RGB LED peripherals with the exception that the breathing pattern is replaced by a fast blink.

Debugging Tips

Setting Up PX4 Motor ID to UART_ESC_MOTORX

Say you have the following:

M0049 silkscreen ID0 channel –> wired to a motor at PX4 Motor ID 2 M0049 silkscreen ID1 channel –> wired to a motor at PX4 Motor ID 3 M0049 silkscreen ID2 channel –> wired to a motor at PX4 Motor ID 1 M0049 silkscreen ID3 channel –> wired to a motor at PX4 Motor ID 4

Then you would have the following params set:

UART_ESC_MOTOR1 = 2 UART_ESC_MOTOR2 = 3 UART_ESC_MOTOR3 = 1 UART_ESC_MOTOR4 = 4

And you can test by spinning, for example, 1000 RPM for 64 command cycles:

# spin PX4 motor #1
modalai_esc -i 1 -r 1000 -n 64 rpm

# spin PX4 motor #2
modalai_esc -i 2 -r 1000 -n 64 rpm

# spin PX4 motor #3
modalai_esc -i 4 -r 1000 -n 64 rpm

# spin PX4 motor #4

Development

The PX4 Driver source code can be found on github