#1>RAN1105: How to make a PC USB controlled Wired 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:
Controlling motors with PC, USB controlled wired robot
Make a custom software in Visual Basic 6 to control robot
- Rhino Board (Click here to get)
- Robot Chassis (Click here to get)
- Motor (Click here to get)
- Battery (Click here to get)
- Wheels (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
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. You can use a USB extension cable to increase the length of the wired USB cable.
Basically 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.
#4>Rhino Code #4.1>Code 1 : Controlling Robot with PC
Open 018 – PC controlled Wired and Wireless Robot program in sample codes folder.
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
#5>Controlling though PC
First of all try with super terminal software. Connect the software on your Rhino Board’s port. In our case its 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 onASCII 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.