After reading a few articles about the Arduino platform and having played enough with the flashing of LEDs, I decided to try my hand at robotics. The project does not claim to be unique, Hinduism in the bydlocode rolls over, however, if it does not scare you ...
The essence of the project is simple: I sit at the computer, control the robot “from the first person”, at the same time, people who see the robot, see me on the screen of the robot tablet as well. Perhaps the diagram below will help to understand what is happening:
Commands are sent to the robot via the COM port via Bluetooth protocol in the form of a string of characters, Skype is responsible for real-time video communication. ')
Hardware
As a basis for the robot, I took a four-wheel platform with conveniently located holes for mounting the boards and enough space to accommodate the battery. Platform dimensions: 200mm x 170mm x 105mm, weight: 660g.
A capacious battery is a guarantee of a long journey without recharging. I used a 12 volt battery with a capacity of 6700mAh.
As can be seen from the photo, the battery fit was overloaded, so I had to modify the gearboxes with a nipper file with a file . For the movement of the platform, I used DC motors connected in pairs in parallel.
An Arduino microcontroller with an expansion card for Motor Shield DC motors was chosen as the spinal cord.
The bottom of the “sandwich” is a microcontroller, and the top is a shield for controlling engines. Directly look at us USB connectors and power supply MK.
Software
The software consists of two parts: 1. A program on a Windows PC that is responsible for the user interface and for transmitting commands via the COM port to the microcontroller. 2. Sketch on the microcontroller, which accepts commands from a PC and in accordance with them exposes the modes of the engines.
I chose Delphi 7 as the environment for developing the interface, because with it you can make a form with buttons for controlling without much effort. Also, the syntax of the language seemed to me quite simple and understandable, and writing the application did not cause me any difficulty.
Before describing the program, I would like to focus on the commands transmitted by this application. Each command is a string with a length of 6 characters. The first three characters indicate the command Id, the other three - the transmitted parameter value.
List of Id commands:
001 - Left engine forward
002 - Left engine back
003 - Right engine forward
004 - Right engine back
005 - Both engines forward
006 - Both engines back
255 - Running a robot test program
The transmitted parameter value must lie in the range from 000 to 255, and ultimately it affects the engine speed. If you pass the value 000, the engines will stop. After starting the program, you must open the COM port for data transfer. By default, COM10 opens. If the port is busy, a warning message will be displayed. Commands can be transmitted using the buttons located on the form, as well as using a combination of numbers. For example, the command “005200” means that the robot will go forward with the conventional “speed” 200. When you press the Up button, the string “005200” is transmitted via the COM port, and when you release the “000000” button.
The main task of the sketch in my project is to divide the incoming stream of characters from the COM port into groups of 6 figures, analyze and execute the corresponding commands.
Conclusion
At the end of the work I did, the robot turned out with a battery life of about two hours. Full battery charge time is 10-15 hours. A possible use of a robot is security systems, monitoring processes in conditions that are not suitable for the work of people, also in production, as a controlling mechanism.
This device is not the ultimate implementation of my idea. Subsequently, I plan to abandon the USB cable in favor of the Wi-Fi bundle - Tablet PC - Bluetooth - microcontroller. To do this, you have to write an application under the Android OS and use the Bluetooth module on the controller. For the sake of convenience and cross-platform support, I plan to switch from a Delphi application to a web interface with a server for storing, processing and sending commands to an Android device.