user3717524
user3717524

Reputation: 108

how to program a 5 pin motor with raspberry pi

I am recently working on a project where i want to control a 5 pin servo motor with raspberry pi.

5 Pin servo motor

i have searched for resources and found adafruit's servo motor with only 3 pin.This is link for Adafruit's 3 pin servo motor

Problem :

What's difference between a 5 pin and 3 pin servo motor ?
If they both are same what's pin out diagram for this 5 pin servo motor ?

This is source code for 3 pin servo motor.

    # Servo Control
import time
def set(property, value):
try:
f = open("/sys/class/rpi-pwm/pwm0/" + property, 'w')
f.write(value)
f.close()   
except:
print("Error writing to: " + property + " value: " + value)
 
 
def setServo(angle):
set("servo", str(angle))
set("delayed", "0")
set("mode", "servo")
set("servo_max", "180")
set("active", "1")
 
delay_period = 0.01
 
while True:
for angle in range(0, 180):
setServo(angle)
time.sleep(delay_period)
for angle in range(0, 180):
setServo(180 - angle)
time.sleep(delay_period)

What modifications must I do to control a 5 pin servo motor? Are there any major modifications?

Upvotes: 0

Views: 579

Answers (2)

user3717524
user3717524

Reputation: 108

I found out that, well u can connect a stepper motor or servo motor or dc motor for your Raspbberi Pi. Check the link for adafruit's stepper motor connection to raspberry pi.

Raspberry Pi stepper motor connection

If u see some more lessons you will find that you can connect dc,stepper or servo motor to your Pi.

Upvotes: 0

user3885450
user3885450

Reputation: 26

That is not a servo. It's a 5 pin Stepper motor you also need uni-polar driver

Upvotes: 1

Related Questions