Beacon tracking with LEGO Mindstorms EV3 IR Sensor

Beacon tracking is a very exciting robotics area that can be used on things like Robocup, a football tournament played by robots. This robot demo how it can be done.
This weekend I have been playing with my new LEGO Education EV3 Core Set. So it was a fantastic time to revisit the IR Sensor and use one of its functionalities: tracking.


This little robot will follow the IR Beacon when you move it… my kids took a few seconds to realize that I was joking them with the beacon. :)

The Robot is quite simple to build, so you shouldn’t have any problems getting it. It is just a stand for the ev3 brick and the M-motor attached to it.

The program is amazingly simple. If you recall the Line Following tutorial I wrote last week, I just applied the same idea for this robot.

The IR Sensor gives you a heading value that ranges from -25 to 25 to tell you where the beacon is, from top left to top right. So I just use this reading and use a P-Controller to make sure the error is 0. But what is the error? It is the heading, when the IR beacon is exactly in front of the robot it will report 0.

So this is the EV3 code.


You can download the source code here.
SoftwareLarge EV3 Source Code file

Perhaps I built a player for the Robocup :). Time to built a spherical IR beacon for cheap…

12 thoughts on “Beacon tracking with LEGO Mindstorms EV3 IR Sensor”

  1. Pingback: Building a short-range Radar with LEGO Mindstorms - LEGO Reviews & Videos

  2. Pingback: Poor Man's IR Ball: The Ultimate HOWTO ← LEGO Reviews & Videos

  3. Pingback: HOWTO Build your own 3-Wheels Holonomic Robot using LEGO ← LEGO Reviews & Videos

    1. Not sure… there are some plans to build one yourself but the price isn’t interesting at all… and I am really clumsy with wires and all that :D

      The point is that the IR Beacon emits pulses of IR light so you would need to emit that kind of pulses… not just on/off

      1. Hmm. A lot of phones emit IR now, like my Galaxy S5. I don’t know how to program it but I’m sure it wouldn’t be that difficult to get the IR to pulse. Thanks for the reply!!

  4. Hello. I’m Korean but, I can speak English a little.
    I want to open source code file. Where is EV3 program download?
    I want to make Beacon tracking program.
    so, could you give me advice about that?
    Thank you for reply.

Leave a Comment