Programming Pololu IR beacon


I’m participating in a robotics competition where a robot has to cross a large table diagonnally and reach the other side the quickest possible while avoiding obstacles on the table. I’ve purchased the pololu beacon transceivers in order to be able to detect the far corner and accelerate towards it. But since there are four robots starting from the four corners on the table, I’m pretty sure there will be others using this particular beacon ^^
So, in order to avoid interference I would like to program the IR beacon to emit at a particular pattern.
I’ve skimmed through the existing discussion on the Pololu IR beacon but I never found anything related to programming the Pic on the beacon ?

Do I need to make a particular board for communication? Or is there an easier way? (I don’t trust my electronic-board-making abilities so much :D)

Thank you

I’ve just read on the description of the IR pololu beacon develepment board (#704) :

“Includes a footprint for a 5-pin header compatible with the PIC kit 2 programmer”. I have the same footprint on my beacon transceiver. Do I just need to buy a 5 pin cable ?



Have you programmed a PIC before? Did you try to look up what a “PIC kit 2” is? The board has the setup for the typical way to program them, which is supported by programmers such as the PIC kit 2. (I think they’re up to at least the PIC kit 3 by now, and they might write it PICkit, without the space.)

- Jan

Yeah thanks. So I just buy the pic kit 3, and interface with the beacon.
Thank you very much

PS : Isn’t there a cheaper way? ^^

I’m still concerned that you don’t know what you’re doing with the PICs. You understand that you have to write the program for the PIC, and that the documentation consists of the beacon schematic, right? There are all kinds of programmers out there, and there are probably cheaper options; I do not have any particular one to recommend.

- Jan

A quick question? Where can I find the source code for the pic on the pololu beacon? Since I acquired a PicKit programmer, I would like to write a code to make patterns, but I would like to have the source code in order to upload it again if anything goes wrong.
Thank you

Sorry, the code for the beacons is not publicly available.

- Jan

Could you show me an example of code, or at least give some hints as to how to program the beacons to emit at a certain pattern?
The goal is to avoid my robot following another pololu beacon instead of the one he should follow.
Thank you?

The beacons we ship programmed use 56 kHz IR receiver modules. The first thing you can do to make yours unique is to use a different frequency, though that might interfere with other sensors people might have. If you go for something like 40 kHz, that’s a 25 us period, which is pretty short for the PIC, so I would just do it with a bit set, bunch of nops, bit clear, and more nops, where the nops on each side of the bit toggling set your duty cycle, which you probably want to set to about 50%. That needs to be in a loop where you send maybe 8-16 pulses for each burst, and then you can do whatever modulation you want beyond that.

In general, though, making lots of beacons work together is not an easy problem, especially if you don’t get to control all of them. The beacons as we have them are intended to work only in pairs, and anything the sensors detect is assumed to be from the other beacon. However, you don’t need the bidirectional operation, so you can make your beacon just constantly generate a special pattern, and then look for only that pattern on your robot. However, you will likely lose the direction-finding ability, so you would have to have your sensor look through a narrow window or tube and spin the sensor or whole robot around to look for your beacon.

- Jan

I understand that the IR Beacon source code is not publicly available; however, it would be nice to understand how to implement the receiver. I would like to implement the receiver on a Pololu 3pi+ Robot or a custom Atmega 32U4 robot with IR Receiver Modules. The IR Beacon would be used as the transmitter.

I am sure an application note about implementing the receiver would sell some IR Beacons. In the application note include some hints, like turning the receiver 45o for better pointing, would also help.

The IR Beacon transmitter will be used as a stationary beacon like a lighthouse. The robot will seek the lighthouse.


The specialness of our IR beacons is in getting both directions working at the same time. If you just want to detect the IR beacon, you can use multiple IR receiver modules and compare them to determine which one is getting most activation, and that should be the one facing the beacon.


Hi Brandon,

Please suggest an algorithm to “determine which one is getting most activation” using an Atmega 32U4.

Maybe use the Pin Change Interrupt using four IR receiver modules, or poll the PCINTn pins to avoid a flood of interrupts.

In any case, do you count the number of activations for each IR receiver over a period of time? If so, what period of time?

Is each IR Beacon transmitter modulated or just on/off for a period of time?

Any more algorithm details would be appreciated.


Yes, count the activations over some time. The beacon does 20 Hz updates, so somewhere around 50 ms is probably a lower bound. I suggest just looking at the output of an IR receiver module with an oscilloscope so you can get a better understanding of the signals you are trying to compare.