Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: gurumelo on December 16, 2014, 01:10:46 PM

Title: A20 micro and servo motors
Post by: gurumelo on December 16, 2014, 01:10:46 PM
Hello, excuse me for the question.
What do you think about connect servomotor directly to GPIO A20?
suggestions?

Thank you.
Title: Re: A20 micro and servo motors
Post by: MBR on December 16, 2014, 08:35:20 PM
Unless the servomotor has some build-in electronics, which accepts 3.3V (not 5V!) TLL-compactible logic control signals, you cannot conect it directly. You will neeed some kind of driver, the exact type depens on the servomotor and its usage.
Title: Re: A20 micro and servo motors
Post by: dave-at-axon on December 17, 2014, 02:25:54 AM
Another thing to consider is if you are doing this under an OS and trying to bit bang the GPIO. It will be very slow.

You ideally need to use the PWM pins and then write a driver to control them. Have a look at the PWM control for the backlight as this might give you an idea on how to do it.

BUT as MBR says, you may need to level shift the 3.3V to 5V for the servo motor to accept the input. You could try it first and see if it works as an output to an INPUT is OK but make sure that the INPUT on the servo is not PULLED UP to 5V as this will damage the GPIO output.
Title: Re: A20 micro and servo motors
Post by: gurumelo on December 17, 2014, 04:18:40 AM
Thank you. and then... How do people connect servos directly to raspberry pi?
and They use servoblaster https://github.com/richardghirst/PiBits/tree/master/ServoBlaster
Title: Re: A20 micro and servo motors
Post by: gurumelo on December 19, 2014, 06:26:48 PM
for example, directly: http://raspberrypiwonderland.wordpress.com/2014/02/06/raspberry-pi-gertboard-servo-motor-and-post-cny-update/
Title: Re: A20 micro and servo motors
Post by: MBR on December 20, 2014, 12:21:30 AM
The most 5V TTL circuits can accept 3.3V level without problems (the lower threshold for the Hi level is about 2V), the problem is that the SoC inputs cannot take the 5V. So you can connect the SoC outputs directly to 5V TTL inputs, but unless you ad some protection (e.g. Zener diodes), the first misconnection (e.g. connecting to input with active pull-up) may be fatal.

The minimal protective circuid should be someting like SoC output - resistor - 3.6V Zener diode connected to the ground - resistor - servo TTL input (the resistors should be at least hundreds of Ohms), maybe also some capacitors (their capacity depends on the required speed).
Title: Re: A20 micro and servo motors
Post by: gurumelo on December 22, 2014, 09:42:48 PM
Thanks MBR
Title: Re: A20 micro and servo motors
Post by: gurumelo on December 25, 2014, 12:17:22 PM
MBR. Do you have a plan, where can i see this connections? Thanks
Title: Re: A20 micro and servo motors
Post by: MBR on December 26, 2014, 01:44:32 AM
I don't have any, but I googled some articles with schematics, see http://www.bigmessowires.com/2011/10/19/the-quest-for-a-simple-level-converter/, http://electronics.stackexchange.com/questions/97889/is-there-any-bidirectional-5v-3-3v-level-shifter (http://electronics.stackexchange.com/questions/97889/is-there-any-bidirectional-5v-3-3v-level-shifter) or http://electronics.stackexchange.com/questions/81580/step-up-3-3v-to-5v-for-digital-i-o (http://electronics.stackexchange.com/questions/81580/step-up-3-3v-to-5v-for-digital-i-o) (look also at the PDF referenced in the first answer).