32

Interfacing servo motors controllers (SC08A and SC16A) using Arduino

Introduction

SC08A is an 8 channels servo controller (extendable to 16 channels with an additional SC08A) that allows controlling 8 (single-board) or 16 (double-board) standard RC servo motors simultaneously. While, SC16 A is a 16 channels servo controller (extendable to 32 channels with an additional SC16A) that allows controlling 16 (single-board) or 32 (double-board) standard RC servo motors simultaneously. Both SC08A and SC16A has effectively solved trouble in programming a microcontroller to control multiple servo motors in simultaneous way directly. Ease in controlling multiple servo motors facilitates the building of robot like walking robot, robot arm and so on.

Recently, the Arduino main boards with Atmel microcontrollers have its popularity increases due to its easier programming techniques as provided with many useful libraries in which various sub-functions can be called easily. In the next section, we are going to interfacing SC08A and SC16A using one of the most popular Arduino mainboard, Arduino Duemilanove.

Hardware required:

  • Arduino Duemilanove – 1
  • SC08A & SC16A – 1 each
  • Servo motor – 1
  • Breadboard – 1
  • Jumper –  5 male-female, 2 male-male
  • USB 2.0 cable (A to B Male- Male) – 1
  • Push button – 1
  • Single core wire,
  • Resistor 4.7kOhm – 1
  • Straight pin header (male)
  • Power supply (4.8 – 6V) as servo power of SC08A & SC16A

                SC08A       Arduino Duemilanove             SC16A

        Servo Motor           Breadboard           Jumper (2 male-male)

 Jumper (5 male- female)    USB cable       Resistor 4.7kohm – 1,

                                     (A-B male-male)  single core wire, push button – 1

                                                              , and header pin(male)

Software required:

Reference:

Related links:

  • User is encouraged to go through all projects in User Manual (Fun & Learning with Arduino Projects) to understand basic programming technique in Arduino as clear explanation for each project is covered.
  • Arduino Starter Kit Manual Mar 2010 is a supplementary to User Manual by providing extra advanced projects with clear explanations too.  
  • Besides, user is urged to go through both SC08A and SC16A User Manual so as to understand working principle of servo motor and protocol to interface    SC08A and SC16A.

PartA: Interfacing SCO8A to control servo motor using Arduino

I.  Control Servo motor using SC08A without position reporting

1. Set up the push button circuit using breadboard as shown below:

Figure 1: Push button circuit

2. GND(Ground) from Arduino mainboard is connected to breadboard using a yellow male-male jumper.

3. 5V from Arduino main board is connected to breadboard using a red male-male jumper.

4. Jumper connections at Arduino mainboard to supply 5V to breadboard is shown below:

Figure 2: Jumper connections at Arduino mainboard to supply 5V to breadboard

5. The 5V supply (from Arduino mainboard) on breadboard also extended to provide 5V supply for SC08A circuit using a red (5V) and a yellow (GND) male-female jumper.

6.  Jumper connections at SC08A for 5V supply is shown below:

 

 

Figure 3: Jumper connections at SC08A for 5V supply

7. There is a black male-female jumper that connects push button circuit to digital pin 12 of Arduino main board. As the breadboard provided with 5V, when the push button is not pressed, the digital pin 12 will be pull-up with 5V. When the push button is being pressed, a 0 or low state will be detected at digital pin 12 of Arduino main board. This kind of connection allows Arduino main board to detect state changes at pin 12 when the push button is being pressed or released.

8. Jumper connection at digital pin 12 of Arduino main board is shown below:

 

Figure 4: Jumper connection at digital pin 12 of Arduino main board

9. The Arduino main board’s digital pin 1 (TX) is connected to RX pin of SC08A using a white male-female jumper.

**The Arduino main board’s digital pin 0 (RX) is not connected to TX pin of SC08A since position reporting and position initialization do not involve.

10. Jumper connection at Arduino main board’s digital pin1 (TX) and  RX pin of SC08A is shown below:

 

Figure 5: Jumper connection at Arduino mainboard’s digital pin1 (TX) and RX pin of SC08A

11. An additional power supply (4.8 – 6V)is connected to the servo power terminal  to provide enough current to drive servo motors as shown below:

Figure 6: Additional servo power supply (4.8 – 6V)

**Please make sure the connection of servo power supply to SC08A is correct to prevent damage on SC08A or servo motors connected to it.

**The terminal connected with yellow wire is V+  of servo power while the terminal connected with black wire is V- of servo power.

12. The connection of a servo motor to SC08A is shown below:

Figure 7: Connection of a servo motor to SC08A

**Each servo motor use three header pin (a channel) on SC08A. There is a total of 8 rows of them.

**The pin closest to microcontoller (leftmost) is the signal pin.

**The pin at the middle is the V+ pin of servo power.

**The pin farthest from microcontroller (right) most is the V- pin of the servo power.

**The servo motor can be connected to any of  servo channel of SC08A as the program code provided will activate all the channels during operation.

13. The completed circuit connection  is shown below:

Figure 8: Completed circuit connections

14. Without turn on the servo power supply, the Arduino mainboard is connected to host computer using USB cable (A-B male to male).  The 5V power indicator (green led) on both the Arduino mainboard and SC08A are on as shown below:

Figure 9: 5V power indicator (green led) on both the Arduino mainboard and SC08A are on

15. Open Arduino IDE, and enter the code below.


16. Compile the ready typed program code first to check any error occurs. After that, load the program into the Arduino mainboard.

17. Turn on the servo power supply. The servo power indicator (yellow led) is on as below:

Figure 10: The servo power indicator (yellow led) is on

18. Press the push button on breadboard then release. As the result, the servo will rotate in one direction, reach the first assigned position and stop for a delay. After that, it will rotate in opposite direction, reach the second assigned position and stop for a delay.   The (back and forth) rotation will repeat in infinite times until the reset button on Arduino main board is being pressed.

19. The sample code (Control Servo motor using SC08A without position reporting) with detail comments or explanations can be downloaded through the link below:

Arduino_without_position_reporting

II.  Control Servo motor using SC08A position reporting

1. The circuit connection is similar to previous demonstration except the Arduino mainboard’s digital pin 0 (RX) is connected to TX pin of SC08A with a green male-female jumper since position reporting is required as shown below:


Figure 11: The Arduino mainboard’s digital pin 0 (RX) is connected to TX pin of SC08A with a green male-female jumper

2. Initially the servo power supply is turned off.

3. There are some modifications on segments of program code (Control Servo motor using SC08A without position reporting)  and addition of position reporting subroutine as shown below:

#Modified segment 1:

-addition of lines :

const char rx = 0;

pinMode (rx, INPUT);

#Modified segment 2:

– delay(5000) has been repalce with position checking:

  while(rd_current_pos(1) < 7200);  and

  while(rd_current_pos(1) > 500);


#Addition of position reporting sub-function:

4. Compile the ready typed program code first to check any error occurs. After that, load the program into the Arduino mainboard.

    **During loading program to Arduino mainboard, please remove the green jumper first from TX pin on SC08A.In  loading program, TX  and RX pins of Arduino mainboard is used. SC08A may response to the bytes it received at its RX pin (since it is connected to TX pin of Arduino mainboard) and transmit bytes to RX pin of Arduino mainboard through its TX pin. This condition may cause data collision and prevent program from loaded into Arduino mainboard.

5. Turn on the servo power supply.

6. Press the push button on breadboard then release. As the result, the servo will rotate in one direction, reach the first assigned position. After that, immediately it will rotate in opposite direction, reach the second assigned position. There is no any delay interval between these two opposite rotations. The (back and forth) rotation will repeat in infinite times until the reset button on Arduino main board is being pressed.

7. The sample code (Control Servo motor using SC08A with position reporting) with detail comments or explanations can be downloaded through the link below:

Arduino_with_position_reporting


8. Here is provided with a short video of demonstration on interfacing SC08A using Arduino to control servo with and without position reporting:

[youtube]http://www.youtube.com/watch?v=5sa-PG9rSGY&feature=youtu.be[/youtube]

PartB: Interfacing SC16A to control servo motor using Arduino

I.  Control Servo motor using SC16A without position reporting

1. The circuit connection is similar to previous demonstration (SC08A without position reporting) except the SC16A is used instead of SC08A.

2. Several connections to SC16A are shown below:

Figure 12: Connection of 5V supply  to SC16A and TX pin of Arduino mainboard to RX pin of SC16A


**The Arduino mainboard’s digital pin 0 (RX) is not connected to TX pin of  SC16A since position reporting do not involve.

Figure 13: Servo power supply to SC16A

**Please make sure the connection of servo power supply to SC16A is correct to prevent damage on SC16A or servo motors connected to it

**The terminal connected with yellow wire is V+  of servo power while the terminal connected with black wire is V- of servo power.

Figure 14: Connection of a servo motor to SC16A

**Each servo motor use three header pin (a channel) on SC16A. There is a total of 16 rows of them.

**The pin closest to microcontoller is the signal pin.

**The pin at the middle is the V+ pin of servo power.

**The pin farthest from microcontroller is the V- pin of the servo power.

**The servo motor can be connected to any of  servo channel of  SC16A as the program code provided will activate all the channels during operation.

3. The completed circuit is show below:

Figure 15: Completed circuit connections

4. Initially, the servo power supply is turned off.

5. Open Arduino IDE, and enter the code below:

6. Compile the ready typed program code first to check any error occurs. After that, load the program into the Arduino mainboard.

7. Turn on the servo power supply.

8. Press the push button on breadboard then release. As the result, the servo will rotate in one direction, reach the first assigned position and stop for a delay. After that, it will rotate in opposite direction, reach the second assigned position and stop for a delay.   The (back and forth) rotation will repeat in infinite times until the reset button on Arduino main board is being pressed.

9. The sample code (Control Servo motor using SC16A without position reporting) with detail comments or explanations can be downloaded through the link below:

Arduino_without_position_reporting

II.  Control Servo motor using SC16A position reporting

1. The circuit connection is similar to previous demonstration except the Arduino mainboard’s digital pin 0 (RX) is connected to TX pin of SC16A with a green male-female jumper since position reporting is required as shown below:

Figure 16: The Arduino mainboard’s digital pin 0 (RX) is connected to TX pin of SC16A with a green male-female jumper

2. Initially the servo power supply is turned off.

3. There are some modifications on segments of program code (Control Servo motor using SC16A without position reporting)  and addition of position reporting subroutine as shown below:

#Modified segment 1

-addition of lines :

const char rx = 0;

pinMode (rx, INPUT);

#Modified segment 2:

– delay(5000) has been repalce with position checking:

  while(reading_position(1) < 1150); and

  while(reading_position(1) > 250);

#Addition of position reporting sub-function:

4. Compile the ready typed program code first to check any error occurs. After that, load the program into the Arduino mainboard.

    **During loading program to Arduino mainboard, please remove the green jumper first from TX pin on SC16A.In  loading program, TX  and RX pins of Arduino mainboard is used. SC16A may response to the bytes it received at its RX pin (since it is connected to TX pin of Arduino mainboard) and transmit bytes to RX pin of Arduino mainboard through its TX pin. This condition may cause data collision and prevent program from loaded into Arduino mainboard.

5. Turn on the servo power supply.

6. Press the push button on breadboard then release. As the result, the servo will rotate in one direction, reach the first assigned position. After that, immediately it will rotate in opposite direction, reach second assigned position. There is no any delay interval between these two opposite rotations. The (back and forth) rotation will repeat in infinite times until the reset button on Arduino main board is being pressed.

7. The sample code (Control Servo motor using SC016A with position reporting) with detail comments or explanations can be downloaded through the link below:

Arduino_with_position_reporting

8. Here is provided with a short video of demonstration on interfacing SC16A using Arduino to control servo with and without position reporting:

That’s all from me. Have a fun in controlling servo motors with SC08A or SC16A multiple servo motors controller using Arduino! Thanks.

Buy

, , , , ,

Related Post

Jpeg

How to Make your Line Following Robot Faster?

Control Mobile Robot through WiFi with ESP-WiFi Shield (Arduino + Andriod)

feed the fish

Who is going to feed my fish?

Arduino + 2A motor + Encoder

Arduino + 2A Motor Shield + Encoder Motor

2 thoughts on “Interfacing servo motors controllers (SC08A and SC16A) using Arduino

Leave a Reply

Your email address will not be published. Required fields are marked *