0% found this document useful (0 votes)
6 views2 pages

Me456 Workshop1

The workshop assignment for ME 456 Mechatronics involves using an ultrasonic sensor and Arduino programming to control a robot. Students will write code to read sensor data, navigate a square path, and implement obstacle avoidance. Additionally, they will create a calibration chart for the sensor's accuracy and prepare a report on their findings and robot performance.

Uploaded by

Ömer Dolaş
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)
6 views2 pages

Me456 Workshop1

The workshop assignment for ME 456 Mechatronics involves using an ultrasonic sensor and Arduino programming to control a robot. Students will write code to read sensor data, navigate a square path, and implement obstacle avoidance. Additionally, they will create a calibration chart for the sensor's accuracy and prepare a report on their findings and robot performance.

Uploaded by

Ömer Dolaş
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/ 2

ME 456 Mechatronics – Spring 2025

Workshop Assignment #1: Ultrasonic Distance Measurement

11.03.2025

Goal:
The first assignment is about familiarizing with ultrasonic sensor and Arduino programming. A
simple code to move robot on a square path and reading ultrasonic sensor distance will be
implemented.

Prelab:
• Obtain one of the suggested sumo robot kits. Make sure you have at least one HC-SR04
sensors.
• Assemble robot parts by following instructions.
• Follow the instructions and complete an introductory example on interfacing HC-SR04
ultrasonic sensor at: https://projecthub.arduino.cc/Isaac100/7cabe1ec-70a7-4bf8-a239-
325b49b53cd4. Another tutorial at:
https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/.
• Follow an Arduino motor control tutorial: https://www.youtube.com/watch?v=YkfBtjs8uWg
• Each group bring your kits and one notebook computer with necessary programs installed at
the Workshop to be held during the class time.

Workshop Tasks [12 pts]:


1. [+4 pts]. Write an Arduino program to read ultrasonic sensor data and display it continuously
on serial monitor window.
2. [+4 pts]. Add your code to move forward while reading ultrasonic sensor distance. Stop your
robot when distance (to obstacle) drops below 20 cm.
3. [+4 pts] Now program your robot to follow a square shaped path, as follows:
i. Go forward for one second,
ii. Make a 90 degree left turn,
iii. Go to step (i).
iv. Stop after four turns.

1
Hint:
Your codes will call the following functions:
• Serial.println() function sends text data which can be seen at “Serial Monitor”. Use 115200
baud transfer speed.
• You can define separate functions for forward, backward, left and right turns.

Homework and Reporting [13 pts]:


1. [+4 pts]. Add to lab task 3 the following function. Robot follows the square shape again but this
time measures the distance to obstacle. If it detects an obstacle within 10 cm then instruct the
robot to follow an obstacle avoidance move. Obstacle avoidance will be to move backwards
for one second and then make a 180 degree turn. Your code must be composed of functions.
Set values should be defined as variables.

2. [+5 pts]. Ultrasonic sensor has a limited accuracy. Obtain a “calibration chart” of the ultrasonic
distance sensor. Using a tape measure, put the robot in front a wall at distances from 5 to 250
cm. Use the distance increments in the table below. Record the actual (by tape measure) and
the value given by the sensor. Plot a “calibration curve” and find a best-fit polynomial. Assess
the overall accuracy of the sensor (non-linearity error).
From distance (cm) To distance (cm) Increment (cm) Total measurements
5 20 1 16
25 100 5 16
110 250 10 15

3. [+4 pts] Prepare a short report (2-4 pages) explaining your codes, calibration chart and results.
Give a discussion on robot’s performance. Also record and submit a video of your robot
performing the assigned tasks. Submit your reports within one week of the workshop.

You might also like