IR Transceiver (Pololu) Programming + Arduino
The Pololu IR Beacon Transceiver works in pairs, designed to allow robots and autonomous vehicles to locate one another. Each beacon chip has four IR emitters and four IR receivers. This tutorial will discuss how to program the chip for use.
Assembly
The chips need to be soldered together. The four loose pins need to be soldered to the directional pins holes, the IR emitters need to be soldered on each side of the chip and the three loose pins need to be soldered to the power pins.
Wiring
Six connections need to be made for the pins to be fully operational: the power and ground pins and the four directional pins. The activator pin that is adjacent to the power and ground pins does not need to be connected to anything for the chips base function. We used an Arduino Uno microcomputer for our project and connected the power and ground pins to the 5 V output and the ground slot on the Arduino, and plugged in, in sequence, the directional pins to the digital slots on the Arduino.
Use
Whenever power is supplied to the chip, it will emit IR signals from each emitter. The signal is sent at a particular bandwidth which the beacon pair's IR receiver is particularly sensitive to, allow the pair to have a range of at least 20 feet.
The output of the sensors is digital. By default, each of the IR directional pins returns HIGH when none of the receivers senses a signal. When an IR signal is sent to the chip, the receiver which gets the most powerful signal (i.e. the receiver closes to the signal source), returns the LOW.
To program an Arduino based vehicle/robot using this chip or to test that the Pololu IR Beacon Transceiver is working properly, the following code may be useful:
// Direction Pins:
int northPin = 2;
int southPin = 4;
int eastPin = 3;
int westPin = 5;
// Direction Pin Values:
boolean northValue;
boolean southValue;
boolean eastValue;
boolean westValue;
// Direction Sensors Variables:
int north;
int south;
int east;
int west;
// Direction of Strongest Signal:
int strongestSignal;
void setup() {
pinMode(northPin, INPUT);
pinMode(southPin, INPUT);
pinMode(eastPin, INPUT);
pinMode(westPin, INPUT);
}
void loop() {
senseDirection(northPin, southPin, eastPin, westPin);
strongestSignal = chooseDirection(northValue, southValue, eastValue,
westValue);
Serial.println(strongestSignal)
}
// Read Data from Chip:
void senseDirection(int sensorPin1, int sensorPin2, int sensorPin3, int
sensorPin4) {
northValue = digitalRead(sensorPin1);
southValue = digitalRead(sensorPin2);
eastValue = digitalRead(sensorPin3);
westValue = digitalRead(sensorPin4);
}
// Detect Chip Strongest Direction:
int chooseDirection(boolean north, boolean south, boolean east, boolean
west) {
if (north == 0) {
return 1;
}
if (south == 0) {
return 2;
}
if (east == 0) {
return 3;
}
if (west == 0) {
return 4;
}