0
\$\begingroup\$

I've got a servo which requires a 50Hz signal (which can be achieved with a 20ms period) and a 1ms-2ms dutycycle. This is your standard hobby servo. 1ms dutycyle makes it go left (0 degrees) 1.5ms makes it go center (90 degrees) and 2ms makes it go right (180 degrees).

I'm also in the possession of a FTDI FT311D breakout board. With the android phone I got, I can command the FT311D to send the required PWM signal to the servo.

FTDI provides a java interface with which I can communicate with the FT311D. This interface defines a method SetDutyCycle(byte pwmChannel, byte dutyCycle).

As you can see the dutycycle is of type byte. The documentation says the following about this dutycycle byte:

dutyCycle: the percentage value of the duty cycle,e.g. to set 50% duty cycle, specify this value as 50. Minimum 5% and Maximum 95%.

My problem is this: I need 5% for the 1ms, I need 10% for the 2ms BUT i think I need 7.5 for the 1.5ms dutycycle, which I cannot assign to a single byte.

I might be missing something here. Or is this totally impossible? Maybe there are other possibilities?

Documentation

\$\endgroup\$
  • \$\begingroup\$ If that is actually the case, this is a relatively useless design. Your use really requires either a 16-bit timer, or else an 8-bit timer for the on-time maxing out at 2ms triggered by another one with a slower timebase for the repetition rate. Even simply having mapped the range over 0-255 rather than 5-95 would have been better than what you are describing. \$\endgroup\$ – Chris Stratton May 7 at 20:59
  • \$\begingroup\$ Looks like something you might not be able to achieve with this design. But the servos are usually sensitive to the pulse duration rather than the DC, so if you can make it work with higher frequency you will have a better control of the pulse width. \$\endgroup\$ – Eugene Sh. May 7 at 21:04
  • 1
    \$\begingroup\$ @EugeneSh. Yes and no. "Analog" servos are sensitive to the frame rate, and will go bonkers if you drive them too fast. Digital servos are usually fine, though. \$\endgroup\$ – TimWescott May 7 at 21:24
  • \$\begingroup\$ Given that you can only use 5-90 as the values that tells you the range. To set 1ms you would set the PWM to 5, to set 2ms you'd set it to 10. Setting 7 or 8 gets you somewhere in the middles close to 1.5ms. This gives you very course control of the servo. However it seems the FT311D is designed for a a PWM span within the whole of the frame period ...it's not designed to drive an RC servo which uses only a few percent of the PWM range. You could use the whole 5-90 range and build a translation at the servo end, that would be straightforward with a small MCU. \$\endgroup\$ – Jack Creasey May 7 at 21:42
  • \$\begingroup\$ According to the datasheet: "FT311D provides 4Pulse Width Modulation (PWM) outputs. These can be used to generate PWM signals which can be used to control motors, DC/DC converters, AC/DC supplies, etc.Further information is available in an Application Note AN_140 -Vinculum-II PWM Example". Looking into AN_140 reveals that rather complex PWM are possible using multiple comparators (see 3.1 for example). Not sure though if this level of control is accessable from android though. \$\endgroup\$ – Christian B. May 8 at 8:11
1
\$\begingroup\$

I've contacted support at FTDI. They basically said it's not possible.

The PWM is meant for stuff like dimming leds. Not to control servos.

\$\endgroup\$
0
\$\begingroup\$

You can always run a fast rated servo at lower refresh frequencies, but you can't run a slow rated servo at fast refresh frequencies.

Thus to get 1, 1.5, 2ms you could try 6, 9, 12% of 60 Hz up to 30, 45, 60% of 300Hz and hope it works. But with poor resolution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.