Control Up to 4 Servo Using a Smartphone or Any Device With an Audio Output

Introduction: Control Up to 4 Servo Using a Smartphone or Any Device With an Audio Output

Here I present a simple electronic montage to control up to four servos with any device able to read an audio file!

Step 1: The Principle

Servos are drived using a PWM signal between 1ms (no rotation) to 2ms (full rotation), spaced by 20ms start to start. More on WIKIPEDIA ! :)

Such signal can be carried through an amplified audio signal, like the one that get out of your mobile phone. Here I present a simple electronic montage, adapted from here. The basis is two transistors which amplify the audio signal to an high enough voltage. The first transistor is a NPN, which is activated when a positive voltage is applied. By adding a second amplifier, with a PNP transistor activated by a negative voltage, we can control two servos by audio channel. Since most devices (smartphones, PC, ...) have 2 channels, you can control up to 4 servos !

Step 2: Hardware

You will need :

  • 12 10k resistors (10 are sufficients, but 12 are easier for this montage)
  • Some wires
  • 6 NPN transistors (BC337 or equivalent)
  • 2 PNP transistors (BC327 or equivalent)
  • A breadboard and its power supply (5v)
  • 4 servos

Connect everything like on the picture. With the BC3X7, the flat side face the power line of the breadboard, and for each transistor : (left to right) Collector, Base, Emitter. This may vary depending on your references. A capacitor may be useful on the powerline to avoid any interference between servos. Or connect the servos drived by the PNP transistor to the second powerline.

Step 3: The Software

I coded a little python script to produce a series of audio files that, once played, position the servo accordingly. It generate files with pulses from 0.8 to 2.6 ms. While servo are supposed to work with signal from 1 to 2 ms, the margin my be usefull to use the servo to its true full range.

In addition, I made an App Inventor project which play the audio file depending the position of the sliders.

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018

Epilog Challenge 9

Participated in the
Epilog Challenge 9

Be the First to Share

    Recommendations

    • The 1000th Contest

      The 1000th Contest
    • Battery Powered Contest

      Battery Powered Contest
    • Hand Tools Only Challenge

      Hand Tools Only Challenge

    3 Discussions

    0
    -Skar-
    -Skar-

    2 years ago

    This is a really cool idea. For a further improvement, it would be good to add a flyback diode for every servo in parallel (in block direction). Else the transistors may get damaged overtime, like with every inductive load.

    0
    DoMias
    DoMias

    Reply 2 years ago

    Thank you for your comment, I wanted to keep the simplest montage possible, based on http://srimech.blogspot.fr/2012/08/controlling-se... but I should (and I will if I have the time and the components ^^) improve it and update this instructable in consequence !

    Thank you again !

    D.

    0
    tomatoskins
    tomatoskins

    2 years ago

    Wonderful information!