Daniel Nugent
Published © GPL3+

Solo Servo Sweep

Add a servo to your solo using arduino, firmata, python, and a usb OTG

IntermediateFull instructions provided11,567
Solo Servo Sweep

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solo
3DR Solo
×1
Servos (Tower Pro MG996R)
×1
Solo Breakout Board
×1

Story

Read more

Custom parts and enclosures

Solo Breakout Board

Breakout board for 3DR Solo accessory port

Schematics

Untitled Sketch 2_bb.png

Code

SoloServoSweep.py

Python
Drive a servo in python from Solo
from PyMata.pymata import PyMata
import time
import sys

SERVO_MOTOR = 9  # servo attached to this pin

END = 170 # Max servo travel

# create a PyMata instance
board = PyMata("/dev/ttyACM0")

# configure pin as servo
board.servo_config(SERVO_MOTOR)

try:
    while True:
        for i in range (0,END):
            # sweep up
            board.analog_write(SERVO_MOTOR, i)
            time.sleep(.015)
        for i in range (END,0,-1):
            # sweep down
            board.analog_write(SERVO_MOTOR, i)
            time.sleep(.015)

except KeyboardInterrupt:
    board.close()
    sys.exit()

Credits

Daniel Nugent

Daniel Nugent

1 project • 9 followers
I was born, one thing lead to another, now I'm here.

Comments