DSCF4231_thumb.jpg

Remote-Controlled Robot

By: Ober Choo

RH2T Magazine Vol.11 Dec 2011

When I was 8 years old, my parent bought me a remote-controlled car. It was controlled through simple console with switch to activate and deactivate the motors on the car. Now, I can create my own remote-controlled robot, isn’t that fun?! You can create your own remote-controlled robot and take part in competition such as ROBOCON, MURoC, Combat Robot, one of my friends has even developed remote-controlled robot for factory applications.

1.0 Introduction

remote_control

TV Remote Control

Remote-controlled devices include TV, air-condition, electric auto-gate, lighting, and more. It can be in the form of wired or wireless, but most are using wireless. Since this is for Robot magazine, we shall talk about building a remote-controlled mobile robot. Don’t worry, I’ll show you both the wired and wireless. It’s very simple where you just have to replace the wired with a wireless remote control. OK, before we start, there’re distinctions between Radio Control and Remote Control. Remote control simply means controlling from some place, it can be a few meters away just like you control your TV in living room; or it can be thousand miles away using Ethernet. Radio control is using Radio signal, which is normally being used in RC toys such as air-plane, helicopter and cars. Yes, Radio control can be Remote control, but Remote control does not limited to Radio control. The idea of this sharing is to demonstrate a remote-controlled mobile robot using PIC16F887 with SONY PS2 Dual Stock controller. You will have a lot of fun with it.

 

2.0 Controller and Remote Control

So what do you need? Besides the motors, battery, robot base and accessories, you should need a controller and remote control. You can build a controller yourself using any type of microcontroller, PIC, Atmel, 8051, Arduino, PICuno and many more. Of course you will need to be familiar with the design and interface as these controllers are not designed for controlling robot, they are built for general purpose usage. Or, you can choose a ready-made controller for mobile robot, MC40SE (Advance Mobile Robot Controller) from Cytron Technologies.

 
  clip_image002

MC40SE

2.1 MC40SE – Advance Mobile Robot Controller

The new Mobile Robot Controller is microcontroller board designed to drive mobile robot, automatic or manual controlled. OK, I will not talk about automatic robot as this article is about remote-controlled robot. Just a brief on the MC40SE features:

  • Comes with PIC16F887, you can utilize the 8MHz internal oscillator on it and obtain 2 more I/O pins.
  • Uses UIC00B to load program.
  • Comes with connector for UC00A/B for UART communication to computer.
  • Changeable Crystal, you have options to remove external crystal or change to other speed of crystal.
  • Comes with 2×8 character LCD, you can now display menu and information.
  • Two-brush motor ports for start/stop and direction control, up to 10A each motor.
  • Eight digital input ports, you can connect photo-electric sensor, fiber optic sensor, limit switches, etc.
  • One analog input with selectable power of 3.3V, 5V and 12V.
  • Socket ready for Cytron’s SK board include SKPS, SKXBee and SKKCA-21.

 The sample source code from Cytron Technologies is written in Hi-Tech C PRO (Lite Mode) which is free. The Hi-TECH C PRO Compiler actually comes with MPLAB IDE, at the end of MPLAB IDE installation, you will be asked whether to install Hi-TECH C PRO or not according to your like. Test Code is the source code used for board test. It comes with every I/O Port on MC40SE which includes digital input, analogue input, brushless motor control, encoder input, relay control, 2×8 LCD, buzzer and also SKPS. What I like about this board is that the socket is ready for SKPS (support SKXBee and SKKCA-21 too). Using SKPS will be much easier in term of hardware interface, basically it is plug-and-play; just that you still need to develop the program.

Since MC40SE offers two motor ports for navigation purpose, I will utilize it as mobile robot tyres actuator. I will use LINIX brushless motor, 10W, gear ratio 15:1 (45ZWN10-15G) together with the 4” Nylon wheel. As there is different control for left and right motors, please do make the connection accordingly if you want to use the sample source code. Different connections or motor type will result in weird navigation control, please take note on that.

