Project tutorial
Solo Servo Sweep

Solo Servo Sweep © GPL3+

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

  • 7,720 views
  • 9 comments
  • 20 respects

Components and supplies

About this project

Intro

Solo has a great development environment but a lack of I/O. Currently the Accessory port breaks out CAN, Mavlink Serial to Pixhawk, and USB to Sololink(imx6). By using an arduino and firmata can add custom sensors, control servos, blink LEDs, or any other arduino function. 

This tutorial will walk you through the steps of using an arduino with Solo to control a servo. 


Software Preqs:

  • Solo update 1.2.0 or greater
  • Arduino IDE
  • Filezilla
  • Putty or any other SSH Client

Step 1: Upload Firmata Host to Arduino Uno

Open StandardFirmata from the examples tab. Select board and port. Upload!  


Step 2: Hardware Setup

Parts

Note: The breakout board is not sold at this point. Please refer to here

Assembly

Power on

Step 2: Download pyMata and Code

pyMata

Step 3: Transfer Files to Solo

  • Connect to your Solo's Wifi network!

    Step 4: SSH into Solo

    SSH into Solo using your OS's SSH client. For Windows we will use Putty.

    Make sure you are still connected to Solo's Wifi!

    See the photos captions for more details

    Step 5: Install pyMata

    Run this command in your SSH session:

    cd ./PyMata-master/PyMata-master && python setup.py install

    This should be your result

    Step 7: Run the example

    While your ssh session is still open run:

    cd && python SoloServoSweep.py

    Code

    SoloServoSweep.pyPython
    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()
    

    Custom parts and enclosures

    Solo Breakout Board
    Breakout board for 3DR Solo accessory port

    Schematics

    Untitled Sketch 2_bb.png
    Untitled%20sketch%202 bb

    Comments

    Similar projects you might like

    How to Use ServoTimer2 Library (Simple Explain) Servo Sweep

    Project tutorial by ashraf_minhaj

    • 2,303 views
    • 3 comments
    • 6 respects

    Password-Protected, Arduino-Controlled Servo Gate

    Project tutorial by Aayush Sharma

    • 910 views
    • 0 comments
    • 6 respects

    PS3 Controller Control Servo Wireless

    Project tutorial by Youssef Sabaa

    • 19,881 views
    • 2 comments
    • 12 respects

    Control Servo Power with a Transistor

    Project showcase by Kevin Gagnon

    • 5,388 views
    • 1 comment
    • 9 respects

    Arduino/Android - BLUETOOTH Multi Servo Motor Control

    Project tutorial by Danny van den Brande

    • 13,195 views
    • 8 comments
    • 18 respects
    Add projectSign up / Login