top of page

Motion Tracker using Arduino

This is a simple motion tracker that is used to track any object moving in front of it.

​

The parts used in this project are listed below:

  • Infra red sensors (Quantity: 2)

  • A servo motor

  • An Arduino

  • Connecting wires

  • Power supply

​

The two IR sensors are used to detect the moving object. The servo motor is used to turn the sensors when they detect any moving object.

​

1

2

4

In the figure mt_1 the basic set up can be seen. The grey rectangle represents the servo platform. The servo is attached on the bottom of the servo platform to rotates it while tracking any moving object. On this platform the two IR modules are placed. Each IR module has a transmitter that sends IR light & a receiver that receives the reflected light from any object as it can be seen in the figure.

The IR sensors I have used in this project are obstacle detecting sensors not range sensors. The difference is with obstacle detecting IR sensor you can know when there is an object in front of the sensor but how far the object is from sensor can't be known. For this the IR range sensor can be used which would provide the distance of the object from the sensor. However for this particular project the obstacle detecting sensors work just fine and they are cheaper too. The sensors I have used have a detecting range of only 15 cm which is not that high. However if you do use IR range sensors you can get up to 2 meters of range.

​

6

3

5

8

Now coming back to how the system actually works. Its actually pretty simple. The basic rule is if the right sensor (IR sensor 'R' in figure mt_1) detects any object turn the servo towards right by some amount (say 'x' degrees) & similarly if the left sensor detects any obstacle turn the servo towards left. If both the sensors detect the object then do nothing; no turning command for the servo. How much the servo should turn (the 'x' degree) each time depends on how fast the object is moving & what's the arrangement of sensors (like how far apart both sensors are). The best way is to randomly assign some value and tune it later to a suitable value. Lets say if you have set the servo to rotate by some value. If the turning is too slow then increase the value, if the turning is too fast then decrease the value. For my case I had set for 5 degrees which worked fine. Do note that there is no way to find the speed of the moving object so as to set the turning speed of the servo. So an average value should work fine for most of the cases. Refer the figure mt_2 given below to see how the system works.

​

7

9

10

mt_1

mt_2

In the figure mt_2 the sequence of operation is shown. Imagine an object moving left to right which to be tracked by the tracker. In sequence 'a' the object is first detected by the left sensor; so now the servo would rotate towards left as explained earlier. As the servo rotates to left in sequence 'b' both the sensors now detect the object, hence the servo does not move now. But the object is moving towards right constantly. So in next sequence 'c' the left sensor no longer detects the object & now the right sensor only detects the object. Hence now the servo would move towards right. Similarly in sequence 'd' & 'e' since the object is still moving to the right the case is similar to sequence 'c'; the right sensor detects & the servo keeps rotating towards right. At one point the object would go out of the range of the right sensor in which case none of the sensors will detect the object & the rotation of servo i.e tracking will cease. In that case the servo can be given command to go back to original position.

​

For power connection both the sensors & the servo were powered directly from the arduino. The arduino was powered by usb socket. One thing to note here that the 'Vin'  port of arduino which I used to power both servo & sensors can supply a max. of 1 A current irrespective of the current input to arduino by an external power supply. An usb port however supplies only 500 mA current at 5 V. The servo used was a micro servo which can draw around 300 mA at full load & both IR sensors were drawing about 40 mA each, so all combined the system was drawing less than 500 mA at all times. That's why it was safe to power everything from the arduino directly instead of using an external supply. In case if you are using a larger servo make sure to power it from an external supply.

​

Another question that might arise whether this project can be done with ultrasonic sensors (like HC-SR04). It can be done, also using ultrasonic sensor allows to measure the distance at the same time. But unlike IR sensor with ultrasonic sensor one has to be more careful. Ultrasonic sensor uses sound energy which diverges as it travels. For ultrasonic sensors to work well you need a comparatively larger flat area that can reflect the sound wave; not the case with IR sensors. That is not to say that IR sensors are perfect, IR sensors may not work well outdoors under sunlight. Hence pick a sensor which suits your needs.

​

11

Was this helpful? Let us know

bottom of page