DSCF4692 Linix Brushless Motor with 4” Nylon Wheel

If you don’t like to use Brushless motor, you may use brush motor such as automobile power window motor with external driver. The driver can be MD10C or MD30B depending on the motor requirement. Since I have brushless motor, I will not only show the brushless motor connection. You can always refer to the User’s Manual of MC40SE and sample source code if you really like to hook up with brush motor.

Loading program will be easy as MC40SE comes with ICSP port that supports UIC00A/B. Just make sure you have either UIC00A or UIC00B, it is USB ICSP PIC Programmer and super easy to use. Your PIC Microcontroller stays on MC40SE while the program is being updated from UIC00A/B. Keep staying on board while you execute your program. It’s easy and straight forward.

 

2.2 SKPS – SONY PS2 Starter Kit

As you know, SKPS offers simple and ready socket to connect to SONY PS2 DualShock 2 controller, and your controller can communicate with it via simple and commonly used UART standard. Not only you can check the status of each digital input and analog joystick on SKPS, you can even control the vibrator motor on it; isn’t that amazing? This is perfect for manual control machine. What makes that even more fun is that you can get PS2 controller with wireless feature, though it cannot be used in ROBOCON, the fun is still there. The protocol of communication between microcontroller and SKPS is clearly stated in User’s Manual and there are plenty of sample source codes available.

sony_dual_shock2_controllerSONY PS2 DualShock 2 Controller

SONY PS2 DualShock 2 Controller offers at least 16 digital inputs and 4 analog inputs to microcontroller. With 2 vibrator motors on it, you can design your system to have feedback to user. All these input and output can be read/ controlled by microcontroller via SKPS, and I will be using these two devices for remote-controlled mobile robot.

 

3.0 Setup

OK, it’s time to setup! Let’s list out the materials needed:

  1. 1 x MC40SE board (PIC16F887).
  2. 2 x LINIX Brushless Motor, 10W, 15:1 gear ratio (45ZWN10-15G) with BLD04A driver.
  3. 2 x 4” Nylon wheel, ensure the coupling size is for Linix 10W motor.
  4. 2 x 12V battery, you can use Sealed Lead Acid (SLA) or Li-Po. Extra battery is needed if you like to control brush motor for mechanism.
  5. 1 x PS2 Controller Starter Kit (SKPS).
  6. 1 x Wired PS2 Controller (PS-GP-1), you add an extension (WR-EX-PS) if you like.
  7. A robot base which mounted with castor and Brushless motor properly.
  8. UIC00B which I think most of people already have it.

 4466-280x373

PS2 extension cable

1st, you can test the MC40SE by powering it up without other devices. Just connect the Batt1 and Batt2 to two 12V battery separately (DONOT Share 1 battery), the connector for battery is Dean-T which is commonly used for Li-Po battery and it offers good polarity protection as you cannot connect in wrong polarity, it also offers good electrical connection for high ampere applications. Activate the “Main SW”, you should see the LCD output some message and you can actually play with the test code. Every MC40SE comes with test code. Some tests can be completed using existing devices on board, but most of the tests require external devices such as brushless motor, sensor, analog input, encoder etc. It is fine to leave this part as we just want to make sure the board is working whereby it can at least power up and the PIC is running.

2nd, power off the MC40SE, it is a good practise to disconnect battery from MC40SE. Connect the Brushless motor to MC40SE board:

  • Left Motor, the control pin should be connected to “Brushless 1” PORT on MC40SE.
  • Right Motor, the control pin should be connected to “Brushless 2” PORT on MC40SE.
  • Don’t forget about the power to brushless, MC40SE is using white connector with proper gripping for solid connection. All the female connector comes in MC40SE board. Please solder the wire according to the polarity on MC40SE.

 

Brushless on MC40SE

