Page 1 of 1

Controlling a servo/Outputting a PWM signal on the CF2

Posted: Tue Apr 21, 2015 6:44 am
by Ace_Archer
Hi all!

Long story short, I'm trying to control a servo (standard 9g) with the crazyflie, specifically moving it into certain positions once it reaches a specified altitude, and I'm wondering how I'd go about outputting the PWM signal from the crazyflie? I know the basic theory behind PWM signals and how they're suppose to work, but my googling hasn't yielded much about how to output the signal using python (or how to on a crazyflie for that matter!).

Thanks, I appreciate any help! :D

Re: Controlling a servo/Outputting a PWM signal on the CF2

Posted: Tue Apr 21, 2015 8:49 am
by tobias
Hi and welcome!

Things aren't as neat as it should yet but you can have a look at the buzzer example and code. It outputs PWM signal on the expansion part for the sound. Should be to hard to use as a base for a servo output.

Re: Controlling a servo/Outputting a PWM signal on the CF2

Posted: Mon Feb 08, 2016 8:22 am
by Veerachart
Hi,

I would like to know if you have any progress.

I tried adding another motor to the set of motors, using TX2, but the servo does not move so much. Seems the frequency of the PWM that is used to control the thrust uses different frequency (328 kHz) as the normal servo (50 Hz, I guess).

Re: Controlling a servo/Outputting a PWM signal on the CF2

Posted: Thu Feb 11, 2016 9:14 am
by vivekrk44
I would recommend using this tutorial for your code

http://stm32f4-discovery.com/2014/05/st ... -tutorial/

It shows you how to use the timers and set up the PWM signal at a specific frequency and send out a signal of required pulse width

Regards
Vivek

Re: Controlling a servo/Outputting a PWM signal on the CF2

Posted: Tue Feb 23, 2016 3:00 am
by Veerachart
I finally figured it out that the BRUSHLESS mode works the same as the signal for servo motor, so I just created another motor in BRUSHLESS mode and use this to control the servo.