HOW TO MAKE A PC CONTROLLED WIRELESS ROBOT
#1>RAN1106: How to make a PC controlled Wireless Robot including VB Control Software
Rhino Robot Control Board is our most powerful, versatile and most easy to use robot control board. This tutorial series is intended for giving the idea of versatility and use of this board in many types of robots.
We also hereby assume that you have gone through Rhino Board Manual, Quick C IDE user manual and Quick C IDE library reference. It’s not necessary for you to understand everything written in those documents but you should have an overview so that you can use them as reference for some part in this document.
Rhino Robot Control Board has a USB port to communicate with PC. The communication is actually done by serial communication protocol widely known as UART (Universal asynchronous receiver/transmitter). As its used to program Rhino it can also be used to communicate with a device with USB host. That can be a PC, a tablet or even a mobile phone with USB OTG support. This tutorial covers PC communication part.
All files required for this tutorial could be downloaded from here : Tutorial
This tutorial covers
- RF 2.4 GHz Serial Link (Click here to get)
*We highly recommend above parts as the application note is specifically build using all of above items. It’s not necessary that you use the same items listed above. You can also use any similar/higher configuration items. However you may need to make some changes to the code to make necessary adjustments.
#2.1>Resources used for in this tutorial
General purpose robot
chassis with 4X 300 RPM motors and 4cm width wheels
RF 2.4 GHz USB Link (For
wireless robot- To be attached to PC)
RF 2.4 GHz Serial Link
(For wireless Robot- To be connected to Rhino Board)
Jumper Wires (For
Wireless Robot – To connect RF 2.4 GHz Link and Rhino Board)
We have chosen a general purpose chassis with 4 motors. An 11.1V 1500mAh battery is mounted inside with cable ties. Rhino Board is mounted on top and Battery and motor connections are made to the board. For wired robot USB cable supplied with Rhino is used. For wireless control RF
2.4 GHz USB and Serial Links are used.
In fact any wireless device having UART interface can be used to control this robot and it’s also not required that controller should be PC, any device which can send serial data can be used. It may be a microcontroller board, Arduino or another Rhino Board.
#3> PC software
Basically a PC Terminal software is required to send commands to control robot. You can use Robokits Super Terminal for this purpose. You can also use Bray’s terminal or X-CTU. Or you can write your own from the source code given.
Robokits Super Terminal can be downloaded from here : Super Terminal
Other software is specially built to control a robot with keyboard and mouse. It will control the robot with num pad 8, 4, 6 and 2. For laptops without numpads it can do it with keys a, s, d and w. It can also be easily controlled by mouse, touchpad or touch-screen.
This software is written in Visual Basic 6 but you can use any other language to create your own. We chose Visual Basic 6 because of its simplicity. This is very simple and just for demo. You can modify or improve it as per your needs.
#3.1> Rhino Code #3.1.1>Code 1 : Controlling Robot with PC
Open 018 – PC controlled Wired and Wireless Robot program in sample codes older.
Library used : UART
This code uses UART_GETCHAR(); function to take one byte input from UART. Then it matches the input character with if conditions. If the character matches it takes actions accordingly. The loop will wait until a byte is received.
It will also send the actions feedback on serial. For example if you send ‘8’ it will return ‘F’ saying forward action has been taken.
This single code will be able to perform on wired and wireless devices. Also with terminal and custom programs.
#4> Controlling though PC
First of all try with super terminal software. Connect the software on your Rhino Board’s port. In our case it’s COM2. Below is the screenshot for super terminal.
We have connected software to COM2 (Port on which our rhino board is connected) and baud rate is 57600. Now as per our Rhino programming sending 8 will move Robot forward, 4 will turn it left, 6 will turn it right, 2 will move it backwards and 5 will stop all motors. Click on ASCII text box after wireless robot and press 8 robot will start moving forward if battery is attached and motors are getting power. Pressing 5 will stop it. You will also notice that when you type a key you will also receive a response. Like pressing 8 will get you F.
You can try other keys and see your robot moving.
Once you are done testing with this software you can go forward for our custom software for controlling the Robot. You don’t need to program Rhino again.
If you want to modify the software or you have Visual Basic 6 installed just open Project file in this application note’s VB software folder and hit F5 to run the software.
If you want to use the software as it is or don’t have visual basic installed, directly run the application folder – Robokits_PC_Controlled_Robot.exe
For using this application you will need to make sure that the COM port number is below COM16, otherwise it will not work. You may change the port number through device manager.
Once the software is running select the correct COM port and press connect button. Once connected you can press reset button on rhino board to verify that the software is working properly, on reset you will see a string ROBOKITS INDIA WIRELESS ROBOT in the white box.
Now you can move your mouse on Move Forward, Move backward… labels to control your robot. You can see that this software will send all the codes to robot according to your mouse movements.
You can also click on keyboard control button and control the robot through keyboard. Instructions will appear on the button. You will also see received data in the white box.
#5>Making the robot wireless:
Once you try this software you will notice that its very difficult to control a wired robot as you will have to move with your laptop or long cable along with the robot. It will be fun to control with a wireless control. We will use RF 2.4 GHz links for this, One with USB for PC and second with serial to communicate with Rhino board.
If you already have the links with you first you will need to change the baud rate for both USB and serial device.
As we have kept our baud rate to 57600 bps, we will need to change the links to communicate with this baud.
First of all for the USB link download the configuration software here : USB Link
Once installed open software and connect to the COM port for it. In our case it’s COM5. Once you connect you will see a screen like below.
Now set the Baud rate to 57600 and click write settings. It will ask for confirmation, click yes. Now you will see a screen like below.
Now close the software, we have kept frequency to default 2433MHz. USB link is now ready for use.
Now take the receiver. To set it to 57600 baud you will need to short the Baud1 and Baud2 jumpers. We need default frequency so remove 2 jumpers for frequency. See the picture below.
Now the USB and Serial Links are ready for connection. Also the serial and Rhino Boards are configured to work at same baud. Now we need to connect 4 wires from RF serial link to Rhino Board. If you want you can mount the link on Robot Chassis.
Connections are as below.
|Rhino Board||RF 2.4GHz Serial Link|
|UART Pin 2 – RXD||TXD|
|UART Pin 3 – TXD||RXD|
|UART Pin 4 – VCC||VCC|
|UART Pin 5 – GND||GND|
For connection see picture below.
This photo is for showing the connections, once you verify they are correct power up board. You should be able to see some LED glowing on RF Link. Once the connections are done, you can run the robot in the same way as wired one. Only COM port may be different in this case. Once you test, Fix and arrange the wires with cable ties.
There is no need to modify code on Rhino but if you want to do it in future you will need to disconnect RX and TX lines of the module as Rhino gets programmed through those 2 lines.