LinkIt One IR Detector

by robo10302 in Circuits > Microcontrollers

2328 Views, 41 Favorites, 0 Comments

LinkIt One IR Detector

IMG_0068.jpg

Hello Builders! Here in this project you will learn to make a IR breaker circuit. This means that the LED will light up once there is an object detected in between the IR sensor and the led. This project is made with a Microcontroller called the LinkIt One Board. The IR receiver is a 38khz IR sensor. In order to detect an object in between the signal being read from the sensor has to change from a 0 to a 1 meaning that it is no longer receiving the IR LED's output.

Parts

IMG_0039.jpg
IMG_0040.jpg
IMG_0041.jpg
IMG_0042.jpg
IMG_0043.jpg
IMG_0044.jpg

1. LinkIt One Board

2. Usb Cable

3. Perf Board

4. 38KHZ IR receiver

5. IR led

6. 330ohm resistor

7. LED( any color)

Solder the Circuit Board

IMG_0045.jpg
IMG_0046.jpg
IMG_0047.jpg
IMG_0048.jpg
IMG_0049.jpg
IMG_0050.jpg
IMG_0053.jpg
IMG_0051.jpg
IMG_0052.jpg
IMG_0054.jpg
IMG_0055.jpg

1. Start with soldering the IR sensor on the edge of the perf board.

2. Then at the exact opposite side solder the IR LED in such that it points towards the IR sensor.( the greater the distance between them the more space you get to detect the object)

3. Solder the resistor to the IR LED's positive pin.

4. Insert the normal led out of the way of the free space between the sensor and IR Led.

5. Solder the LED.

Make sure you have something that looks like the photo above and then you are ready to move on to soldering the wires.

Solder the Wires

IMG_0056.jpg
IMG_0057.jpg
IMG_0059.jpg
IMG_0060.jpg
IMG_0058.jpg
IMG_0061.jpg

1. Solder wires to the positive and the negative pins of the LED.

2. Solder signal wire on to the IR receivers pin 1.

Solder the GND wire to the pin 2 of the IR reciever (middle).

Solder a red wire(VCC) to the pin 3 of the IR receiver.

3. Solder GND to the IR leds negative pin and solder the positive wire to the other end of the resistor.

Now you are done with soldering make sure your have something that looks like the image above and then move on to programing the board.

Code It

IMG_0062.jpg

Plug in the LinkIt One into you're computer and upload this code. This code will allow the IR sensor to detect any objects in between the sensor and the led, and when interrupted the LED will light up and start blinking. You can change it to do what it is you want to do when the object is detected.( triggering a servo, turning on a relay...).

Here is the code:

int Wled = 13;// initialize the pins

int IRled= 8;

int IRsensor = 2;

int ir;

void setup()

{

pinMode(Wled, OUTPUT);

pinMode(IRled, OUTPUT);

pinMode(IRsensor, INPUT);

signal38();

}

void loop()

{

signal38();

if(ir == 1)

{

digitalWrite(Wled, HIGH);

delay(300);

digitalWrite(Wled, LOW);

delay(300);

}

else if(ir == 0 )

{

digitalWrite(Wled, LOW);

}

}

void signal38()

{

digitalWrite(IRled, HIGH);

delayMicroseconds(11);

digitalWrite(IRled,LOW);

delayMicroseconds(11);

digitalWrite(IRled, HIGH);

delayMicroseconds(11);

digitalWrite(IRled,LOW);

delayMicroseconds(11);

digitalWrite(IRled, HIGH);

delayMicroseconds(11);

digitalWrite(IRled,LOW);

delayMicroseconds(11);

digitalWrite(IRled, HIGH);

delayMicroseconds(11);

digitalWrite(IRled,LOW);

delayMicroseconds(11);

}

Wire It

IMG_0064.jpg
IMG_0065.jpg
IMG_0066.jpg

1. Wire the LED to pin 13

2. Wire the IR led to pin 8.

3. GND to GND, IR sensors VCC to 3.3v and IR signal to pin 2.

Make sure you use resistors to lower the current if your Component is rated lower than what the LinkIt One outputs, if precaution is not taken your component can and will burn out.

And you are done:). All that left to do is test it. Make sure you have all the joints soldered properly and that no pins are bridging.

Test It and Conclusion

IMG_0067.jpg

Plug in the LinkIt one into a power source and test out your project. If everything is right then now when you put your hand in between the sensor and the IR led the LED will start blinking.

Hope you learned something new and if you have any questions feel free to ask them in the comments below.

In Conclusion this is a simple project which only triggers on a LED, but you could use the data from the IR sensor and make it turn on or off much more based on the state of the sensor.