Go Down

Topic: PWM "hardware geek speak" to "software (Read 1 time) previous topic - next topic


Oct 14, 2010, 06:03 pm Last Edit: Oct 14, 2010, 06:09 pm by arbarnhart Reason: 1
I have read the tutorials and done the fade demo. I understand the concept of setting a level and delaying to get the timing. What isn't sinking in is how to take a spec of what I need to do from a hardware perspective and turn that into what I need to do from the software perspective.

Here are my instructions:
The standard servo control in RC which runs the ESC is a PWM pulse with a 5 cycle carier, 1ms - 2ms subpulse that controls the ESC. Our aircraft ESCs arm at 1ms and go to full throttle at 2ms. Our car controllers need to be calibrated to the PWM source then arm at 1.5ms, from there to 2ms is forward, from 1.5ms to 1ms is brake and reverse.

What is the level and delay for the 1ms subpulse? 2ms? Or better yet, how do I figure that out?



Are you trying to move a servo?  If so, you don't use PWM.  And there's a servo library which makes it super easy to do. (Check the libraries section on the main page of this site.)


Thanks; I am checking that option and will update this post later with confirmed thanks or additional info...


Yes, the servo library is your friend. Basically the Electronic Speed Control acts like any servo you connect to your RC-receiver.

In the Servo library you can either set the values as degree (0-180) or as µs impulse duration going from 1000µs to 2000µs with 1500µs being the middle. I prefer the µs values as those undergo less transformations. The degree will internally converted to µs. When you all attach, it's a good idea to set the limits, in your case 1000 and 2000.

If you use the call attach(...), the servo will go to the middle position 1500µs. If you don't like this, set the servo to the desired original position (eg 1000µs for off in case of airplanes) before calling attach.

For your ESC, you might need to calibrate it first by setting it to various positions. Don't forget to do this, otherwise the ESC will calibrate itself to values you don't intend and behave strangely. There was recently a thread here on the boards about this.


Go Up