Servers by jDrones

How to Read RPM signal from Esc?

(Falcon) #1

Hi all ,

I am using

  • Fixwing plane similar to sky walker
  • Pixhack flight controller
  • Arduplane 3.4 firmware

I just get my new speed control ( Hobbywing Platinum 100A V3 Esc Electronic Speed Controller ) and it has RPM output signal , as shown below

I am thinking of use it with my system but have no idea about that .
I found parameters in the mission planner talking about RPM

Is it possible ? If yes ,

Where should i connect the RPM cable ?
How to config setting in parameters ?
How to display data in mission planner ?

" I think it’s important function specially in Gas motor plane "


(jpkh) #2

Currently we don’t have a direct support on any of our software for this type of feature. ESC’s that gives RPM data out are still rather new and not widely available so it will take awhile to get this feature in firmwares/ground control softwares.
There are some work done already for this type of application on UAVCAN ESC side so I would guess that RPM based system are coming soon after ESCs are getting a bit more popular.
Do you know what type of output data your ESC gives on RPM port??

(Falcon) #3

thanks @jpkh , for replay …

ESC gives RPM as analog data

and this is the manual for the ESC .

Can I use it with ADC port on pixhawk ?

(jpkh) #4

No you cannot use ADC. Document is not clear on what type signal it really gives and I was looking last night a bit around net if I could find more details of it. Digital signal would be best but I hardly doubt that it’s digital. Most likely it is PWM output

To capture PWM you need to have Interrupt channel. That pin in normally used for heli governors and other so I wonder how accurate RPM detail data is. You still need to make calibrations etc to make it work as it does not give real RPM data.

Like I said earlier, Pixhawk does not support RPM data for now. Having like this jD-IOBoard you could capture PWM and with a littlebit of programming it could send extra MAVLink data to Pixhawk that again sends it down to Mission Planner. Mission Planner need to support this extra data but that I think we can arrange with @meee1 rather fast…

I will check with other our devs too our plans for this. Most of guys are are DroneCode ELC so it might take awhile to get things going.

(George Zogopoulos Papaliakos) #5

Isn’t this set of parameters and this discussion (AP3.5: RPM not returning anything) relevant to this topic?

I mean, I don’t know if it has gone out of master yet, but I believe that if the ESC outputs the RPM as a pulsetrain (not PWM), then it should be doable to input them in Pixhawk.

(George Zogopoulos Papaliakos) #6

Actually, this snippet is from the datasheet:

Output Port for RPM Signals】
• Platinum V3 series of speed controllers have independent output ports for RPM signals.
• Specifcation for interface signals: It is the periodic signal with duty ratio of 17%, and 0V for low level, 3.3V for high level.
•It represents the electric rev of the brushless motor (electric rev means the rev of a 2-pole brushless motor). And here is the formula used for converting the actual rev of multi-pole brushless motor into the electric rev of 2-pole brushless motor:
Electric rev = Actual rev of the multi-pole brushless motor × Pole number ÷2
E.g. the actual rev of a 12-pole motor is 5000rpm, so its corresponding electric rev is: 5000 × 12 ÷ 2 = 30000rpm

To me, it looks like it outputs a variable frequency pulsetrain and should be readable from Pixhawk.

(Falcon) #7

@Georacer , @jpkh . I am also thinking like that ,

If the problem in the type of data ( ppm , pwm , ADC … )

Can we create external board that read RPM sensor and convert it to the accepted data ?
Dose there any optional data input in Pixhawk and it’s output display in mission planner ?

  • the problem is
    Where is the input channel in pixhawk ?
    How to read it in mission planner ?

Hope I can get answer for all Question

(George Zogopoulos Papaliakos) #8

As for converting RPM information from one form to another, a Teensy 3.1 can always come in handy.
It comes with many libraries, such as frequency counting and frequency generating.

As for the rest of the questions, I can’t be of much help right now.

(jpkh) #9

Yeah Teensy is ok and so it jD-IOBoard that have already some MAVLink software available. IOBoard have few pins exposed to read incoming PWM signals. Modifying software for this application would be rather easy.

