# VOXL 2 ESC Calibration Custom motors and battery

Source: https://forum.modalai.com/topic/2073/voxl-2-esc-calibration-custom-motors-and-battery
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2023-04-14 00:59:33 UTC by Luis Fernando Landivar
Replies: 28 · Views: 7041

## Luis Fernando Landivar · 2023-04-14 00:59:33 UTC

hey, 

Ive been trying to get the ESC v2 calibrated but am having issues, is there a way to calibrate them using a script? Ive found some posts on this forum that do just that but the links have deprecated.
 
also ive been trying to update the version of px4 to 1.13 or newer but am having trouble finding a walkthough, can someone provide a link or gitlab?

please let me know, thanks in advance

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-14 02:31:42 UTC

Hello @Luis-Fernando-Landivar , 

The ESC calibration instructions are located here : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/master/voxl-esc-tools/calibration.md

Please try to follow the instructions and let us know if you run into any issues.

Alex

## Reply by Luis Fernando Landivar · 2023-04-15 23:14:54 UTC

thanks for your reply @Alex-Kushleyev, ive looked at the gitlab link youve sent and ive begun using setting the software prerequisites, although i am already stuck in the first part. 
![Screenshot from 2023-04-15 19-01-40.png](https://forum.modalai.com/assets/uploads/files/1681599763173-screenshot-from-2023-04-15-19-01-40.png) 
ive also included my voxl2 program versions below ![Screenshot from 2023-04-15 19-04-44.png](https://forum.modalai.com/assets/uploads/files/1681599925981-screenshot-from-2023-04-15-19-04-44.png) 
please let me know how to move forward, thank you

## Reply by Luis Fernando Landivar · 2023-04-16 22:00:22 UTC

after encountering the error shown above, i found a gitlab link. https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc after installing voxl-esc, i then tried running through the calibration.md file mentioned previously. 
![754d1fdd-6f92-4d87-a55c-43c04176964c-image.png](https://forum.modalai.com/assets/uploads/files/1681682274838-754d1fdd-6f92-4d87-a55c-43c04176964c-image.png) 

i am now at the phase where the uart bridge attempts to download and install. it appears that the link is longer being used, has anyone encountered this issue? thank you in advance

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 14:41:51 UTC

Hello,

On voxl2, you can now install everything using:
```
apt-get update
apt-get install voxl-esc voxl-slpi-uart-bridge
```

After running these commands, voxl-esc tools will be installed to `/usr/share/modalai/voxl-esc-tools` and params to `/usr/share/modalai/voxl-esc-params`.

there will also now be  a `voxl-esc` wrapper script you can run:

```
voxl-esc scan
```

additionally, you can use the voxl ESC scripts directly from `/usr/share/modalai/voxl-esc-tools` or the location of your git repository that you checked out. Just make sure that before you use the tools, you run `voxl-esc enable_bridge` which will disable PX4 .. and to re-enable PX4 run `voxl-esc disable_bridge`. voxl-esc and PX4 cannot run at the same time.

Just one note - I need to double check this, but i believe that after running `voxl-esc enable_bridge` you need to reboot VOXL2, because if PX4 was already running at this point, there is some low-level caching happening on DSP that will need to be reset. 

So you should follow the following:
- install voxl-esc and bridge using the `apt-get` command above
- run `voxl-esc enable_bridge`
- reboot voxl2
- test ESC using voxl-esc tools
- run `voxl-esc disable_bridge` and reboot voxl2 to restore PX4

We will update the documentation on gitlab.

## Reply by Luis Fernando Landivar · 2023-04-17 18:07:51 UTC

![Screenshot from 2023-04-17 14-04-27.png](https://forum.modalai.com/assets/uploads/files/1681754679786-screenshot-from-2023-04-17-14-04-27.png) 

@Alex-Kushleyev thank you for your reply, it seems as though i might be using the wrong voxl-esc? the wrapper youve mentioned is having issues working, as well as the slpi-bridge is having trouble locating the voxl-esc package. what is the best course of action? would reflashing the firmware on the board help at all? thank you in advance

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 18:53:57 UTC

this is interesting. @James-Strawson do you know why apt-get is not finding voxl-esc and voxl-slpi-uart-bridge? It works for me.

This probably has something to do with package sourced, for me i had the following:

```
Ign:9 http://voxl-packages.modalai.com qrb5165 InRelease                                                                
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:11 http://packages.ros.org/ros/ubuntu bionic/main arm64 Packages [786 kB]                              
Get:12 http://voxl-packages.modalai.com qrb5165 Release [6132 B]                                                     
Ign:13 http://voxl-packages.modalai.com qrb5165 Release.gpg                                                               
Get:14 http://voxl-packages.modalai.com qrb5165/staging arm64 Packages [16.4 kB] 
```

I think this means the packages did not make it into the SDK yet, so if you update your source to use qrb5165 staging or you could download them directly from here and install manually : http://voxl-packages.modalai.com/dists/qrb5165/staging/binary-arm64/

## Reply by tom (ModalAI staff) · 2023-04-17 19:14:42 UTC

To get on the staging repo you'd have to modify the following file as seen below:

```
voxl2:/$ cat /etc/apt/sources.list.d/modalai.list 
deb [trusted=yes] http://voxl-packages.modalai.com/ qrb5165 staging
```

and then run an `apt-get update`

## Reply by Luis Fernando Landivar · 2023-04-17 19:37:17 UTC

#esc v2 #VOXL-ESC @Alex-Kushleyev @tom success! thank you both so much, that repo addition helped, now the tools are working. i successfully scanned and detected all the escs

![0349cfdc-3825-4332-af86-46bf2c1f0e68-image.png](https://forum.modalai.com/assets/uploads/files/1681759267654-0349cfdc-3825-4332-af86-46bf2c1f0e68-image.png) 

i was also able to calibrate each motor using the calibration script using this command,
./voxl-esc-calibrate.py --id 3 --pwm-min 10 --pwm-max 95

as for the uploading them, im trying to find the xml files as suggested in the gitlab. these are the directories ive checked, maybe im looking in the wrong place? 

![b68f6774-c4c0-413e-a8bc-675dc593b9fc-image.png](https://forum.modalai.com/assets/uploads/files/1681760199102-b68f6774-c4c0-413e-a8bc-675dc593b9fc-image.png) 

let me know,
thank you again in advance

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 21:06:56 UTC

If you can share the motor type, propeller, battery voltage, i can point you to a good esc param xml file to start with.

## Reply by Luis Fernando Landivar · 2023-04-17 21:13:15 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev thank you, its a 4s battery, XING2 3310 1600kv, 8 inch propeller

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 23:08:14 UTC

@Luis-Fernando-Landivar said in [VOXL 2 ESC Calibration Custom motors and battery](/post/9707):
> XING2 3310 1600kv

Hi @Luis-Fernando-Landivar , 

Based on your calibration screenshot, you calibrated the motor without the propeller attached. It seems at 95%, you only had 2.7A of current. Calibration needs to be done with attached propeller.

However, I also checked the specifications of your motor, with 8 inch prop, there could be significant current flow. Before proceeding, i would recommend to perform the following few tests with one motor and check the current consumption (with propeller attached).

`./voxl-esc-spin.py --id 0 --power 50 --ramp-time 3 --timeout 4` 
this will spin the motor up slowly to 50% power and stop the test after 4 seconds. We can see what current the motor pulls.

The ESC has been tested to about 20A continuous per channel, but it could do more with appropriate cooling. if your test at 50% power shows less than 20A current, you can test at 60, 70 % and so on, but if current goes much above 25A when you get close to 100% power, this ESC may not be the best choice for this motor / propeller.

If you are able to share the data from the few spin tests, I can advise further.

## Reply by Luis Fernando Landivar · 2023-04-17 23:31:05 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev said in [VOXL 2 ESC Calibration Custom motors and battery](/post/9709):
> ./voxl-esc-spin.py --id 0 --power 50 --ramp-time 3 --timeout 4

![39936c1c-b647-40f2-8369-152077b4f1ed-image.png](https://forum.modalai.com/assets/uploads/files/1681774145149-39936c1c-b647-40f2-8369-152077b4f1ed-image.png) 

this is what i received, this is at 70% i think if i go any higher it fly away... we dont plan to use this much power, i think the most we will use is 60%, its for close to ground flights and indoor testing. what are your thoughts? 

also we chose these motors and propellers so it could have a clean takeoff and hover easily, weve tried with lower sizes and 7 inch propellers and found that this size and propeller would be better for our use cases. i can definitely add more cooling if necessary

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 23:48:05 UTC

OK, that looks like it is reasonable. To be safe, you should perform the calibration with maximum pwm 70 instead of 95 which is the default (using `--pwm-max 70` option). Also in the esc param file, you can limit your rpm to about 14000, so that ESC will not try to go over 14000.

So you should follow these steps:
- calibrate the motor with propeller with max power 70
- use the following xml file as starting point: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/dev/voxl-esc-params/old/esc_params_modalai_4_in_1_revb_holybro2216_880_half_kp.xml
- update the rpm curve from your calibration results
- set max rpm to 14000 for safety (for now)
- set min rpm to whatever RPM the motor spins at about 10% power with propeller
- set kp and ki to 0 for now to make the controller softer so that you dont have large current spikes
- set max_rpm_delta to 1500 or so (this kind of a slew rate limit on how fast the motor should jump from one rpm to another).
- save xml and upload it to the ESC
- perform a few rpm-based tests (voxl-esc-spin.py --rpm <desired_rpm>).
- note that if you use the `--timeout` feature and `--enable-plot`, the rpms will be be plotted using `plotly` - may need to install it using `pip3 install plotly`

Once you have done basic tests, spin up all 4 motors and test ESC temperature at different rpms. The MCU is rated to 105C internal temperature, but you should not push it. I would say 80-90C is a good maximum to try to achieve. With good cooling, hopefully that wont be an issue. ESC temperature is printed by the test script, as you have probably seen already. To check steady-state ESC temps at different motor rpm, you should run it for 1 minute or so, if you see ESC temp going above 100C, probabaly should terminate the test and evaluate results.

If you command high rpm in the spin script, maybe use `--ramp-time` option to avoid all 4 motors just jumping to like 14000 rpm which could draw huge currents (probabaly over 100A total for a short period of time, if all 4 motors are spinning)

To spin all 4 ESCs at the same time, use `voxl-esc-spin.py --id 255 --rpm <desired_rpm>`, then all 4 motors should spin and feedback from all 4 will be printed

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-17 23:49:18 UTC

Note that in the xml param file, you keep the 7 pole pairs, as already set in this param file, because your motor has 14 poles (7 pole pairs):

https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/blob/dev/voxl-esc-params/old/esc_params_modalai_4_in_1_revb_holybro2216_880_half_kp.xml#L61

## Reply by Luis Fernando Landivar · 2023-04-17 23:53:56 UTC

@Alex-Kushleyev thank you! im going to follow your instructions and will update you when finished

## Reply by Luis Fernando Landivar · 2023-04-18 07:35:37 UTC

@Alex-Kushleyev Update: it looks as though during my testing, 2 mosfets unsoldered themselves. I think it may be best to try something else, im glad we went through this, as we plan on getting a second voxl2 and plan on making very small and compact compared to this one.

We want to try again with calibration, but it looks like we will need the voxl2 i/o if we want to use these motors with 40 amp escs. Is there setup necessary? And Do you have a gitlab link for esc calibration steps regarding voxl 2 i/o?

And Once again, thank you

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-18 18:29:52 UTC

Hello @Luis-Fernando-Landivar ,

Sorry to hear that the ESC overheated. It must be due to the high currents. Usually in this condition you would want direct airflow from propellers over the mosfets. Out of curiosity, can you share what test you ran, for how long and what temperature and currents did ESC report?

I will check regarding status of voxl 2 I/O board. What protocol will your ESC use? Standard PWM / OneShot125, Dshot, etc..

Alex

## Reply by Luis Fernando Landivar · 2023-04-18 22:01:37 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev we ran 70%, had a 12v cooling fan attached, 50% and 60% went well temperature was below 80c for full minute runs. 10 seconds in for 70%, 130c , it unsoldered itself, i knew it was a possibility and these things happen so no harm at all, simply means we must try another approach. As for the data you were asking, is there a log somewhere, so i can give you detailed information? and we plan on using standard pwm.

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-18 22:51:19 UTC

in the folder where you ran the `voxl-esc-spin.py` command, there should be a logs folder with txt logs. You should be able to find your log by looking at 9th column which is temperature in deg C, look for 130 :). If you are able to provide, the log, it would be great, i can use it to check if the ESC performed as expected. Please email the log file to me (email address in my profile. thanks!)

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-19 03:27:00 UTC

By the way, you mentioned that you used 12V cooling fan.. That is not typically how the ESC cooling is done for high current applications on drones. The ESC is usually placed near direct airflow from propellers, which provide a huge amount of air flow, so ESC can be cooled effectively. Maybe this will help in the future..

## Reply by Luis Fernando Landivar · 2023-04-19 23:02:22 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev hello again, ive tried to locate your email, but could not find it, im not too familiar with the forum i think, but i have uploaded it to a link from file.io so you can download it. here it is https://file.io/APX5CPUzx56I also, have you had the time to check the voxl 2 i/o board? 

let me know, thank you for all your help

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-20 02:15:13 UTC

my email is akushley (at) modalai . com

Sorry, i thought it was visible.

By the way, the file you uploaded is no longer available, so could you please email the log to me? thanks!

PX4 IO currently supports only 1-2ms PWM output, but it is better to use OneShot125 or DShot, which we are working on as well. Do you have the VOXL2 I/O board? I am still checking if we have a better option for you.

Alex

## Reply by Luis Fernando Landivar · 2023-04-20 05:20:31 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev we have ordered the voxl2 i/o board and we will receive it the 21st of this month and Thank you for taking the time, we appreciate any help you can provide.

just want to mention we are loving the voxl 2 so far, we cant wait to begin test flying, your team has done great work!

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-20 16:39:19 UTC

Hello @Luis-Fernando-Landivar ,

I plotted the data from your log, please see below. I do see something strange that happened that ESC ID 0 started spinning at about 36K RPM after initially spinning at about 14K RPM for 9 seconds. This is quite strange - did you notice anything strange about that motor?

Another strange thing is ESC temperature 3 is much cooler than others, maybe you had the 12V fan blowing closer to that MCU?

There are varying currents seen in all 4 ESCs - maybe the airflow from all the motors was interfering with the load on propeller (did you have the quadrotor in an enclosed space like a box?)

Alex

![4_in_1_esc_1600kv_8inch_plots.png](https://forum.modalai.com/assets/uploads/files/1682008742566-4_in_1_esc_1600kv_8inch_plots.png)

## Reply by Luis Fernando Landivar · 2023-04-20 17:29:10 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev The area we tested it was on a table and we held it down using some straps. The ID 0 ESC that changed in rpm is the one that became unsoldered, we noticed something wrong immediately since it would spin the propeller 2 rotations slowly then stop and repeat. 

as for the fan, it was covering the whole 4-in-1 esc, one thing that mightve been an issue, maybe that it might’ve been too close and airflow couldn’t have been pulled efficiently.

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-20 18:34:46 UTC

Thank you for the details. Quick question: did 12V fan blow on the Mosfets or on the side with MCUs?

## Reply by Luis Fernando Landivar · 2023-04-20 19:22:27 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev yes, it was blowing air away from the esc board, it was the side with the mcus, looks like

## Reply by Alex Kushleyev (ModalAI staff) · 2023-04-20 19:26:20 UTC

OK, then I think I understand what happened. The 12V Fan was cooling the MCUs, but since the temperature measurement is done inside the MCU itself, the temperature of Mosfets is not known. 

In general it is always better to put air flow on the Mosfets, not MCU, because Mosfets produce heat.

I think this explains the behavior when MCU was reading about 90C but ESC started behaving strangely -- the Mosfets were likely much hotter and got de-soldered..

Alex
