Why settle for a one-function robot when you can have 3 and wireless?
Usually robots perform one concrete function. However, why not go beyond this and make a multifunction robot? If you agree, I will show you to how create a 3-in-1 wireless-bot.
In particular, the project described in this article has been developed as a final project into the Printed Circuit Board (PCB) Design subject in the 3rd course of the MSc. in Electrical and Electronic Engineering at the Public University of Navarre, Spain.
First of all, it is required to describe the three different functions of the robot:
- The main feature and the focus of the design is “mini-SUMO”. Here the robot is designed to autonomously fight against another robot and push it out of the dojo, as in the traditional sumo fight.
Nowadays, miniSumo robot competitions are official and the robot has to follow several design rules concerning the size, weight and operation of the robot.
- The second option is called “LINE FOLLOWER”. As its name indicates, the robot moves following a black line outlined on a white surface. Here, the robot plays a song during the route in order to make the tracking of the line more enjoyable for the viewer.
- The last feature consists of the “REMOTE CONTROL” operation. Here, the user fully controls the movements of the robot via Bluetooth with a mobile phone app.
For the development of the robot a basic knowledge of four different fields is required: electronic circuits, PCB design, microcontrollers and 3D modelling. Nevertheless the lack of some knowledge can be compensated with curiosity and effort.
The full-project description will be divided into four main blocks as indicated above.
1. Electronic Design
As mentioned before, robots fighting in official sumo competition must follow some rules. Official rules have been fully accomplished by this project but it has some additional constraints as specified below:
- MAX SIZE: 10x10 cm (widthxlenght) with no limitation in height.
- MAX WEIGHT: 500 gram.
- MAX BUDGET: 50€ (excluding PCB fabrication)
- Include a general switch ON/OFF.
- POWER SOURCE: 8.4V, 150mAh rechargeable batteries.
- MOTION: DC motors,
- SENSORS: close/far range infrared, ultrasound and contact sensors.
- CONTROL: PIC microcontroller.
- PROGRAM: 5 seconds to wait in before the combat starts.
According to this and the other two applications of the robot, the principal components chosen and a small explanation about their functions are listed below:
The microcontroller governs the behaviour of the robot. More details about this component can be found in the Programming Environment part.
In order to connect the PC with the microcontroller and enable direct programming/debugging of the robot a modular connector is essential.
One slide switch 2 positions: used to achieve the requirement of ON/OFF with a general switch.
One slide switch 3 positions: to choose the operating mode of the robot out of the three options available: “miniSUMO”, “LINE FOLLOWER” and “REMOTE CONTROL”.
Linear voltage regulator
This component reduces the battery voltage into 5V and keeps it constant to supply the power to the rest of the components (microcontroller, sensors, motor driver, etc). The linear voltage regulator is important since all the components operate with a voltage of 5V, except for the motors that are supplied directly from the battery. In addition, as shown in Fig.1, this component needs two bulk electrolytic capacitors in order to guarantee the proper power delivery to every component during high power requirement transients, such as motor switch on.
Figure 1. Voltage regulator circuit
Close range infrared sensor TCRT5000
These elements differentiate between dark and bright colours by means of reflected light measurements. This feature is very useful since the “miniSUMO” and “LINE FOLLOWER” operation modes need to distinguish the colour of the floor to avoid going out of the dojo or follow the black line respectively.
The image below shows the connections:
Figure 2. Infrared sensor equivalent circuit and control
The LED sends out infrared light and the phototransistor receives that light after bouncing against a surface. The resistors shown in Fig.2 are necessary to limit the current approaching the sensor. There are two possibilities:
- Light surface: the transistor is short circuited and the current flows thus the output is GND (0V).
- Dark surface: there is no current so the output is 5V.
This component is used in the “miniSUMO” operation mode to detect the opponent position.
The sensor works as follow. First, an ultrasonic pulse is sent from a channel, bounced against a surface and returned to the sensor by another channel. The distance between the robot and the surface is proportional to the time it takes to complete the process. If there is no signal in a certain period of time it means that there is no object in its field of vision and on the contrary, if the time is less than the limit an object is in front of the robot. The limit of time depends on each sensor and it must be calculated in a practical way.
In order to improve the performance of the sensor, reduce power consumption and avoid fails, a transistor is used as a switch to control the voltage supply line of the sensor.
Fig.3 shows the control circuit and connections of the ultrasound sensor:
Figure 3. Ultrasound control
This element together with an android application that will be explained in the section Programming Environment allows a mobile phone to connect with the robot. This is an indispensable feature for the “REMOTE CONTROL” operation. The Bluetooth module has a transistor to control its ON/OFF and reduce power consumption when not in use.
Fig.4 shows the control circuit and connections of the component:
Figure 4. Bluetooth module control
DC brushed motors and motor driver
This component controls the actions of the motors and decides whether the motors will run forward or backward using diodes connected to the voltage supply or ground.
About the electrical parameters, it needs a minimum voltage of 4.5V to operate and supports up to 36V. It's maximum current to supply the motors is 1A.
The motors chosen have a reducer in order to get more strength at the expense of reducing the speed.
Fig.5 shows the connections between the motors, the driver and the microcontroller:
Figure 5. Motor driver control
As a visual indicator. In this case only the green colour is programmed to shine when the robot detects an object in the dojo and also in the 5 seconds countdown at the beginning of the combat. The resistors shown in Fig.6 are necessary to protect the LED. For each colour there is a resistor and its value has been calculated fixing a current of 20mA and taking into account the forward voltage of the colour.
Fig.6 shows the connections:
Figure 6. LED control
This component reproduces the music programmed in the microcontroller. The CCP module operates in PWM mode with a 50% duty cycle. The duration of the pulse depends on the musical note because each one of them has a different frequency and therefore a period. The music code is included in the attached file “MPLAB” at the end of the article.
The image below shows the connections:
Figure 7. Piezo Buzzer control
With the help of the RS components website, the search of components is easier, they have an extensive catalogue and a Datasheet for each component.
Concerning the main components described above, the design of current project consisted of the following components:
- One slide switch 2 positions.
- One slide switch 3 positions.
- One linear voltage regulator MC7805.
- Two infrared sensors located at the front, very close to the floor (the operation range of TCRT5000 is about 1cm).
- One ultrasound sensor HC-SR04, located at the front part.
- One modular connector RJ11.
- One Bluetooth module HC 06.
- One motor driver L293D
- Two DC motors, one on each side.
- A three-colour LED (blue, green, and red) located on the top.
- One piezo buzzer located on the top.
- Two transistors BC547B
- Several resistances and capacitors.
2. Printed Circuit Board Design
DesignSpark PCB 8.0 has been used for the design of the PCB. First of all, the schematic design is carried out using all the components and connections mentioned before.
Then, the schematic design is translated into a PCB design. For this part, a Design Technology with specific spacings, track thicknesses, pads styles, etc. is created. Afterwards, the components are placed on the board following PCB design considerations and paying special attention to the sensors, switches, and connectors positions within the PCB. To reduce the number of tracks and simplify the design the top layer is used as 5V plane and the bottom layer as GND plane. Fig.8 shows a 3D representation of the top and bottom PCB layers. The full DesigSpark PCB design project has been attached at the end of this article.
Figure 8. 3D model of the PCB board design
3. Programming environment
The microcontroller used in this design is the PIC16F723A. The main reason for this microcontroller selection is that it has enough pin count, includes a CCP module for the music, a serial connection module for the Bluetooth, and has an internal oscillator, which reduces the number of connections and errors.
The microcontroller has been programmed using MPLAB environment and the ICD3 as a depuration tool. The language of the program is C++. Each function of the robot has a specific program and not very difficult. The codes have been attached in the file “MPLAB” at the end of the article.
The “SUMO” and “FOLLOW-LINES” functions are autonomous, which means that selecting one of these options, the robot will run the program and you can’t manipulate its actions, the only possibility is to stop it whenever the user wants.
Mobile Phone App
MIT AppInventor platform has been used for the development of the cell-phone based application. This platform is free and very easy to understand but it is only available for Android mobile phones.
First its required to link the app with Bluetooth module. The app has a code associated to each button and when you press it, the code is received by the microcontroller via the Bluetooth module. For a better understanding of the process you can review the code attached in file “MPLAB” at the end of the article. Fig.9 shows the user interface of the app created with MIT AppInventor development platform. From Fig.9 it is easy to observe that the app enables you to choose the robot’s function (in this case its not required for the operation of the 3 positions switch). Moreover, the app gives an additional advantage in the SUMO operation mode enabling the selection of the robots first movement before the combat starts.
Figure 9. Interface of the mobile phone app.
4. Parts modelling
Due to the official competitions, there are two specifications about the structure:
- The maximum size for the robot is 10x10cm without height limit.
- The weight of the robot must be under 0.5kg
The external structure has been designed using SolidWorks program and built with the 3D printer of the University.
The prototype structure is shown in Fig.10 and the real result is shown in Fig.11.
Figure 10. Prototype structure Figure 11. Real structure
The external structure is made with a biodegradable light plastic known as polylactic acid (PLA). This allows you to make modifications in the structure, like small holes for the infrared sensors. Some additional materials like lead and aluminium have been located strategically to adjust the weight and gain stability among other things.
The final structure (see Fig. 11) shows a compact design with a front side slope specially designed for the combat. Moreover, the wheels have been covered with an adhesive tape called GRIP to make them stickier and improve the traction during the fight. This tape is composed of polyurethane on the outside and polyamide on the inside. More pictures from all the perspectives of the prototype can be found in the attached file “STRUCTURE” at the end of the article.
Figure 12. Covered wheel
At first sight, this project may seem difficult but in fact it’s a matter of patience, going step by step and enjoying the process, especially.
I hope you are planning your robot after reading this memory.