BLD04A to MC40SE Brushless port. Please check the wiring.

  • The control pin from BLD04A to MC40SE is shown in the photo too. You can follow exactly the configuration in picture if you are yet to make the connector. You can try to power on the MC40SE, green LED on BLD04A will light up if it is powered properly.

 

3rd, Off power again, connect SKPS and PS2 to MC40SE. You can also add 2 10mm PCB stand S/N on MC40SE to offer better mounting of SKPS.

 
  SKPS PS2

SKPS + PS2 on MC40SE

 
  PCB stand for SKPS

10mm PCB stand S/N on MC40SE to offer better mounting to SKPS

Again, power on the MC40SE, if everything is correctly done and nicely connected; the SKPS should be working with PS2 DualShock Controller. Pressing any digital button of PS2 will make super bright LED (Blue) on SKPS to illuminate with higher density. Remember, the SKPS should be set to 9600 baud rate as the sample source code is using that speed.

DSCF4231

Basic Remote Controlled Mobile Robot

When everything is done, you should have a basic remote control mobile robot setup. The one shown in picture is a simple mobile robot platform used by us to perform various tests in RnD department. Ignore the extra sensor at the front of the robot and IFC extension board at the back of the robot. Make sure the motors are mounted properly and control pin is connected correctly to MC40SE, otherwise it will respond weirdly when you control it. Good! Everything is set, we are now ready to load the sample program and test it. You can download the sample program from here. You are free to modify the program but please bear in mind, we do not responsible to modify the program to suit your requirement nor to ensure it works with your project. There are plenty of possible configurations and settings working with mobile robot, changing the motor gear ratio will change the result and this can only be fixed through modification of the program. You will need to do that :).

 

4.0 Program

The sample source code is written based on:

  • MC40SE, mobile robot controller board
  • PIC16F887, using internal oscillator, 8MHz. This PIC comes with MC40SE.
  • MPLAB IDE and compiled under HI-TECH C PRO for PIC10/12/16 v9.80 operating in LITE mode.
  • SKPS + Wired PS2
  • Linix Brushless Motor, 10W, gear ratio 15.

 

As highlighted, you will need to install MPLAB IDE and HI-TECH C PRO compiler. Do not worry, MPLAB IDE installer comes with HI-TECH C PRO compiler and you will be asked to install at the end of installation. I am using MPLAB IDE v8.63 with Hi-TECH C Compiler for 10/12/16F Lite mode v9.80 to develop the sample code. Other version might have problem. So if you have problem please do check the version. For those who are not familiar with MPLAB IDE and HI-TECH C PRO compiler, please refer to any of Cytron DIY project to open project and compile it. The sample source code provided in several files, simplest method to compile is to open through “Open Project”, or else you will need to create project from Project Wizard and add in the necessary files, this is not recommended if you are not familiar with it or a beginner as it will take you days to figure out how to use it.

Load the hex code into MC40SE using UIC00A/B, power it up and you should hear buzzer beep for twice and LCD display message of “MC40SE Manual” and later change it to “Manual Demo!”. It will further change to display “Manual SKPS+PS2”. If SKPS and PS2 is connected properly, the MC40SE will detect it and change the display to “PS OK START=ON”. Now you should press START button (Center Right triangular button) on SONY PS2 DualShock 2 controller to proceed. Once START Button is pressed, LCD will show “SEL=out”, this means pressing SELECT Button (Center Left Rectangular button) on PS2 will end the control loop and restart again.

Now, let’s look at how to control the manual robot. Relay1 to Relay4 to control the brush motors (which require power source at right top of MC40SE) are being controlled by the buttons at the front of PS2 controller. There are 4 buttons which labeled as L (Left) 1 and 2, R (Right) 1 and 2.

  • Button Right 1 (R1) is AND with SEN1 (Digital Input PORT 1) further activate Relay1 and deactivate Relay2, thus will further activate motor at MOTOR 1.
  • Button Right 2 (R2) is AND with SEN2 (Digital Input PORT 2) further activate motor at Motor 1 in different direction.
  • Button Left 1 (L1) is AND with SEN3 (Digital Input PORT 3) further activate Relay3 and deactivate Relay4, further activate motor at MOTOR 2 in a direction.
  • Button Left 2 (L2) is AND with SEN4 (Digital Input PORT 4) further activate motor at MOTOR 2 in different direction.

 

