Configure your light module
To turn your drone into a show drone, you will most probably need a LED light module and you need to tell our firmware how to connect with the LED light of your drone.
Skybrush Live supports five methods to drive light modules at the moment:
-
LED lights connected directly to the servo outputs of the autopilot,
-
external LED lights controlled by MAVLink
DEBUG_VECT
messages, -
NeoPixel and ProfiLED strips driven via a single RC output channel,
-
external LED modules with an I2C interface,
-
external LED modules with an UART interface.
LED lights connected to servo outputs
A recommended open-source RGBW light module of this type dedicated for Skybrush is available on the Open Source Hardware Lab website (credits: @techventures-sean).
In this setup, the red, green, blue and the optional white channels of the LED light must be connected to the servo outputs of the autopilot. The function values associated with the four channels (R, G, B, W) are 107, 108, 109 and 106, respectively. So for example, if the red, green and blue channels are connected to servos 9, 10 and 11, you need to set the following parameters on the drone:
SERVO9_FUNCTION 107 SERVO10_FUNCTION 108 SERVO11_FUNCTION 109 SHOW_LED0_TYPE 6
If you also use a white channel, use value 106 for the appropriate SERVOx_FUNCTION
parameter (not 110).
If the servo channels are wired to the LEDs with inverted polarity (in other words, if the output color of the LED seems to be inverted compared to what you expect to see), set SHOW_LED0_TYPE
to 8 instead of 6.
External LED lights controlled by MAVLink messages
This setup assumes that your LED light responds to MAVLink DEBUG_VECT
messages where the name in the message is set to rgb
. The x
, y
and z
components of the message carry the RGB intensity values in the range 0-1. The LED light can be connected directly to one of the telemetry ports of the autopilot, or there may be a routing component between the LED light and the autopilot that takes care of forwarding the appropriate messages to the LED light.
Internally, the firmware identifies the telemetry ports with MAVLink channel indices. In the most common setup, the USB port of the flight controller is channel 0, the first telemetry port is channel 1 and the second telemetry port is channel 2. So, if the LED light is connected to telemetry port 1, use the following parameter setting:
SHOW_LED0_TYPE 1 SHOW_LED0_CHAN 1
If the LED light is connected to telemetry port 2, use the following parameter setting:
SHOW_LED0_TYPE 1 SHOW_LED0_CHAN 2
NeoPixel and ProfiLED strips
This setup assumes that a NeoPixel or ProfiLED strip is connected to one of the RC output ports of the autopilot. Each LED strip may contain multiple LEDs, but all the LEDs will be set to the same color at any moment in time.
If you have NeoPixel LEDs, start with the following parameter setting:
SHOW_LED0_TYPE 2
If you have ProfiLED strips, start with the following parameter setting:
SHOW_LED0_TYPE 3
Besides setting the LED type, you also need to tell the firmware how many LEDs are there on a single strip, and which RC channel to use. For instance, if the LED strip is on RC channel 6 and you have 16 LEDs:
SHOW_LED0_CHAN 6 SHOW_LED0_COUNT 16
External LEDs controlled with I2C
This setup assumes that there is an external microcontroller that takes care of driving the LEDs, and this microcontroller can be controlled by I2C transfers to a given I2C address. Skybrush allows you to specify the I2C address (and bus index) that the I2C transfers should be sent to. Each I2C transfer will contain three bytes, one for each of the red, green and blue channels, in this order. I2C transfers are initiated only when the color of the LED should change.
In order to use I2C LEDs, you need to set SHOW_LED0_TYPE
to 7 (I2C) and SHOW_LED0_CHAN
to the 7-bit I2C address of the microcontroller. (Note that if you are working with 8-bit I2C addresses, you need to ignore the last bit as it is always 0 for read transfers and 1 for write transfers). SHOW_LED0_COUNT
is (ab)used as the zero-based I2C bus index, so you need to set it to zero if your device is on the first I2C bus, 1 if it is on the second I2C bus and so on. A typical setup for a device listening at address 91 of bus 0 is therefore as follows:
SHOW_LED0_TYPE 7 SHOW_LED0_CHAN 91 SHOW_LED0_COUNT 0
External LEDs controlled with UART
This setup assumes that there is an external microcontroller that takes care of driving the LEDs, and this microcontroller can be controlled on an UART interface. Skybrush allows you to parametrize the UART port to be used.
In order to use UART-driven LEDs, you need to set SHOW_LED0_TYPE
to 9 (UART) and SHOW_LED0_CHAN
to the UART index to be used. For UART-driven LEDs, you also need to set the baud rate in SERIALx_BAUD
and set SERIALx_PROTOCOL
to "Scripting" to ensure that the UART is initialized. A typical setup for an UART-driven device connected to the first UART port at 115200 baud is as follows:
SHOW_LED0_TYPE 9 SERIAL1_BAUD 115 SERIAL1_PROTOCOL 28
So far the only drone type with UART-driven LEDS that we support is WGDrones, but the list can be extended upon request.