Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Ask your questions right here!
  3. Configuring battery monitor with FPV ESC

Configuring battery monitor with FPV ESC

Scheduled Pinned Locked Moved Ask your questions right here!
21 Posts 5 Posters 5.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Dan JenningsD Dan Jennings

    @Alex-Kushleyev
    Thank you for the instructions, I will look into those tomorrow.

    We have the ESC plugged into Voxl2 J18 as indicated in the VOXL2 ESC configs

    Low KV guidance is very welcome. We were having trouble getting the motors to work and looked into the param files to try and figure out what was wrong. Changing the KV made motor response much better. We have good motor behavior now but I'll go through those instructions to be sure the motors are properly tuned.

    Alex KushleyevA Offline
    Alex KushleyevA Offline
    Alex Kushleyev
    ModalAI Team
    wrote on last edited by
    #6

    @Dan-Jennings, you are welcome. Just one note about the low kv tuning, instructions say set this param to 1 (demag_timing: 1 ), but leave it off (at zero). I will correct the doc - this was an experimental feature, you should not need. Also instructions say to use m0134-6 esc, but the FPV esc is just fine for this purpose. You can keep your existing tuning file and check the parameters that are suggested in the guide.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      restore
      Regular
      wrote on last edited by restore
      #7

      PX4 version 1.14.0-2.0.68
      VOXL_ESC_PUB_BST is enabled
      Voxl-esc is running, can spin and calibrate motors.

      Still no battery monitor

      Low KV tuning worked, motors responding well.

      Alex KushleyevA 1 Reply Last reply
      0
      • R restore

        PX4 version 1.14.0-2.0.68
        VOXL_ESC_PUB_BST is enabled
        Voxl-esc is running, can spin and calibrate motors.

        Still no battery monitor

        Low KV tuning worked, motors responding well.

        Alex KushleyevA Offline
        Alex KushleyevA Offline
        Alex Kushleyev
        ModalAI Team
        wrote on last edited by
        #8

        @restore , This should be the correct PX4 version (it has support for this feature)

        When you start PX4, are the blue LEDs on the ESC blinking? if not, then PX4 is not communicating with the ESC, you may need to double check the baud rate setting (baud rate in ESC params needs to match the VOXL_ESC_BAUD.

        Related question, is the actuator test in PX4 working?

        Alex

        Dan JenningsD 1 Reply Last reply
        0
        • Alex KushleyevA Alex Kushleyev

          @restore , This should be the correct PX4 version (it has support for this feature)

          When you start PX4, are the blue LEDs on the ESC blinking? if not, then PX4 is not communicating with the ESC, you may need to double check the baud rate setting (baud rate in ESC params needs to match the VOXL_ESC_BAUD.

          Related question, is the actuator test in PX4 working?

          Alex

          Dan JenningsD Offline
          Dan JenningsD Offline
          Dan Jennings
          Contributor
          wrote on last edited by
          #9

          @Alex-Kushleyev
          Yes, ESC is working, we're able to calibrate ESCs using esc tools, spin up motors in QGC, and have flown several times. Just having to be very conservative without battery status.

          Alex KushleyevA 1 Reply Last reply
          0
          • Dan JenningsD Dan Jennings

            @Alex-Kushleyev
            Yes, ESC is working, we're able to calibrate ESCs using esc tools, spin up motors in QGC, and have flown several times. Just having to be very conservative without battery status.

            Alex KushleyevA Offline
            Alex KushleyevA Offline
            Alex Kushleyev
            ModalAI Team
            wrote on last edited by Alex Kushleyev
            #10

            @Dan-Jennings,

            We will figure it out 🙂 quick question - what baud rate are you using for the ESC and also esc firmware version / hash? I will test with exact version of esc firmware and px4.

            If your baud rate is 250k, please change it to a higher value, we typically use 2M. If baud rate is too low, may not be fast enough to send the extra packet with total current.

            Alex KushleyevA 1 Reply Last reply
            0
            • Alex KushleyevA Alex Kushleyev

              @Dan-Jennings,

              We will figure it out 🙂 quick question - what baud rate are you using for the ESC and also esc firmware version / hash? I will test with exact version of esc firmware and px4.

              If your baud rate is 250k, please change it to a higher value, we typically use 2M. If baud rate is too low, may not be fast enough to send the extra packet with total current.

              Alex KushleyevA Offline
              Alex KushleyevA Offline
              Alex Kushleyev
              ModalAI Team
              wrote on last edited by
              #11

              Another question - when you use voxl-esc tools and spin id 2, do you get a total current measurement printed in terminal along with regular esc feedback?

              Alex KushleyevA R 2 Replies Last reply
              0
              • Alex KushleyevA Alex Kushleyev

                Another question - when you use voxl-esc tools and spin id 2, do you get a total current measurement printed in terminal along with regular esc feedback?

                Alex KushleyevA Offline
                Alex KushleyevA Offline
                Alex Kushleyev
                ModalAI Team
                wrote on last edited by
                #12

                @Dan-Jennings , did you figure out this one?

                the way the battery publishing works on M0138 (FPV) ESC and M0129 (Mini) ESC is as follows:

                • one of the MCUs on the ESC is hooked up to the total current sensor. On M0138 it is ID2, on M0129 it is ID3
                • when flight controller requests feedback from the ESC (by setting appropriate bit in the commanded RPM or Power control packet), the ESC ID with the current measurement will send out its regular feedback packet and right after the special battery status packet
                • this battery status packet is received and parsed by PX4 and if the VOXL_ESC_PUB_BST px4 param is set to 1, the battery status is published, code here
                • this only happens if voxl_esc px4 driver is running and and it is communicating with the ESC (e.g. UART baud rate is correct). You will see the ESC flash all 4 blue leds, which means the commands (disarmed rpms = 0 if not in flight) are received from the PX4 flight controller
                • you can view the battery status message in VOXL2 terminal using the following command:
                px4-listener battery_status
                

                I hope this helps!

                Alex

                Dan JenningsD 1 Reply Last reply
                0
                • Alex KushleyevA Alex Kushleyev

                  @Dan-Jennings , did you figure out this one?

                  the way the battery publishing works on M0138 (FPV) ESC and M0129 (Mini) ESC is as follows:

                  • one of the MCUs on the ESC is hooked up to the total current sensor. On M0138 it is ID2, on M0129 it is ID3
                  • when flight controller requests feedback from the ESC (by setting appropriate bit in the commanded RPM or Power control packet), the ESC ID with the current measurement will send out its regular feedback packet and right after the special battery status packet
                  • this battery status packet is received and parsed by PX4 and if the VOXL_ESC_PUB_BST px4 param is set to 1, the battery status is published, code here
                  • this only happens if voxl_esc px4 driver is running and and it is communicating with the ESC (e.g. UART baud rate is correct). You will see the ESC flash all 4 blue leds, which means the commands (disarmed rpms = 0 if not in flight) are received from the PX4 flight controller
                  • you can view the battery status message in VOXL2 terminal using the following command:
                  px4-listener battery_status
                  

                  I hope this helps!

                  Alex

                  Dan JenningsD Offline
                  Dan JenningsD Offline
                  Dan Jennings
                  Contributor
                  wrote on last edited by
                  #13

                  @Alex-Kushleyev still pending on this. Have had other issues to solve. Will be starting another thread shortly.

                  1 Reply Last reply
                  0
                  • R restore referenced this topic on
                  • Alex KushleyevA Alex Kushleyev

                    Another question - when you use voxl-esc tools and spin id 2, do you get a total current measurement printed in terminal along with regular esc feedback?

                    R Offline
                    R Offline
                    restore
                    Regular
                    wrote on last edited by
                    #14

                    @Alex-Kushleyev

                    We're finally rebuilt and recalibrated, but still no battery status. All 4 blue LEDs are flashing on the ESC, so the voxl_esc px4 driver should be running but we get:

                    voxl2:/$ px4-listener battery_status
                    never published
                    

                    Where would that PX4 param be located?

                    Alex KushleyevA 1 Reply Last reply
                    0
                    • R restore

                      @Alex-Kushleyev

                      We're finally rebuilt and recalibrated, but still no battery status. All 4 blue LEDs are flashing on the ESC, so the voxl_esc px4 driver should be running but we get:

                      voxl2:/$ px4-listener battery_status
                      never published
                      

                      Where would that PX4 param be located?

                      Alex KushleyevA Offline
                      Alex KushleyevA Offline
                      Alex Kushleyev
                      ModalAI Team
                      wrote on last edited by
                      #15

                      @restore , can you please check which version of voxl-px4 you are using? You can use “voxl-version” tool.

                      R 1 Reply Last reply
                      0
                      • Alex KushleyevA Alex Kushleyev

                        @restore , can you please check which version of voxl-px4 you are using? You can use “voxl-version” tool.

                        R Offline
                        R Offline
                        restore
                        Regular
                        wrote on last edited by
                        #16

                        @Alex-Kushleyev
                        We are using px4 version 1.14.0-2.0.68
                        I connected to px4 with QGC and was able to confirm that VOXL_ESC_PUB_BST is enabled. It'd still be handy to know where those params are stored so we can edit them while connected through adb.

                        Thanks

                        tomT 1 Reply Last reply
                        0
                        • R restore

                          @Alex-Kushleyev
                          We are using px4 version 1.14.0-2.0.68
                          I connected to px4 with QGC and was able to confirm that VOXL_ESC_PUB_BST is enabled. It'd still be handy to know where those params are stored so we can edit them while connected through adb.

                          Thanks

                          tomT Offline
                          tomT Offline
                          tom
                          admin
                          wrote on last edited by
                          #17

                          @restore The px4 parameters are stored in a binary file at /data/px4/param/parameters so you can't modify that file directly.

                          However you can use the following to set a param:

                          px4-param set PARAM_NAME PARAM_VALUE
                          

                          or view parameters with

                          px4-param show
                          
                          Alex KushleyevA 1 Reply Last reply
                          0
                          • tomT tom

                            @restore The px4 parameters are stored in a binary file at /data/px4/param/parameters so you can't modify that file directly.

                            However you can use the following to set a param:

                            px4-param set PARAM_NAME PARAM_VALUE
                            

                            or view parameters with

                            px4-param show
                            
                            Alex KushleyevA Offline
                            Alex KushleyevA Offline
                            Alex Kushleyev
                            ModalAI Team
                            wrote on last edited by
                            #18

                            @restore, also can you please check which version of ESC firmware you are running on the FPV ESC? you can do this using voxl-esc tools (while px4 is not running). voxl-esc scan

                            I suggest to update to the latest ESC firmware in voxl-esc repository (dev branch).

                            R 1 Reply Last reply
                            0
                            • Alex KushleyevA Alex Kushleyev

                              @restore, also can you please check which version of ESC firmware you are running on the FPV ESC? you can do this using voxl-esc tools (while px4 is not running). voxl-esc scan

                              I suggest to update to the latest ESC firmware in voxl-esc repository (dev branch).

                              R Offline
                              R Offline
                              restore
                              Regular
                              wrote on last edited by
                              #19

                              @Alex-Kushleyev
                              ESCs are firmware version 39, hash 17d64675
                              I checked /usr/share/modalai/voxl-esc-tools/firmware and the M0138 firmware matches the one here.

                              modalai_esc_firmware_m0138_1_v0_39_RC11_17d64675.bin
                              
                              Alex KushleyevA 1 Reply Last reply
                              0
                              • R restore

                                @Alex-Kushleyev
                                ESCs are firmware version 39, hash 17d64675
                                I checked /usr/share/modalai/voxl-esc-tools/firmware and the M0138 firmware matches the one here.

                                modalai_esc_firmware_m0138_1_v0_39_RC11_17d64675.bin
                                
                                Alex KushleyevA Offline
                                Alex KushleyevA Offline
                                Alex Kushleyev
                                ModalAI Team
                                wrote on last edited by Alex Kushleyev
                                #20

                                @restore, thank you for checking.

                                Let's do another test:

                                • for safety, remove propellers from motors
                                • with px4 disabled, go to /usr/share/modalai/voxl-esc-tools on voxl2
                                • run: ./voxl-esc-spin.py --id 2 --power 0 -- this will send a zero power command to ESC ID 2 (which measures the total current and sends back the battery status message). Motors will not spin. This will also request the battery status and you should see output (if possible you can use the latest voxl-esc tools from dev branch from (https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/tree/dev) since I am not sure which voxl-esc version is installed on your board).
                                ./voxl-esc-spin.py --id 2 --power 0
                                ...
                                Found voxl-esc tools bin version: 1.6
                                VOXL Platform: M0054
                                Detected RB5 Flight, VOXL2 M0054 or M0104!
                                ...
                                ...
                                	Board      : version 42: ModalAi 4-in-1 ESC (M0138-1)
                                ...
                                ...
                                [0.017] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.87C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.232A
                                [0.034] (2) RPM: 0, PWR: 0, VOLTAGE: 15.609V, TEMPERATURE: 35.88C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.609V, BOARD_CURRENT: -0.200A
                                [0.060] (2) RPM: 0, PWR: 0, VOLTAGE: 15.610V, TEMPERATURE: 35.86C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.610V, BOARD_CURRENT: -0.248A
                                [0.080] (2) RPM: 0, PWR: 0, VOLTAGE: 15.618V, TEMPERATURE: 35.85C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.618V, BOARD_CURRENT: -0.224A
                                [0.095] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.87C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.272A
                                [0.120] (2) RPM: 0, PWR: 0, VOLTAGE: 15.608V, TEMPERATURE: 35.90C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.608V, BOARD_CURRENT: -0.240A
                                [0.134] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.92C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.264A
                                [0.160] (2) RPM: 0, PWR: 0, VOLTAGE: 15.613V, TEMPERATURE: 35.90C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.613V, BOARD_CURRENT: -0.248A
                                [0.174] (2) RPM: 0, PWR: 0, VOLTAGE: 15.608V, TEMPERATURE: 35.92C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.608V, BOARD_CURRENT: -0.168A
                                

                                note that there are BOARD_VOLTAGE and BOARD_CURRENT printed, which are parsed from the battery status message coming from the ESC ID2. Please note that the current around 0 is not very accurate due to a very large measurement range (showing -0.2A, but the discharge current should really be positive based on our convention).

                                Alex

                                R 1 Reply Last reply
                                0
                                • Alex KushleyevA Alex Kushleyev

                                  @restore, thank you for checking.

                                  Let's do another test:

                                  • for safety, remove propellers from motors
                                  • with px4 disabled, go to /usr/share/modalai/voxl-esc-tools on voxl2
                                  • run: ./voxl-esc-spin.py --id 2 --power 0 -- this will send a zero power command to ESC ID 2 (which measures the total current and sends back the battery status message). Motors will not spin. This will also request the battery status and you should see output (if possible you can use the latest voxl-esc tools from dev branch from (https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-esc/-/tree/dev) since I am not sure which voxl-esc version is installed on your board).
                                  ./voxl-esc-spin.py --id 2 --power 0
                                  ...
                                  Found voxl-esc tools bin version: 1.6
                                  VOXL Platform: M0054
                                  Detected RB5 Flight, VOXL2 M0054 or M0104!
                                  ...
                                  ...
                                  	Board      : version 42: ModalAi 4-in-1 ESC (M0138-1)
                                  ...
                                  ...
                                  [0.017] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.87C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.232A
                                  [0.034] (2) RPM: 0, PWR: 0, VOLTAGE: 15.609V, TEMPERATURE: 35.88C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.609V, BOARD_CURRENT: -0.200A
                                  [0.060] (2) RPM: 0, PWR: 0, VOLTAGE: 15.610V, TEMPERATURE: 35.86C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.610V, BOARD_CURRENT: -0.248A
                                  [0.080] (2) RPM: 0, PWR: 0, VOLTAGE: 15.618V, TEMPERATURE: 35.85C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.618V, BOARD_CURRENT: -0.224A
                                  [0.095] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.87C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.272A
                                  [0.120] (2) RPM: 0, PWR: 0, VOLTAGE: 15.608V, TEMPERATURE: 35.90C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.608V, BOARD_CURRENT: -0.240A
                                  [0.134] (2) RPM: 0, PWR: 0, VOLTAGE: 15.612V, TEMPERATURE: 35.92C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.612V, BOARD_CURRENT: -0.264A
                                  [0.160] (2) RPM: 0, PWR: 0, VOLTAGE: 15.613V, TEMPERATURE: 35.90C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.613V, BOARD_CURRENT: -0.248A
                                  [0.174] (2) RPM: 0, PWR: 0, VOLTAGE: 15.608V, TEMPERATURE: 35.92C, CURRENT: 0.000A, BOARD_VOLTAGE: 15.608V, BOARD_CURRENT: -0.168A
                                  

                                  note that there are BOARD_VOLTAGE and BOARD_CURRENT printed, which are parsed from the battery status message coming from the ESC ID2. Please note that the current around 0 is not very accurate due to a very large measurement range (showing -0.2A, but the discharge current should really be positive based on our convention).

                                  Alex

                                  R Offline
                                  R Offline
                                  restore
                                  Regular
                                  wrote on last edited by
                                  #21

                                  @Alex-Kushleyev
                                  Thanks for the help, as I was calibrating the ESCs I did notice those messages, which confused me as to why we weren't able to get that information in PX4. On Monday it suddenly just started working despite my changing nothing. Gotta love when things fix themselves

                                  1 Reply Last reply
                                  0

                                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                  With your input, this post could be even better 💗

                                  Register Login
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  ModalAI
                                  Categories Recent Tags ModalAI.com Docs
                                  © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups