HomeНаука и техникаRelated VideosMore From: O'Reilly

Controlling Servo Motors with Raspberry Pi

278 ratings | 93171 views
Use the PWM to control the width of pulses to a servo motor to change its angle. Buy the Raspberry Pi CookBook Guide - http://shop.oreilly.com/product/0636920029595.do Don't miss an upload! Subscribe! http://goo.gl/szEauh Stay Connected to O'Reilly Media by Email - http://goo.gl/YZSWbO Follow O'Reilly Media: http://plus.google.com/+oreillymedia https://www.facebook.com/OReilly https://twitter.com/OReillyMedia
Html code for embedding videos on your blog
Text Comments (18)
SanvedTechton (3 months ago)
What servo motor would you suggest which would be powerful enough to press a button ? How much torque should I look for ?
Robert Hatfield (2 months ago)
Any hobby servo would have enough force to press a button designed for humans to press. Buy the cheapest one. :)
Sean O'Neill (4 months ago)
What of make of servo is that?
Florin Radoi (7 months ago)
Hy ! This is not working. The code loops always through the "pwm.start(5)" line. The code will generate an oscilation between the commanded position and the initial position of 5 ! How can we solve this problem ? Thx.
Arjan van Vught (9 months ago)
Why not using hardware PMW? Software PWM in Linux is guaranteed to jitter.
Ivan Stefanov (1 year ago)
Is this possible without the virtual potentiometer but rather a bluetooth keyboard?
hurrdurr25 (1 year ago)
Software pwm doesn't really work for servos
Wei XING (1 year ago)
duty = float(angle)/(180/(12.5-2.5)) + 2.5
Chuck Clift (1 year ago)
At 3:50, you say that the servo control wire should be connected to GPIO pin 18, but you then proceed to connect the wire to GPIO pin 12. You need to distinguish between the GPIO pin 18 and the GPIO pin that is labelled "BCM 18" (which is pin 12). I just wanted to leave the comment for anyone else who may run into that problem.
Blake Lombard (2 months ago)
a year later you got my back man
Aric Wang (2 years ago)
shake always, and servo getting hot. How to use hardware PWM, hardware timer? The frequency can't low to 100 50Hz right?
amrosik (2 years ago)
is there a solution to the yittering problem?
Nero Azmi (2 years ago)
1. at line def__ init__(self,master): the line doesnt turn into blue when i wrote it 2.so i copy n paste... continue write the code but the gui slider is empty when executed, any way to troubleshoot this?
VALIS Machine (2 years ago)
Is it only feasible to run one servo? Would two be possible? Not even necessarily independent.
jay shah (2 years ago)
why we not used the 3rd control lead?
TelloBotello (2 years ago)
link of the code?
Miro M (1 year ago)
https://github.com/simonmonk/raspberrypi_cookbook_ed2/blob/master/servo.py
Andrea Bettati (4 years ago)
Thank you very much! Like all your videos!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.