0% found this document useful (0 votes)
20 views7 pages

01 Robotic Gripper Control

The document describes the control of a robotic gripper using an ultrasonic sensor for obstacle detection. It outlines the program flow, setup instructions, and the functionality of the ultrasonic sensor, including distance measurement and servo control. Additionally, it provides troubleshooting FAQs for common issues encountered during implementation.

Uploaded by

Ywhite Eric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views7 pages

01 Robotic Gripper Control

The document describes the control of a robotic gripper using an ultrasonic sensor for obstacle detection. It outlines the program flow, setup instructions, and the functionality of the ultrasonic sensor, including distance measurement and servo control. Additionally, it provides troubleshooting FAQs for common issues encountered during implementation.

Uploaded by

Ywhite Eric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Robotic Gripper Control

In this section, you can learn to detect the distance of obstacle through glowing
ultrasonic module. The opening and closing of the robotic gripper can be
controlled simultaneously.

1. Program Flowchart

2. Ultrasonic Sensor

This is a glowing ultrasonic ranging module. It adopts an I2C communication


interface, which can read the range measured by an ultrasonic sensor through
I2C communication.
The ultrasonic sensor will automatically transmit 8 square waves at 40khz
during ranging, and then detect whether there is a signal return. If there is a
signal return, it outputs a high voltage level, whose continuing time is the time
of the ultrasonic from transmitting to returning.
Formula: measurement distance=(high voltage level time*sound speed
(340m/s))/2.

1
3. Program Download
Note

 Remove the Bluetooth module before downloading the program. Or the program will

fail to download because of the serial port conflict.

 Please switch the battery box to the ‘OFF’ when connecting the Type-B download

cable. This action prevents the download cable from accidentally touching the power pins

of the expansion board, which may cause a short circuit.

1) Locate and open “ultrasonic_claw” program file in the same directory of this
section.

2) Connect Arduino to the computer with the Type-B cable.

3) Click “Select Board”, and the software will automatically detect the current
Arduino serial port. Next, click to connect.

2
4) Click to download the program into Arduino. Then just wait for it to
complete.

4. Program Outcome
When powering miniAuto on, the glowing ultrasonic sensor on it will measure
the distance to the obstacles and control the rotation angle of the servo
accordingly. The servo is mounted on the miniAuto’s robotic gripper. Rotate the
servo will drive the gripper to open and close.

5. Brief Program Analysis


The program for this gameplay is called “ultrasonic_claw.ino”. You can refer to
the following flowchart for the implementation logic of this program.

3
5.1 Import Library File

Import the required library file of controlling the glowing ultrasonic sensor and
the servo for the game.

5.2 Pin Definition and Object Creation


Create an ultrasonic sensor class object and a servo object. They are used to
obtain distance data and control the robotic gripper respectively. The pin
information for the servo motor and buzzer connected to the Arduino controller
is defined. Then, the servo rotation angle and the ranging distance are defined.

4
5.3 Initial Settings
In the “setup()” function, initialize the serial communication and set its baud
rate to 9600. Then, the servo connection is initialized. The value of “angle” is
passed as the rotation angle parameter to the servo. The servo rotates, driving
the robotic gripper to close.

5.4 Main Function


In the main function, call the ultrasonic task function in a loop. It is used to
achieve the function in “5.5 Ultrasonic Detection”.

5.5 Ultrasonic Detection


1) Call the function “ultrasonic_distance()”. It measures the distance and
changes the color of the light.

5
2) When the distance is less than 80mm, the glowing ultrasonic sensor will be
a breathing light mode, showing red at a speed of 0.1s.

3) When the distance is 80 to 180mm, the glowing ultrasonic sensor will


display a red light, with the color getting lighter as the distance increases.

4) When the distance is 180 to 320mm, the glowing ultrasonic sensor will
display a blue light, with the color getting bluer as the distance increases.

5) When the distance is 320 to 500mm, the glowing ultrasonic sensor will
display a green light, with the color getting greener as the distance increases.

6) When the distance is greater than 500mm, the green LED on the glowing
ultrasonic sensor will be steady on.

6
5.6 Servo Control Function

Use an “if” statement to limit the maximum effective value of the distance to
500mm. Because the “map()” function will be used to map the current distance
(effective range: 0-500) to the servo rotation angle parameter (effective range:
0-80).
If the distance is greater than 500, it will result in an invalid “angle” parameter
due to mapping out of range.
After the “angle” is obtained, write it to the servo. The servo will rotate to drive
the robotic gripper to open and close. The closer the distance to the obstacle,
the more the robotic gripper closes, and vice versa.

7. FAQ
Q1:since the code was upload, the distance measured by the ultrasound is
always 0.
A:please check that you have connected the 4-pin cable to the I2C interface.
Q2:the distance measured by the ultrasonic sensor is sometimes accurate,
and sometimes inaccurate.
A:please use a smooth and flat object for distance measurement, and avoid
prolonged close-range detection of the obstacle.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy