Wirelesss Servo Controller Using XBee

Ever think to create a wireless servo controller to control movement of servo motor at a distance? If yes, this tutorial is totally applicable to you. In this tutorial, a wireless servo controller circuit will be established and a servo motor will be controlled wirelessly from a computer through a Servo Control Panel GUI provided by Cytron Technologies. The wireless module that will be used is XBee Series 1, a simple wireless communication module which offers point to point and also mesh network, simple configuration to communicate, good communication range up to 100 m and space-saving due to its compact size. Plus, a few ready-made modules by Cytron Technologies like 4 Channels Logic Converter (LC04A),Breadboard Power Stick 5V 3V3 (BPS-5-3), and 8 Channels Servo Controller (SC08A) are included to facilitate the establishment of wireless servo controller circuit by minimizing the soldering works.

Basically, the concept of wireless controlling of servo motor project in this tutorial can be illustrated by the flow diagram below:

Figure 1: Flow diagram of project wireless controlling of servo motor

As seen from Figure 1, in the host computer, a command on controlling servo motor assigned by Servo Control Panel GUI will be sent to XBee #1 from XBee #2 through the wireless link established between them with the help of SKXBEE Board. Then, at the servo controlling circuit side, the command received by XBee #1 will be sent to a programmed servo controller (SC08A) through UART communication. As the servo controller (SC08A) received the command, it will reacts with a specified response (depends on the command receive), for example makes the servo connected to it to rotate to a specific position. Sounds interesting? Well, without any extra delay, let’s start!!

**Users are encouraged to read through related references, especially “Tutorial and Sample Project” for better understanding on how to configure XBee modules and use them for wireless communication in controlling your microcontroller circuit wirelessly through using a computer.

Part I: Install USB Driver for SKXBEE Board

1. Download SKXBEE Board USB driver installer.

2. Install the USB driver for SKXBEE Board by following the instructions stated in USB driver installation guide.

Part II : Configure XBees Using X-CTU software

There are two options to configure XBee module which is through using software X-CTU or a microcontoller circuit. Please refer to “Tutorial and Sample Project” under the “References Related” section above.In this tutorial, the option chosen is configuring XBee module using software X-CTU. By the way, why do we need to configure XBee module? This question will be clarified in the following paragraphs.

Basic configuration of a XBee involves setting XBee module self- address and destination address (the address of another XBee be transmitted to). For example, the table below showing the concept of setting basic configuration of two XBee modules (named XBee #1 and XBee #2) for wireless communication between them.

Table 1: The concept of setting basic configuration of two XBee modules for wireless communicaton

As seen from table 1, it is clear that the destination address of XBee #1 is set to match self-address of XBee #2 , which is “2222” and also the destination address of XBee #2 is set to match self addresss of XBee#1, which is “1111”. These address matching are very important so that XBee #1 and XBee #2 are able to associated with each other sucessfully to establish wireless link between them for communication when they are powered up.Let’s follow the procedure below to configure two XBee modules used in this tutorial. The configurations are based on the address setting in Table 1 above.

1. Download X-CTU installer which suits your computer system.

2. Extract the installer.zip file and double-click the .exe setup file in the extracted folder for X-CTU installation.

3. After the installation is completed, please do not launch the X-CTU software yet. Next, connect the SKXBEE Board to the host computer using USB cable (Type B) and then plug in a XBee module onto the XBee socket of SKXBEE Board as shown below.

8. The completed command for configuring XBee #1 is shown by the window below:

Figure 6: Completed command for configuring XBee #1

9. Remove the XBee #1 from the XBee socket of SKXBEE Board and plug in the XBee #2 onto the same socket. Go back to “PC Setting Tab” of X-CTU software window and repeat procedure from step 5 to step 7. In step 7, instead of same as previous, do the following modifications for command Line #2 and command Line #4:

10. The configurations for communication for both XBees are done here. The completed command for configuring XBee #2 is shown by the window below.

Figure 7: Completed command for configuring XBee #2

Part III: Establish the Wireless Servo Controller Circuit

1. Let’s start with some soldering works so as to make the 4 Channels Logic Converter (LC04A) and the XBee fitable to breadboard.

**LC04A is used in this tutorial for the UART communication between the SC08A (5V device) and the XBee (3.3V) by converting logic level 5V to 3.3V or vice versa.

2. LC04A is included with two 1 x 6 ways header pin (Male) when purchased. Solder these two header pin onto LC04A. The resulted LC0A is shown as below.

Figure 8: Top view and bottom view of soldered LC04A

3. Regarding the XBee breakout board, firstly, insert each 2mm 1 x 10 ways header (Female) into the leftmost and the rightmost unlabeled holes array (that designed to suit 2mm 1×10 ways header (Female) or XBee) from the “Up” side of breakout board. Solder the 2mm headers from the “Down” side of breakout board.

Figure 9: Insert 2mm headers (Female) onto XBee breakout board

**XBee breakout board is used to make the XBee fitable to breadboard since the original header pins separation of XBee module is 2mm while the holes separation of breadboard is 0.1 inch, approximately 2.5mm.

4. Then, cut two 1 x 1o ways header pin (Male) from a 1 X 40 ways header pin (Male). Insert each resulted 1 x 10 ways header pin (Male) into the left and right labeled holes array from the “Down” side of breakout board. Solder the header pins from the “Up” side of breakout board.

**BPS-5-3 is used to provide regulated voltages of 5V and 3.3V so as to power up SC08A (5v device) and XBee (3.3V device).

7. Based on the schematic provided in Figure 13 and connection diagrams in Figure 14, complete the connections of wireless servo controller circuit using jumper.

Figure 13: Wireless servo controller circuit schematic

a) Connection of the external power source and servo b) Connection of UART at SC08A

at SC08A (Don’t turn on the external power source yet)

c) Connection at LC04A d) Connection at XBee breakout board

Figure 14: Connection diagrams

**Voltages 5V and 3.3V are provided by the Breadboard Power Stick 5V 3V3(BPS-5-3)

**Here is provided with short description on the usage of 4 Channels Logic Converter (LC04A). LC04A is bidirectional, thus able to steps down 5V signals to 3.3V or steps up 3.3V signals to 5V. It works fine with 2.8V and 1.8V devices also. This feature is important in interfacing process between two devices with different logic level voltages ( for eg: 5V and 3.3V), especially in typical serial communications like I2C, SPI, UART and so on. Hence, LC04A is used in this tutorial for UART communication between 8 Channels Servo Controller (SC08A, a 5V device) and XBee Series 1(a 3.3V) devices. As shown in Figure 14c), LC04A is powered up with two voltages with 5V at the HV (+) pin and 3.3V at the LV (+) pin.

Note:

**HV (+) pin can be connected to voltage up to 5V only while LV (+) pin can be connected to voltage as low as 1.8V.

**LV (+) voltage must be lower than HV (+) voltage.

Both (-) pins at HV and LV sides must be connected to ground since that pins are not internally connected. In this case, 3rd & 4th channels that involves pins LT2, LR2 at LV side and pins HT2 and HR2 at HV side are used. Connections of stated pins are shown below:

LT2 -> DOUT of XBee

LR2 -> DIN of XBee

HT2 -> RX of SC08A

HR2-> TX of SC08A

Example of operation:

When the XBee (3.3V system) outputs a logic high (3.3V) through its DOUT pin, a logic high (5V) will be detected at the RX pin of SC08A (5V system). Logic conversion is achieved and thus allows interfacing between XBee and SC08A.

9. Plug in the XBee #1 onto the XBee breakout board and then connect the Breadboard Power Stick (BPS-5-3) with a power adapter DC12V, subsequently turn on the power adapter so as to power up LC04A, XBee #1 and SC08A. The power indicators (green leds) on both BPS-5-3 and SC08A are turned on.

10. Turn on the external power source (4.8-6V) for servo power supply of SC08A. The servo power indicator (orange led) will turned on. The servo motor may rotate due to position initialization of SC08A on the servo motor connected to it.

2. In the extracted folder, there have a folder named “SC08A VB project1” and a SC08A_GUI.exe file . Double-click the SC08A_GUI.exe to launch the Servo Control Panel GUI. The Servo Control Panel GUI will appears as shown below.

Figure 17: Servo Control Panel GUI

2. Plug in the XBee #2 onto the XBee socket of SKXBEE Board.

3. Connect the SKXBEE Board to the host computer through using a USB cable (Type B).

4. Click the “Search” button in the Servo Control Panel GUI. Choose the COM port installed for SKXBEE Board from the combo box beside the “Search button”. In this demonstration, “COM26” is choosen.

5. Then, click the “Connect” button and message “COM26 connected” in this case will apppears in the textbox below the “Connect” button. Click the “Activate” button for Channel 1 to activate SC08A Channel 1 (since the servo is connected to SC08A Channel 1 in this demonstration).

6. After the Channel 1 is sucessfully activated, try to move the “Position control” scroll bar to assign desired position for servo Channel 1 . As the result the servo motor connected to Channel 1 of SC08A will rotates to reach the position assigned.

**Commands related to servo motor controlling like servo channel activation/deactivation, servo position assignation or reset and so on will be transmitted to XBee #1 from XBee #2 through wireless link established between them, and from XBee #1 to SC08A through the UART communication internally. As the command received by SC08A, it will controls the servo motor connected to it accordingly.

Figure 18: Setting for Servo Controller Panel GUI

7. The aim to establish a wireless servo controller to control servo motor is achieved. Users can try to connect the servo motor to another channel of SC0A and then activate that channel through Servo Control Panel GUI. Then, try to move the “Position control” scroll bar for that channel. Same result will be seen.

hi, we do not have example using potentiometer to control servo directly. You will need a microcontroller to read the voltage from potentiometer and translate into Servo controller command and send to XBee or SKXBee. You can always discuss in our technical forum: http://forum.cytron.com.my