Voice-controlled Robot
by danielgass in Circuits > Microcontrollers
165 Views, 2 Favorites, 0 Comments
Voice-controlled Robot
Project objective
Detect the presence of one or more obstacles (placed randomly) in front of the robot and put them away.
We'll use an IR probe to measure distances. The whole thing can be controlled by voice.
Specifications
• Use of a 6-servo articulated arm (I'll use the term robot later).
• IR sensor GP2Y0A41SK0F 4-30CM.
• Remote control via Bluetooth (smartphone or another console)
• Rapsberry pico W controller.
• Programming in micropython.
• Design the mathematical formula to convert the value supplied by the IR probe into cm (or inches).
• Design the formula for moving the robot's gripper a given distance.
Project milestones
1 Components
2 App programming
3 Robot assembly and calibration
4 Basic functions
5 IR sensor-based mathematical functions
6 Voice command implementation
All files (applications and documentation) can be downloaded HERE.
Components
The complete articulated arm kit can be found for less than $50. Unfortunately, while the mechanical parts are of good quality, the servomotors (MG996) are not. During testing, two servos burned out. They were replaced by more expensive and robust DS3225MG servos (or another brushless servo >= 25 kg).
Mounting the arm poses no problems. Having noticed that some screws were loosening under the effect of vibrations, I recommend adding self-locking washers.
The power supply must be efficient, allowing peak currents of up to 3 amps. The current consumption display allows you to control any drift. For example, if a servomotor jams, the current will rise sharply and the voltage may drop below 4V, resulting in erratic servomotor movement. A visual check of the power supply is therefore essential.
Various remote control units can be used, as shown in the illustration. The DIY model can be built according to the project specifications: https://www.instructables.com/Remote-Controller-for-DIY-Robots/
App Programming
To control the arm, use a smartphone or tablet with the Bluetooth Remote application. This free application is easy to configure. It is based on the creation of programmable buttons. For each button, you define a sequence of characters to be sent via Bluetooth. The HC05 module receives the information and transmits it to the program, which transforms it into actions. The illustration shows the programming for the robot's basic functions. For blue keys, the first character (ex-B) is sent, and when released, the second character (S) is sent. In this way, the robot remains in motion as long as the function is pressed.
Robot Assembly and Calibration
The "Assembly of the robot" illustration shows how to start the robot. We can now familiarize ourselves with the robot's handling. By studying the "main.py" program, we can see how incoming characters are processed.
The final step is to calibrate the robot, setting travel limits that must not be exceeded to avoid damaging the servos.
Basic Functions
The illustration explains these functions. The "servomove" function is special. It moves the arm from the current position to the position indicated.
The movement principle is based on the (seemingly) simultaneous rotation of the servos. It would have been simpler to rotate one servo after the other to its destination position. The visual effect is not fluid, as the movement is jerky.
The program is therefore a little more complex. You operate in servo batches. Each servo is rotated in turn, step by step. Servos are numbered from 0 (base) to 5 (the gripper). Rotation takes place in the following order: The set of servos 1,2 is moved upwards independently.
The batch of servos 0,3,4 is moved according to the sequence values.
The batch of servos 1,2 is moved according to the sequence values. Batch 5 (the gripper) is moved according to the destination value.
IR Sensor-based Mathematical Functions Obstable Detection
An IR sensor is used to facilitate the robot's obstacle detection task. This sensor is fixed on the support of servo 0. To establish the formula which gives the distance as a function of the value measured by the sensor, we construct a table. Place an obstacle at various distances (4 to 16 cm) and note the corresponding sensor value (A).
I used a web-based equation search engine (B). By entering the table, we obtain the mathematical function that will be added to the program (C, D). (Relationship illustration)
Obstacle storage (Find obstacle illustration)
To detect the obstacle, move the robot (servo 0) step by step from left to right. When the obstacle is detected (the distance drops rapidly), we adjust the robot to center the obstacle (see illustration).
Determining the robot's position on the obstacle (Calculate servo angles illustration)
Here again, we need to find a formula to transform distance into servo angles. We operate by successive measurements. Place the obstacle between 4 and 15 cm and position the robot on the obstacle. Transfer the values to a table (E). A certain linearity is observed in the values of servos 2 and 3. After a few trials, we find a factor of 4.3 for these two servos and 0.1 for servo 1 (F).
In the "main.py" program, you can launch these functions with the command’s "Q", "7" and "9". On App "bluetooth remote" we'll add the corresponding keys. (main.py illustration below)
Voice Command Implementation
To do this, we're going to use another voice-recognition app. The "Arduino Bluetooth Remote" app fulfills this function perfectly, sending text via Bluetooth to the robot (see illustration for how it works). In the "main.py" application, we'll just need the first three letters of the word to launch the action.
Note: "main.py" programming differs depending on the remote console. You can set the type by changing the "remote_control_type" variable to 1, 2 or 3. You can also dynamically change the value by sending the code from the console in use.
Conclusion
This project has been developed for educational purposes and can be used as a basis for robot development.
Now you can give free rein to your imagination when designing your robots. Enjoy it!