Analog output and pulse counting for rpm


I am attempting to build a test stand for testing rc aircraft motors. The aim is to record all parameters onto the PC.

To do this I was planning on using the servo controller as I can easily interface directly using USB and many of the sensors like voltage and current are analog and this is well suited to the servo controller.

The area I need some advice is with the rpm counter. I am using an edge sensor or qtr-1a - . This is position very close to the propellor and does give a pulse. The servo controller code is no way near fast enough to record these pulses.

Can I use a orangutan to count the pulses? And how could I then simply interface this back to the servo controller? Or directly back to computer? I understand that the orangutan does not have a anologue output, so not sure if this is the best way to do it.

The pulses are fairly quick - was aiming to design for around 60,000 rpm x 3 blades = 3 pulses per ms. The pulse width would be fairly small or about .005 ms.

Thanks and interested in your comments on how to best achieve a project like this.

That’s a very high pulse rate!

The Orangutan uses an AVR microcontroller, which has an end-to-end interrupt latency of about 4 microseconds, so if you use a pin change interrupt, you should be able to count these pulses with some CPU left over.
You can then perhaps output a small packet with the value of the current speed over the serial port, say, 100 times a second. If you had a higher-resolution analog output, you could also change that for the output, but the AVR PWM isn’t good enough. Serial seems easiest.


As jwatte mentioned, using serial to communicate the pulse count to your servo controller might be the easiest way. If you are planning on using an Orangutan controller, you might be able to use our wheel encoder library and two QTR sensors to read the propeller. If you only want to use one QTR sensor, you might still be able to refer to the encoder library for hints on how to make use of the pin-change interrupt. You might also find the QTR sensor library helpful. You can find more information about the encoder and QTR sensor libraries in the Pololu AVR C/C++ Library User’s Guide.

- Jeremy

Thanks so much for your replies,

you mention the AVR PWM as an analogue output - can I ask how that works?

Jeremy - I have had a look at these library’s and think I can make a start on this. A few questions:

  1. The servo controller can receive serial packets and I have seen this - but what do I do with this once received? The purpose is to get this information back to the PC and currently this is connected using the USB and the .net libraries to read the state of the servo controller. So once I receive the serial data on the servo controller how do I get this back to the PC? Do I need to reserve an IO line and set it’s output so I can read it’s state back at the PC?
  2. The edge sensor I am using is the qtr-1a - it’s not a digital output. Will this matter with the application I am using it for.
  3. An alternative to sending the signals to the servo controller would be to connect the Orangutan directly to the PC using a serial to USB like this USB-to-Serial Item 391 “” - would this be any more difficult to achieve? If I did this then an options would to use the controller fully in place of the servo controller for all functions that I need?
  4. I have a number of DAC - MCP4725 chips - Could these be used easily to create a analogue output for this purpose? How would I interface with the I2C bus?
  5. 4 microseconds latency - what is the impact of this? i.e - if the pulse width is 4us will I be able to detect it? What is the absolute min pulse width that can be detected, and what is the minimum time between pulses to be detected reliably?

Thanks very much for your help so far.

To output PWM as an analog signal, you add a filter (a simple RC filter may be sufficient) and change the duty cycle of the PWM to change the analog output. Unfortunately, this has a few problems;

  1. There will be ripple in the output, because RC filters aren’t particularly ideal band limiting filters.
  2. There will be significant lag, because you need to band limit to < 50 Hz for the 490 Hz Arduino PWM frequency, which means at least 20 ms delay. (Quite simplified, group delay and filter math is complex)
  3. The full range of PWM duty cycle is only an 8-bit value, so the best precision you can get out from the PWM would be 0…255, which is likely not sufficient precision for someone who wants to count up to 60,000 pulses per second.

Without knowing what servo controller you are using, I cannot answer some of your questions. Could you tell us which servo controller you are using and how you are interfacing it with your computer?

In general, the QTR-1A should work fine for reading edges like that; however, I am not sure if it will be fast enough for your application.

Which Orangutan are you planning on using? Some of them already have a USB interface so you would not need to use the USB-to-Serial Adapter. If you are not planning on controlling brushed DC motors with the Orangutan, you might consider using our new A-Star 32U4 Micro instead since it also has built-in USB functionality.

- Jeremy

Are you really aiming for 60,000 rpm? That sounds dangerous! What motor can realistically produce such a high rpm and what diameter propeller will you be using?

Suggested safety limits from one of the propeller manufacturers:

Some discussion on the potential problems with high rpms: … prop-specs

Jwatte - thanks for the details of the pwm - I think I understand

The servo controller I the have is the 12 and 16 maestro models,

Jeremy - I have the baby orangutan and the sv 328p that I can use, my preference was to use the baby though for a simple project like this. I will have a look at the a* for next purchase! it looks very good. You also mentioned that the edge sensor may not be fast enough, are there any specs for this?

Jim - this is a test rig, so wanted to allow for the upper range of say a fan jet, these can do 60,000 rpm, but actually have many more blades so not sure how well this will work. Will this be too high to measure?

How about the mcp4725 chip, is this an option for this type of project?

And lastly my question on pulse width?

Thanks for all your responses so far.

You might refer to the datasheet for the QRE1113GR sensor, which can be found under the Resources tab on its product page, to get an idea of the reflectance sensor’s response time.

As mentioned earlier, using serial to communicate is probably the easiest way. I am not sure if there is any benefit in using the MCP4725 chip to convert a digital signal to an analog voltage for the Maestro to read.

- Jeremy