Category Archives: Motor Servo

Controlling Many Servo(s) Using IC TLC5940

by : Antonius (@sw0rdm4n)

Tlc5940 is a 16 channel led driver.  Since this IC has pwm control ability we can use this IC for controlling up to 16 servo(s).

Below is tlc5940 datasheet:

TLC5940 pins:


out0 – out15 pin will be used for pwm controller on each servo. In this tutorial, we will control 5 motor servos using tlc5940 and arduino uno.


  • 1 arduino uno
  • 1 tlc5940
  • 1 half + breadboard
  • 5 resistor 2,2 k
  • male to male jumper wires
  • arduino uno
  • 5 tower pro micro servos



Actually It’s better to use external power source to power multiple servo.



Here’s the code for arduino:

#include "Tlc5940.h"
#include "tlc_servos.h"
void setup()
void loop()
  int i;
  for (i = 1;i <= 5; i++) {
    tlc_setServo(i, 0);
    tlc_setServo(i, 180);

On success, we can control our 5 servo(s), just like in this video:



Infrared Sensor to Detect Range and Kinect Actuator



This is simple and basic guide to detect object using infrared sensor. Hardware requirements : – an arduino or any arduino compatible board ( here I use sduino because it has enough pins to control 2 motor servos) – an infrared sensor – jumper wires (any color doesn’t matter) – 2 motor servo as kinetic actuator (front leg and rear leg)


First, plug jumper wires to infrared sensor, here we use sharp infrared sensor. Actually jumper wires color doesn’t matter, but to make it easy, we’ll plug red for 5v, black for ground and yellow for analog input :


Here we plug red jumper wires to 5v pin on sduino, black jumper wires to ground pin (ground is minus), plug yellow jumper to A5 (analog input pin 5). Plug 2 Servos Next we’ll be plugin 2 motor servos directly to our board using jumper wires, Plug the first motor servo for front leg :


for analog input we’ll be using pin number 9, for voltage we use 3,3v pin (actually to control a motor servo we can also use 3,3 v pin beside using 5v pin), next we plug the last jumper wire for ground. After plug the first motor, we plug the second motor (rear leg) :


for analog input, we plug jumper wire to pin 0, for voltage we plug red jumper wire to 5v pin, and the last jumper wire, plug it to ground pin. Actually colors of jumper wire doesn’t matter as long as the arrangement of cable that comes from motor servo plugged correctly with the pins on arduino. Programming The final step is uploading a program to use ir sensor, here’s our code for arduino ide :

simple kinetic actuator using infrared
made by : Antonius (sw0rdm4n)
twitter :  @sw0rdm4n - - -
#include <Servo.h>
int sensorval;
int pos_front_leg = 0;
int pos_rear_leg = 0;
Servo front_leg, rear_leg;
void setup()
void loop()
               sensorval = analogRead(5);
               if ((sensorval > 200) && (sensorval <300)) {
                           if (pos_rear_leg == 0) {
                                 pos_rear_leg = 180;
                           else {
                                  pos_rear_leg = 0;
              else if (sensorval > 300) {
                          if (pos_front_leg == 0) {
                                pos_front_leg = 180;
                          else {
                                pos_front_leg = 0;

Upload that code to arduino board. To test we’ll be using 6 x 1,5 v battery :


On successfull, if we put any object near the infrared at sensor val range 201-299 the rear leg servo will be moving, if we put any object at sensor val range above 300 the front leg servo will be moving.

Kontrol Motor Servo Dengan Arduino



Kebutuhan Hardware : 1 pc / notebook, 3 kabel jumper (merah, hitam, kuning), kabel usb penghubung pc ke arduino, motor servo


Di sini saya menggunakan SG90 9G micro servo motor, Hubungkan kabel jumper ke motor servo :


Kabel servo merah adalah untuk daya (5v), kabel kuning untuk sinyal / pulse dan kabel hitam digunakan untuk GND (ground). Setelah itu hubungkan kabel jumper ke pin2 arduino

servo2 Untuk kabel kuning (sinyal / pulse) yang digunakan untuk mengatur posisi pada motor servo bisa dihubungkan dengan pin apa saja pada arduino yang digunakan untuk analog output. Di sini dari pin nomor 0 sampai nomor 13 bisa kita pakai untuk mengatur motor servo.


Pada contoh kali ini pin nomor 3 digunakan untuk mengontrol motor servo dengan menghubungkanya dengan kabel kuning, pin GND di atas pin 13 disambungkan dengan kabel jumper hitam, untuk tegangan, tancapkan pin merah ke pin 5V. Setelah itu hubungkan arduino dengan kabel usb ke pc / laptop dan upload program contoh di bawah ini :

/* simple motor servo bipedal race made by Antonius (sw0rdm4n) */ 
#include <Servo.h> 
Servo bipedal; 

void setup() { 
void loop() { 

Upload kode di atas dengan arduino ide. Jika berhasil maka motor servo berhasil kita gerakkan

servo5 Video :