# Neopixel Integration with PX4

Source: https://forum.modalai.com/topic/4724/neopixel-integration-with-px4
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2-io
Posted: 2025-09-03 13:49:36 UTC by jakkkkobo
Replies: 2 · Views: 1563

## jakkkkobo · 2025-09-03 13:49:36 UTC

Re: [Neopixel GPIO control on VOXL2 SPI port](/topic/3702/neopixel-gpio-control-on-voxl2-spi-port)

Hello all,

We have been trying to integrate Neopixel on io_0 and io_3 in PX4 to control with "led_control" and, in case not possible,  with voxl-send-neopixel-cmd. 
However, with voxl-send-neopixel-cmd, we can't define color, just turn the RGB strip on or change the number of LEDs. When trying to use it on PX4 with "voxl-esc led -l 0x001", it does not run, due to the modal_io_bridge priority.

system-image 1.7.8-M0054-14.1a-perf
hx platform: M0054 1.0.0
voxl-suite:1.3.2

Thank you in advance for any help!

Regards,
Jacob

## Reply by Alex Kushleyev (ModalAI staff) · 2025-09-05 02:14:45 UTC

@jakkkkobo ,

The source code of `voxl-send-neopixel-cmd` test tool is here : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-io-server/-/blob/master/tools/voxl-send-neopixel-cmd.c

The function that creates a binary packet (which is forwarded to the ESC via PX4) is here : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-io-server/-/blob/master/lib/modal_io.c#L181 . Basically you need to provide the following information to this function:
- number of LEDs you are controlling
- LED type (RGB or RGBW)
- array of LED colors (3 bytes for each LED in case of RGB, or 4 bytes per LED for RGBW).
- the array should contain all LED values ranging from 0-255, so if you had 3 LEDs and first should be red, second green and third blue (50% power), the LED color array would be : [127, 0, 0,  0, 127, 0,  0,0,127].
- this function will create a packet with checksum and send it to PX4, and PX4 will forward the packet to the ESC.

You can modify the `voxl-send-neopixel-cmd` to do what you need, maybe you can make it accept an array of LED color values via command line. 

I know the tool could have been more helpful. If you describe your use case, maybe I can help improve the `voxl-send-neopixel-cmd` tool.

Alex

## Reply by jakkkkobo · 2025-09-11 15:32:27 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev ,

Thank you for the clarification!

We will change the service and see if it meets our needs.

Regards,
Jacob
