Professional Documents
Culture Documents
Arduino Uno Motion Tracker: Cabanlit, Jules
Arduino Uno Motion Tracker: Cabanlit, Jules
Teras Quartet
Cabanlit, Jules
Hombed, Brian
Maloloy-on, Cris
University of Mindanao
SHOW ME THE TRACK! 2
PROJECT DESCRIPTION
Our project is an Arduino Uno Motion Tracker. With our project/device, we can track
the movement of an object and then applying the tracking data for further processing to rotate
the servo motor and match the movement of the object. In simple words, the device will face
Our project will be based on the Arduino UNO with HC-SR04 ultrasonic sensor to
track the direction of an object. The Ultrasonic sensor will be used to determine the distance
and movement of an object like bats do. After determining the distance and direction of an
object it directly becomes an input that will be processed by the microcontroller and is sent to
the servo motor for it to rotate and track the direction of the object. This process is repeated
The purpose of our Arduino Uno Motion Sensor is to simply know the behavior and
features of an object as tracking goes on. This is a basic project for the motion tracker and
can be applied to other projects that need a motion tracker or a sensor for any objects in the
SKETCH
The pseudocode above shows the trackers program design and how it should work. It
describes the algorithm behind the tracker. The sensor emits an ultrasound/sound waves
which travels through the air and if there is an object or obstacle on its path, it will bounce
back to the module. Considering the travel time and the speed of the sound you can calculate
the distance.
This is the expected look of the assembled project. The ultrasonic sensor is attached to
the servo motor.
This is the final output of our very own ARDUINO UNO MOTION TRACKER. It
comes with a lcd to display the distance, and it has two leds to indicate which side the tracker
is facing.
SHOW ME THE TRACK! 6
BLOCK DIAGRAM
Power Supply
9v
Battery
Arduino Uno
R3
9v
Battery
SHOW ME THE TRACK! 7
START
SWITCH
END
NO ON YES
SHOW ME THE TRACK! 8
The Motion Tracker was supposed to include not only the left and right direction, but
also the up and down directions. The proponents tried to achieve the desired output using four
of the HC-SR04 ultrasonic sensors along with two servos. Due to lacking resources and
limited amount of working time, the proponents were unable to accomplish the anticipated
final output. Thus, the group modified the proposed project and limited the directions into left
and right sides only. In order to fill the void and for innovation, the group added lcd, to
display the distance read by the sensors and leds, to indicate which side the tracker is facing.
Overall, it was found out physical properties of analog signals can be converted to
digital signals. A motion detector can be easily built using components that are readily
available. Working in groups helps because the members are able to share their ideas and
assist each other especially because everyone is talented differently. As for the project, there
is still room for improvement by tweaking some of the variables or even developing better
algorithms that improve upon this simple system. The supposed tracker that includes the up
and down directions can also be achieved if given enough amount of time and materials
necessary for successful operation. Potential applications for the motion tracker are obstacle
avoiding robots, motion following camera or turrets and other educational projects.
SHOW ME THE TRACK! 9
APPENDICES
connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to
get started.
variable width. The control wire is used to send this pulse. The
where the servo has exactly the same amount of potential rotation in the clockwise direction
SHOW ME THE TRACK! 10
as it does in the counter clockwise direction. It is important to note that different servos will
have different constraints on their rotation but they all have a neutral position, and that
appropriate. The breadboard has strips of metal underneath the board and connect the holes
on the top of the board. The metal strips are laid out as shown below. Note that the top and
bottom rows of holes are connected horizontally and split in the middle while the remaining
cathode (+), and the electrolyte. The cathode and anode (the
power source.
electrons at the anode. This results in an electrical difference between the anode and the
cathode. You can think of this difference as an unstable build-up of the electrons. The
electrons wants to rearrange themselves to get rid of this difference. But they do this in a
certain way. Electrons repel each other and try to go to a place with fewer electrons. In a
battery, the only place to go is to the cathode. But, the electrolyte keeps the electrons from
SHOW ME THE TRACK! 11
going straight from the anode to the cathode within the battery. When the circuit is closed (a
wire connects the cathode and the anode) the electrons will be able to get to the cathode. In
the picture above, the electrons go through the wire, lighting the light bulb along the way.
This is one way of describing how electrical potential causes electrons to flow through the
circuit.
color and size depending on what they are being used for. In
breadboards, jump wires are used to establish connections between the central micro
APPENDIX B. DIAGRAMS
APPENDIX C. CODES
/***********************************************************************************************
**Cabanlit,Hombed,Maloloy-on,Tiedra July 19, 107
************************************************************************************************
*/
#include <Servo.h>
Servo myservo;
const int Lin = 10, Rin = 12, Lout = 11, Rout = 13, serv = 9;
Rduration, Lduration, Rinches, Linches;//for duration&distance
int threshold = 10;
int angle = 80; //Initial angle
boolean debug = false;
void setup() {
if (debug) { Serial.begin(9600); } myservo.attach(9); }
void loop() {
pinMode(Rout, OUTPUT);
digitalWrite(Rout, LOW);
delayMicroseconds(2);
digitalWrite(Rout, HIGH);
delayMicroseconds(5);
digitalWrite(Rout, LOW);
/***********************************************************************************************
**Cabanlit,Hombed,Maloloy-on,Tiedra August 3, 2017
************************************************************************************************
*/
#include Ultrasonic.h
#include Servo.h
int angle = 90;
Servo servoA;
Ultrasonic sensorB(7,6);
Ultrasonic sensorA(5,4);
void setup() {
servoA.attach(3);
}
void loop() {
int distanceA = sensorA.Ranging(CM);
int distanceB = sensorB.Ranging(CM);
if(distanceA < 51 && distanceB < 51){
if(distanceA < distanceB){
if(angle > 180){
angle++;
}
}
else{
if(angle > 0){
angle--;
}
}
servoA.write(angle);
}
}
SHOW ME THE TRACK! 16
REFERENCES
Nedelkovski, D. (2015, July 26). Ultrasonic Sensor HC-SR04 and Arduino Tutorial
sr04/