# VOXL ESC FPV queries

Source: https://forum.modalai.com/topic/4045/voxl-esc-fpv-queries
Category: ESCs, Sensors and Accessories (https://forum.modalai.com/category/15/escs-sensors-and-accessories)
Tags: esc
Posted: 2024-12-19 14:24:07 UTC by Jetson Nano
Replies: 30 · Views: 7841

## Jetson Nano · 2024-12-19 14:24:07 UTC

Hello!

Thanks for the wonderful product of [VOXL ESC](https://www.modalai.com/products/m0138?variant=47413130101040). I have few doubts regarding the product, 

1. Even though details have been provided in the docs, few pin-outs details seem to be missing. Could you share across the integration and pinouts for all the connectors and testpoints of MDK-M0138-1-01?

2. **LED Integration and coding**:  As stated here, [link](https://docs.modalai.com/voxl-fpv-esc-datasheet/#neopixel-led-support) the documentation mentions for external Neopixel LEDs as well. I'm planning to use a Neopixel LED strips. Over here, I have a doubt if we can address more than 1 LEDs? If yes, how can it be done?

Also how do we power the LED array and what pin is used to power?

3. Payload Connector: Can we connect a external BEC and get the desired power output we need? Since we are planning to power Doodle Labs COMs module from here if requirements are met.

4. Also, I want to know what type of data is being sent from FC to ESC via UART communication port(J1)?

## Reply by Alex Kushleyev (ModalAI staff) · 2024-12-19 19:46:44 UTC

@Jetson-Nano , the following link shows location of all the connections and test points that are being utilized: https://docs.modalai.com/voxl-fpv-esc-datasheet/#hardware-overview . If there is a test point that is not documented, it means it is not supported in firmware or only used for production testing. If you have a specific question, please let me know.

The following link describes the Neopixel led support : https://docs.modalai.com/voxl-fpv-esc-datasheet/#neopixel-led-support . A single string with up to 32 LEDs is supported. `VAUX` regulator is dedicated for this output and can handle 500-600mA. We also have a way to control this output to be 3.3V or 5.0V (3.3V default) but the control feature is disabled at the moment. You can test the Neopixel output while PX4 is not running using `voxl-esc` tools : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/master/voxl-esc-tools/voxl-esc-neopixel-test.py (we also have a helper command to use the LED while PX4 is running). https://gitlab.com/voxl-public/voxl-sdk/services/voxl-io-server/-/blob/master/tools/voxl-send-neopixel-cmd.c -- this tool is a command line tool which sends the control data to PX4 and then PX4 forwards it to the ESC. Right now the C example only supports white color, but we will extend it to RGB.

The payload connector just outputs VBATT, so as long as your desired current is within the JST connector spec, you should be ok. (4Amps per manufacturer's spec).

J1 is used for UART communication with FC or the `voxl-esc` test scripts and the data that is send are the ESC commands (rpm or power) and other commands like Neopixel commands, PWM output.. The ESC also sends back the ESC status.

Let us know if you have any more questions :)

Alex

## Reply by Jetson Nano · 2025-01-02 10:59:40 UTC

Thanks @Alex-Kushleyev for reverting. I have few queries,

**Query** - I would like too know whether we can control the Neopixel LEDs connected to the voxl-ESC through the voxl-portal. You have mentioned that there is a helper script as well. Can this helper script be used as a service to turn ON and OFF the LEDs? 

**Approach** - An icon or button on the voxl-portal,  which will automatically start the  [voxl-esc-neopixel-test.py]( https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/master/voxl-esc-tools/voxl-esc-neopixel-test.py). which will turn ON the LEDs. 
While clicking the icon or button again the script will stop running the LEDs will Turn OFF.

Is this approach feasible and if yes, please guide me with development

Thank you

@James-Strawson

## Reply by Jetson Nano · 2025-01-06 05:20:39 UTC (in reply to Jetson Nano)

@James-Strawson @Alex-Kushleyev

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-06 23:33:08 UTC (in reply to Jetson Nano)

Hi @Jetson-Nano,

We are currently not planning on integrating the neopixel led test feature into the voxl-portal. 

I am not sure why you would want to do it through the voxl-portal - just for testing? Normally voxl-portal should be used for testing purposes before you can develop your own application or use other applications that were designed for deployment (such as PX4 + QGC, etc).

If you really wanted to add the functionality to voxl-portal, you would need to modify the front end to add a button that sends a message via a websocket (or other method) with the LED details, and the back-end would need to receive that message and call the neopixel test script. It is technically not very difficult, but the exact use case is not clear.

Can you please elaborate?

Alex

## Reply by Jetson Nano · 2025-01-07 05:14:42 UTC (in reply to Alex Kushleyev)

Thanks @Alex-Kushleyev for reverting.

From the documentation provided on the modalai [website](https://docs.modalai.com/voxl-fpv-esc-datasheet/#neopixel-led-support), I believe we can control external LEDs through ESC server by running the Python file [ voxl-esc-neopixel-test.py](https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/master/voxl-esc-tools/voxl-esc-neopixel-test.py).

I would like to control the external LEDs manually through a single button on GCS or on Portal, without needing to run the python file on terminal. So the LEDs can be used as flood light for RGB camera.

## Reply by Jetson Nano · 2025-01-07 09:24:06 UTC (in reply to Jetson Nano)

@Alex-Kushleyev 
https://forum.modalai.com/topic/3702/neopixel-gpio-control-on-voxl2-spi-port 
Here in this post you have mentioned integration of LEDs with PX4, can you please elaborate this approach .

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-08 20:07:01 UTC (in reply to Jetson Nano)

@Jetson-Nano , I see what you mean about the use case. I believe we have considered a similar use case before, let me check how we did it. 

Will get back to you soon.

Alex

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-09 21:51:59 UTC (in reply to Alex Kushleyev)

Hi @Jetson-Nano , 

I asked around and we currently do not have an official way to do this. In some tests what we have done is read the RC values from mavlink server and pick a RC channel (a switch), so that when the switch is flipped, you send our the command using `voxl-send-neopixel-cmd.c`. Please note that you cannot run the python test script while PX4 is running (which is your use case).

So basically, what is missing is some "glue" that will tie together the RC channel logic with sending out the LED command. Using PX4 for this may be too complicated and it can be done in a simple script. This can be your own app.

I can provide an example of achieving this relatively easily using python:

- using a python script that calls `px4-listener` to get RC data packet into python, you can get all the RC channels and decide what channel you want to use for the LED. I don't have the exact script, but i am pasting another script i recently wrote for logging barometer data in the similar way
- when you decide that an led command needs to be sent out, you can do a system call / subprocess call to `voxl-send-neopixel-cmd` to turn the led on / off. This helper tool already has support to just turn the while led on or off. Note that this command will send a message via MPA pipe to PX4 process, which will forward the data packet to the PX4 ESC driver, and the message will go out via UART to the ESC (so that you understand the data flow)

So your final python script might look something like this (outline):
make sure PX4 is running
- loop and periodically read RC channels (lets say at 5-10hz)
- if there is transition on a RC channel that is mapped to a switch, call `voxl-send-neopixel-cmd`

In order to modify the barometer reading script for RC data, you can just first print out what the `px4-listener` returns and then parse the RC channel values.

Please let me know if this will work for you, If you need more specific example, I can help but it will take a bit more time (i just wanted to propose a path forward to you).

script for logging barometer data:
```
import subprocess
import time
import numpy as np
import argparse

# install plotly using    pip3 install plotly --upgrade

parser = argparse.ArgumentParser(description='Barometer Test Script')
parser.add_argument('-n','--num-samples',   type=int, required=False, default=1000)
args = parser.parse_args()

max_sample_count = args.num_samples

def get_px4_baro():
    cmd = 'px4-listener sensor_baro'

    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

    timestamp   = None
    pressure    = None
    temperature = None

    for line in p.stdout.readlines():
        l=str(line)
        #print(l)
        if 'timestamp' in l:
            ll = l.split(':')[1].split()[0]
            timestamp = float(ll)
        if 'pressure' in l:
            ll = l.split(':')[-1][:-3]
            pressure = float(ll)
        if 'temperature' in l:
            ll = l.split(':')[-1][:-3]
            temperature = float(ll)

        retval = p.wait()

    return (timestamp,pressure,temperature)

tlast = 0
ts = []
ps = []
temps = []

sample_count = 0

while (sample_count < max_sample_count):
    (timestamp, pressure, temperature) = get_px4_baro()

    #make sure we got new data
    if timestamp != tlast:
        sample_count += 1
        ts.append(timestamp)
        ps.append(pressure)
        temps.append(temperature)
        print(f'({sample_count})[{timestamp}] P: {pressure}, T: {temperature}')

    tlast=timestamp
    time.sleep(0.01)

print('Finished collecting data')
print('Generating plots..')
    
try:
    import plotly.graph_objects as go
    from plotly.subplots import make_subplots
except:
    print('WARNING: In order to plot the results, install the Python "plotly" module: pip3 install plotly --upgrade')
    sys.exit(0)

fig = make_subplots(rows=3, cols=1, start_cell="top-left")

ts_plot  = np.array(ts)
ts_plot -= ts_plot[0]
ts_plot *= 0.000001 #convert from us to s

# calculate approximate height from start
dh       = np.array(ps)
dh      -= dh[0] # subtract the first value
dh      /= 12.0  # about 12 Pascals per meter at standard pressure and temperature

fig.add_trace(go.Scatter(x=ts_plot, y=np.array(ps), name='Pressure (Pa)'), row=1, col=1)
fig.add_trace(go.Scatter(x=ts_plot, y=np.array(temps), name='Temperature (deg C)'), row=2, col=1)
fig.add_trace(go.Scatter(x=ts_plot, y=dh, name='Approx Height (m)'), row=3, col=1)

fig.update_layout(title_text='Barometer Test Results')
fig.update_xaxes(title_text='Time (s)',row=1, col=1)
fig.update_yaxes(title_text='Pressure (Pa)',row=1, col=1)
fig.update_xaxes(title_text='Time (s)',row=2, col=1)
fig.update_yaxes(title_text='Temperature (deg C)',row=2, col=1)
fig.update_xaxes(title_text='Time (s)',row=3, col=1)
fig.update_yaxes(title_text='Approx Height (m)',row=3, col=1)

fig.update_xaxes(matches='x')

fig.write_html('barometer_test_results.html',include_plotlyjs='cdn')
#fig.show()  #the figure will not show on VOXL because there is no display / browser

print('done')
```

## Reply by Jetson Nano · 2025-01-10 09:48:04 UTC (in reply to Alex Kushleyev)

Thanks @Alex-Kushleyev for reverting back, I will test it out. It might some time but I will get back to you.

I had an additional query, where will the python file be running, inside any server or docker. Theoretically this should work, and if it works i want the python file to start when the system is booted.

## Reply by Jetson Nano · 2025-01-11 07:20:36 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev I am using flight core v2 as external FC. Due to which i am getting error message when i run the command ```px4-listener```.![Screenshot from 2025-01-11 12-48-02.png](https://forum.modalai.com/assets/uploads/files/1736579965951-screenshot-from-2025-01-11-12-48-02.png) 

Can you help me out here. how to get the data when we use external FC.

## Reply by tom (ModalAI staff) · 2025-01-12 02:42:26 UTC (in reply to Jetson Nano)

@Jetson-Nano Try out `voxl-inspect-mavlink`, if you hit tab a couple times it should populate with the various pipes you can read from

## Reply by Jetson Nano · 2025-01-13 07:24:32 UTC (in reply to tom)

thanks @tom for reverting back. I had already tried it and I was not able to see any RC channel data. listener function was not working.
The issue is I am not able to see the RC channel changes. Can you help me out how am I supposed to get the RC changes.

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-13 17:02:24 UTC (in reply to Jetson Nano)

Hi @Jetson-Nano, sorry i originally did not realize that you are running PX4 outside VOXL2. In this case `px4-listener` approach will not work.

However, in the case of PX4 running on flight core (v1 or v2), there is still communication between Flight Core and VOXL2. `voxl-mavlink-server` should be communicating with the Flight Core via UART and passing messages back and forth. Depending whether the forwarding of RC topic is enabled or not, `voxl-mavlink-server` would receive those messages (if enabled) and in that case they would be accessible on VOXL2.

@tom , can you please elaborate on how to double check if the RC message is set up to forward to `voxl-mavlink-server` from Flight Core (if not, how to enable it) and how to actually read that message?

Thanks!

Alex

## Reply by tom (ModalAI staff) · 2025-01-13 18:01:08 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev @Jetson-Nano You'll want to make sure that in `/etc/modalai/voxl-mavlink-server.conf` that `en_external_uart_ap` is set to `true`

Once you restart the service you should be able to run `voxl-inspect-mavlink mavlink_offboard` to view the generated messages from FC

## Reply by Jetson Nano · 2025-01-14 04:13:26 UTC (in reply to tom)

@tom @Alex-Kushleyev thanks guys. I will check it and get back to you with the result.

## Reply by Jetson Nano · 2025-01-14 04:22:28 UTC (in reply to Jetson Nano)

@Alex-Kushleyev @tom 
Guys I checked what you guys mentioned.
![Screenshot from 2025-01-14 09-47-51.png](https://forum.modalai.com/assets/uploads/files/1737449289240-screenshot-from-2025-01-14-09-47-51.png) 
![Screenshot from 2025-01-14 09-46-54.png](https://forum.modalai.com/assets/uploads/files/1737449321534-screenshot-from-2025-01-14-09-46-54.png) 
The ```en_external_uart_ap``` is set to True, but when I run the command ```voxl-inspect-mavlink mavlink_offboard ``` , the terminal is showing ``` waiting for pipe to connect ``` and not showing anything else.

Adding to the previous point there is no mavlink_offboard showing up.

![Screenshot from 2025-01-14 09-58-47.png](https://forum.modalai.com/assets/uploads/files/1736829007056-screenshot-from-2025-01-14-09-58-47.png)

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-14 04:31:46 UTC (in reply to Jetson Nano)

@Jetson-Nano , is `voxl-mavlink-server` actually running? you can check using `voxl-inspect-services`.

Also, are you sure that your Flight Core V2 is connected to `/dev/ttyHS1` , which would be implied by using `autopilot_uart_bus: 1` . How exactly are you connecting it to VOXL2?

Alex

## Reply by Jetson Nano · 2025-01-14 07:36:28 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev 
yes the ```voxl-mavlink-server ``` is running, I had checked it.

I am following this documentation for FC connections.

[link](https://docs.modalai.com/flight-core-connections/#:~:text=Using%20the%20MCBL%2D00010%5D(%2F,which%20can%20lead%20to%20issues.)

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-14 15:29:18 UTC (in reply to Jetson Nano)

@Jetson-Nano , can you please clarify which connector on VOXL2 is your Flight Core connected to (for uart communication) and whether you have any indication that the communication is established? Have you previously been able to connect to VOXL2 from QGC and access the Flight Core V2 while it has been connected to VOXL2?

Alex

## Reply by Jetson Nano · 2025-01-15 10:36:58 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev I currently use, [VOXL2 USB 3.0 Expansion Adapter](https://docs.modalai.com/voxl2-usb3-uart-add-on-user-guide/) connected to VOXL2. From the UART7 port of the Expansion Adapter I have connected to 6-PIN Telemetry1 Port in Flight Core V2.

My connection is similar to this,
![a976cc01-f06c-4080-b2dc-a551ef614cce-image.png](https://forum.modalai.com/assets/uploads/files/1736936855579-a976cc01-f06c-4080-b2dc-a551ef614cce-image-resized.png) 

As you mentioned earlier, I'm establishing connection through port `/dev/ttyHS1`. When I run the `cat` command to read the messages from this port, I get garbled data as below,

![646c42a2-3edd-4b18-aecd-c0a36af3721e-image.png](https://forum.modalai.com/assets/uploads/files/1736937101896-646c42a2-3edd-4b18-aecd-c0a36af3721e-image.png).

I'm not exactly clear when you mean if I have tried connecting to VOXL2 from QGC and access the Flight Core V2. Few things I have tried is,

- Connecting to FlightCore V2 by connecting to Wifi of VOXL2. I also have a Wifi setup on VOXL2, which also acts as my Telemetry line. From QGC I connect to this local network to access FC data and PX4 parameters on Flight Core V2.

- I have tried and tested few mavlink message commads which communicate with PX4 directly for C2C.

## Reply by Jetson Nano · 2025-01-15 10:52:02 UTC (in reply to tom)

@tom As per your response on shifting to `voxl-inspect-mavlink mavlink_offboard`, I see that even in mavlink server documentation from ModalAI that service pipeline is not listed. Is it that something that has to be explicitly be enabled somewhere? 
*Even as per the documentation, I dont see this service pipeline listed.*

![0abeaffd-4404-446e-9b9b-a1c2ab30b668-image.png](https://forum.modalai.com/assets/uploads/files/1736938284835-0abeaffd-4404-446e-9b9b-a1c2ab30b668-image.png)

## Reply by tom (ModalAI staff) · 2025-01-15 17:40:10 UTC (in reply to Jetson Nano)

@Jetson-Nano I could have the naming wrong. If you inspect `mavlink_onboard` what kind of data do you see?

## Reply by Jetson Nano · 2025-01-16 15:23:01 UTC (in reply to tom)

@tom This is the output I get,

![Screenshot from 2025-01-16 20-49-20.png](https://forum.modalai.com/assets/uploads/files/1737040974025-screenshot-from-2025-01-16-20-49-20.png)

## Reply by tom (ModalAI staff) · 2025-01-16 17:29:14 UTC (in reply to Jetson Nano)

@Jetson-Nano Since you don't have voxl-px4 running I think that data is likely coming from your external flight controller

## Reply by Jetson Nano · 2025-01-16 18:37:02 UTC (in reply to tom)

@tom yes, the message is coming from external flight controller, Flight core v2. Now can you share how to double check if the RC message is set up to forward to voxl-mavlink-server from Flight Core (if not, how to enable it) and how to actually read that message?

## Reply by Eric Katzfey (ModalAI staff) · 2025-01-16 19:58:01 UTC (in reply to Jetson Nano)

@Jetson-Nano Probably should also look at the pipe for messages from the flight controller to the GCS (Labeled mavlink_to_gcs in the above diagram but you'll have to double check that name). Generally the flight controller is configured with two mavlink streams. One is the onboard stream that has high rate messages and is intended for local use (e.g. on VOXL or VOXL 2) and the other is more the default settings for communication with a GCS. You can configure what each of these streams contain in PX4. You can add streams, change stream rates, etc. all via PX4 configuration. Please refer to the PX4 documentation for details on how to do this.

## Reply by Jetson Nano · 2025-01-17 15:03:30 UTC (in reply to Eric Katzfey)

Hi @Eric-Katzfey, I was thinking another approach, where we can use pymavlink to get the RC_channel data. Any inputs to the mentioned approach, is it feasible?

## Reply by Eric Katzfey (ModalAI staff) · 2025-01-17 16:19:42 UTC (in reply to Jetson Nano)

@Jetson-Nano Yes, that should work. You should be able to send heartbeats from a Python script using pymavlink and connect to the flight controller via voxl-mavlink-server. Then you should start receiving all the normal messages sent out by the flight controller to the GCS which should include the RC channels message.

## Reply by Jetson Nano · 2025-01-23 05:17:10 UTC

@Alex-Kushleyev can you check the above mentioned approach

## Reply by Alex Kushleyev (ModalAI staff) · 2025-01-23 05:29:33 UTC (in reply to Jetson Nano)

@Jetson-Nano , I am sorry, I don't have this hardware set up right now, so I can't actually test what you are trying to do. I will check with the team regarding who can test it.

Alex
