Configure your light module
First of all, you need to tell our firmware how to connect with the LED light of your drone. Skybrush Live supports four methods 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, or external LED modules with an I2C interface.
In this setup, the red, green and blue channels of the LED light must be connected to the servo outputs of the autopilot. The function values associated with the three channels (R, G, B) are 107, 108, 109, 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 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.
This setup assumes that your LED light responds to MAVLink
DEBUG_VECT messages where the name in the message is set to
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
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:
If you have ProfiLED strips, start with the following parameter setting:
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
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