neeraj rajput
Posts: 3
Joined: Wed Dec 10, 2014 8:05 am

problem related to servomotor

Fri Dec 26, 2014 6:26 pm

hii all
I am new user in Rpi environment i was trying to work with servomotor but its not working just give me possible way how to test all that stuff.
i am using rpi B+ model with raspbian os

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: problem related to servomotor

Fri Dec 26, 2014 8:46 pm

"It's not working" is not a helpful report.

Your servo has three wires: power, ground, and signal. If it's a small servo you can power it from the Pi.

5V to the power wire
GND to the ground wire
GPIOx to the signal wire

Then use servoblaster or pigpio to send control signals to the GPIO.

weebsvision
Posts: 1
Joined: Sat Dec 27, 2014 5:03 am

Re: problem related to servomotor

Sat Dec 27, 2014 5:09 am

In my blog today, I wrote about how to control a servo from a Pi. http://www.weebsvision.com/blog There are several methods I read about out there and mine is just one of them! :geek:

desktopdan
Posts: 10
Joined: Mon Apr 21, 2014 8:29 pm

Re: problem related to servomotor

Sat Jan 03, 2015 3:30 pm

Hi,
I have a specific issue related to a servo motor.
I have a FITEC FS90 servo (http://www.pololu.com/product/2820).

I plugged it in as described in various places (i.e. signal input to GPIO18 etc).

I wrote a very simple Ruby script to run it, based on the ruby wiringpi library (https://github.com/WiringPi/WiringPi-Ruby) :

Code: Select all

require 'wiringpi'

io = WiringPi::GPIO.new
io.mode(1, PWM_OUTPUT)

puts "starting.."
io.pwmWrite(1,500)  #start motor
puts "sleeping"
sleep(1)
puts "stopping.."
io.pwmWrite(1,0)
The problem is that no matter what number i put in the pwmWrite function, the servo either does nothing or moves to one extreme and starts to whine.

I reckon this is some rookie mistake but I can't really figure out what I need to do to make it move to specific positions.

Any ideas out there? Many thanks!

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: problem related to servomotor

Sat Jan 03, 2015 3:40 pm

You position a servo by sending it pulses generally between 1000 µs and 2000 µs long 50 or so times a second.

You need to find out how to do that using the PWM function you are using. Getting the pulse duration correct is more important than the update frequency. Getting the pulse duration wrong can damage the servo (by forcing it against its endstops).

Alternatively use some of the Pi software which specifically support servos.

Generally it's considered better to start a new post for a new problem.

desktopdan
Posts: 10
Joined: Mon Apr 21, 2014 8:29 pm

Re: problem related to servomotor

Sat Jan 03, 2015 9:58 pm

Thank you! I will have a go at that.

Apologies for the etiquette failure. I will not do it again!

:-)

Return to “Beginners”