Connect with us

Using a microcontroller to turn a servo

Discussion in 'Microcontrollers, Programming and IoT' started by lvanghele, Aug 3, 2013.

Scroll to continue with content
  1. lvanghele


    Jul 17, 2012
    Hi, I am looking to use a Servo motor to turn a potentiometer, based on input from a 0-10v analog signal. My question is, how do you use a microcontroller to convert that 0-10v input into a degree of turning from the servo? Any help would be appreciated!
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    Servos typically require a pulse train with varying mark/space ratio to position them.

    See here.

    You simply use a microcontroller to convert the voltage (0-10V) to a be a string of between 1ms and 2ms pulses.

    Practically, the input siganl will need to be divided by two to bring it into the range of 0 to 5V that most microcontrolers can handle.

    Using an analog read function, you'll get a number between 0 and probably 1024.

    Using a bit of basic math you convert that to a number between 1000 and 2000 and use this to generate pulses of that number of milliseconds.

    However, you might like to consider using one of the digital pot IC's which can do something similar without the need for mechanical stuff (although you'll likely still need the microcontroller)
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day