Despite the output control of navigation motors and mechanism, I actually added a safety feature for this system by utilizing the input. The control of four relays is being combined with the state of digital input pin. You can add in limit switch as the mechanism limit, so mistakenly pressing the button will not activate the motor which will likely cause damage to mechanical parts.

PS2 Front.bmp PS2 Front Buttons

How about the navigation? Here you go:

  • Left Joystick will control the navigation:
    • Push joystick forward to drive the robot forward.
    • Push joystick backward to drive the robot backward.
    • Push joystick to left to make the robot pivot left.
    • Push joystick right to make the robot pivot right.
  • Right Joystick will increase or decrease the speed:
    • Push joystick forward will increase the speed.
    • Push joystick backward will decrease the speed.
  • Left top 4 direction buttons:
    • Press forward button will drive the robot forward.
    • Press backward button will drive the robot backward.
  • Right top 4 shape buttons:
    • Press “Square” button will pivot the robot to the left.
    • Press “Circle” button will pivot the robot to the right.

 

PS2 TopPS2 Top Buttons and Joysticks

If any of the navigation control joysticks and buttons does not work as expected, most likely it is due to wrong MOTOR port and different type of gear ratio. Remember, if you are using Brush motor, or different type of gear ratio, you will need to modify the sample source code, compile it and load the program into MC40SE.

 

5.0 Wired and Wireless?

By now you should be able to control the mobile robot using the proposed method and sample source code. You are free to modify the source code and if you want to discuss technical suggestion and feedback, please post it in our technical forum at: http://forum.cytron.com.my.

Many have asked, can wireless type of PS2 controller being used? It really depends as wireless PS2 is not a standard product from SONY. Original accessories for PS2 does not have Wireless joystick. Anyway, if you would like to use it, I would advise you to get it from Cytron Technologies as all the Wireless PS2s are tested compatibility before being shipped to customer. When you get the wireless PS2, plug the receiver to SKPS and power the PS2 controller with the desired battery and it will work! How about several unit of wireless PS2? As you notice, PS2 is not meant for multiple players, the most is only 2 players in a room. Yet, from what we have tested, up to 3 players can co-exist in an area. You must first pair them up properly. Activate a receiver first, power up the PS2 controller (other must be OFF), wait until the connection is up (it should be indicated by LED on the receiver). Now remain the power of 1st pair of PS2 receiver and controller, activate 2nd receiver and power up 2nd PS2 controller. Repeat it until the 3rd pair. The pairing is not controlled by SKPS or the microntroller. It is done by the wireless PS2 receiver and controller. Remember, every time you power up, you need to do pairing if there are multiple wireless PS2.

 

6.0 Summary

So, have fun with the remote-controlled mobile robot. The sample source code for MC40SE can be downloaded from MC40SE product page. You can always send a photo of your project to us or post it at our facebook: http://www.facebook.com/cytrontech

References:

SKPS User’s Manual

MC40SE User’s Manual

Buy

, , , ,

Related Post

RF-RX-315 circuit connetion_front

Remote Control 315MHz by using RF remote control Encoder and Decoder

OUTPUT.jpg

LSA08 Line Follower with MC40SE

Connection_1_Sign-Magnitude

Project 16 – Driving two DC geared motors with MD10C by using SKPS

4-channel-motor-driver-fd04a

Interfacing FD04A and SKPS with Arduino

One thought on “Remote-Controlled Robot

  1. Great blog here! Also your web site loads up fast! What host are you using?

    Can I get your affiliate link to your host?
    I wish my website loaded up as quickly as yours lol

Leave a Reply

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