Yes I saw those duty ratio readings but that is not fully transferable to physical RPM as there are not reference on it. This works directly with heli Governors as Governor reads input signal and tries to keep it steady.

If you have a Tachco meter for RC use then you can get your reference and calibrate RPMs. Having a small electronics connected to 2 of the motor cables and reading RPM from there would be even better and easier as most cases you know how many pulses you need to make one revolution.

(rmackay9) #10

Ok, this is an interesting topic. We would certainly like to get the RPM value in from the motors if it’s available and we could support multiple protocols for doing that. It’s not clear to me from the discussion above whether it’s using an analog voltage or if it’s serial or PWM. In any case, if we can confirm that it’s something we can read in and if we have enough input ports on the Pixhawk then we could extend the AP_RPM library and link it up with the motors library and then add code to monitor the output vs input and do something if they don’t match.

(George Zogopoulos Papaliakos) #11

I think it’s safe to say that 99% of the time, RPM information will either be a varying frequency pulsetrain or a PWM signal.

It is my understanding that in gas motors, it is the first case, with a pulse triggering exactly once in a cycle.
In electric motors, it might have to do with the number of motor magnets or the ESC’s preference, and scaling calibration might be needed.

(Rob_Lefebvre) #12

I do believe that it is possible to read the signal from this ESC now. Chances are that it’s a simple “1 pulse per electric pole” output, and RPM is measured by counting time between pulses.

The AP_RPM library is already capable of measuring this on both copter and plane. I had been working on this stuff in December, and currently have several helicopters flying with an internal governor mode, using the AP_RPM library, and a pulse generator on the main shaft. The governor part of the code is not in Master, but I believe my improvements to the RPM library are.

There is still a problem with the Pixhawk RPM measurement code, but it only surfaces with very low frequencies, below about 500 RPM on a single pulse/rev. I think it’s a timer overflow in the pulse catch interrupt code. Something like that.

I do not know what the maximum RPM measurable is.

Note, that we can only do 1 RPM channel direct into Pixhawk.

I had written code for Teensy that can handle at least 4 channels of data, and RPM’s up to I think 100,000 rpm, and it output data over I2C to the Pixhawk. So this could have been used on a quadcopter, and probably expanded to 8 inputs. Unfortunately, none of this ever made it to Master either.

(George Zogopoulos Papaliakos) #13

Any good gossip about why it didn’t make it to master?

(Rob_Lefebvre) #14

Not really. There just wasn’t an interest in it at the time I guess. I tend to be thinking ahead a bit sometimes.

The code is here:

And here:

(jpkh) #15

Great @Rob_Lefebvre then let’s make that it will go to master. Yeah Pixhawk can only measure one single channel and that would be sufficient for airplanes but on copters we need more. Also we need to coordinate with @meee1 to get these values shown in Mission Planner

(nicbk117) #16

I got this working using no additional hardware with ArduCopter 3.3.3 TradHeli. I have a Castle ICE2 so no direct reading from the ESC. I use a Microbeast brushless RPM sensor. Both ESC and Pixhawk logging give the same RPM value. The motor was running at around 90000 electrical RPM…

I noticed that when the motor is OFF, RPM value stays at the late read value. Value changes as soon as the motor is running or if it has beeped (Castle ESC make to motor beep every 30 seconds or so).

By the way, I don’t see RPM_MIN and RPM_MIN_QUAL params on my param list for Copter 3.3.3 TradHeli.

Hope this helps…

(Rob_Lefebvre) #17

IIRC, RPM_MIN and RPM_MIN_QUAL are two params that I added into Master that were part of the RPM measurement improvements I did tied to the internal governor code.

The internal governor code part for tradheli didn’t make it into master yet.

(Falcon) #18

@jpkh @Rob_Lefebvre @rmackay9

Excellent interaction.
I hope the developers interest in this idea to continue to make it a success and added to the new master as well as mission planner .

Best regards.

(Pedro Miguel Costa Carrola) #19

Hello to all,

This looks great. However to where is the RPM sensor conected to in Pixhawk?

Thanks in advance

(George Zogopoulos Papaliakos) #20

I’d like to bump this, since I’m looking for the same answer.

What is the hardware/parameter setup for reading a frequency RPM signal?