Infrared Tripwire

by jakeNorton1234 in Circuits > Raspberry Pi

380 Views, 2 Favorites, 0 Comments

Infrared Tripwire

download (1).jpg
download.jpg
36507730860_21d99c167e_b.jpg
61XLTl3ZwnL._SX425_.jpg
Female_to_Male_10_Jumper_Wires_1__71697.1458324504.1280.1280.jpg
download (2).jpg
automotive_wire_14_gauge_red_small_pack.jpg
download (3).jpg
112186_a3371378e1cc1674c4f8f29b8743bf0bb5f4c312_original.jpg

110 Volt Source.

Supplies

QED123 (IR LED) $0.58 per

https://www.digikey.com/product-detail/en/on-semic...

QSD123 (IR reciever) $0.54 per

https://www.digikey.com/product-detail/en/on-semic...

Relay Module $5.50 single Amazon

Male to female wires under $6 Amazon

Female to female wires under $6 Amazon

(2) 220 ohm resistors around $0.049 each

14 Gauge Wire around $0.10 per ft

LED Light bulb $1 1000bulbs.com

Bergen Keyless Lampholder $2.74 1000bulbs.com

Wire stripper $7 Amazon

Breadboard $8 Amazon

Wire the Breadboard

20191213_160155.jpg
20191213_160223.jpg
20191213_171628.jpg
raspberry-pi-3-pinout.jpg

Wire a 220 ohm resistor in series with the QED123 (LED/pinkish) on the breadboard. On the opposite side of the breadboard, do the same with the QSD123 (Black).

Then connect a male to female wire(mtf) from the 5 volt pin of the pi to the same row of the resistor connected to the QED. Again connect a wire from another 5 volt pin on the pi to the resistor connected to the QSD. Then connect two mtf wires from ground pins on the pi to the rows of the other sides of QSD and the QED. Then take an mtf wire from the row where the QSD(black) and resistor share and connect it to a regular GPIO pin. I used pin 11(GPIO 17).

Then connect a Female to female (FTF) wire from a 3.3 volt pin to the vcc pin of the relay.Then connects a FTF wire from a ground pin to the GND pin of the relay. Lastly connect a FTF wire from a normal GPIO of your choice to the last pin on the module.

Wire Relay Module

36507730860_21d99c167e_b.jpg
automotive_wire_14_gauge_red_small_pack.jpg
112186_a3371378e1cc1674c4f8f29b8743bf0bb5f4c312_original.jpg
download (3).jpg
112186_44504e106ddebf28f70837abdc6aa5dd92499a98_original.jpg
31357953341_0c8cc838d3_o.jpg

*strip the end of the wires*

Use 14 gauge (stripped at each end) from the silver screw of the lamp holder to the NO(normally open) on the relay module. Then wire from the gold screw to a 120volt source Negative. Then wire from the COM of the relay module to the to the positive of the 120 volt source.

Coding

*The relay module is turned on with a logic low/0 so the if statement*

Set the GPIO connected to the QSD as an input and the GPIO connected to the relay module as and output.

Create two if statements both monitoring the input of the GPIO connected to the QSD. One triggered by a high and the other as a low. I both print what is happening with the tripwire. When the tripwire is blocked set off the relay and stop the code with gpio.cleanup( ) so the light stays on to show the tripwire has been broken