Skip to content

How to get 20kg servo working in pyfirmata #116

Description

@glendell03

Servo brand and specs: https://www.makerlab-electronics.com/product/digital-standard-servo-motor-20kg-mg958/

Hi, I need help to get the 20kg servo working

# main.py

from arduino.servo import Servo
from pyfirmata import Arduino


PORT = "/dev/ttyACM0"
board = Arduino(PORT)

servo = Servo(board, 9)

servo.angle(90)
# servo.py

from time import sleep

class Servo:
    def __init__(self, board, pin):
        self.board = board
        self.pin = pin
        self.servo = self.board.get_pin(f"d:{self.pin}:s")

    def angle(self, angle):
        self.servo.write(angle)
        sleep(0.015)

In SG90 servo (small) the code works but in big servo it doesn't


I tried creating a sweep like in arduino and it worked but the one I need is in the code above

from arduino.servo import Servo
from pyfirmata import Arduino


PORT = "/dev/ttyACM0"
board = Arduino(PORT)

servo = Servo(board, 9)

while True:
    for i in range(0, 180):
        print(i)
        servo.angle(i)
    for i in range(180, 1, -1):
        print(i)
        servo.angle(i)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions