Intel Edison Arduino I.R. Break Beam Sensor

Step 1: Parts

Intel Edison Arduino https://www.adafruit.com/products/2180

I.R. sensor https://www.adafruit.com/products/157

I.R. L.E.D. https://www.adafruit.com/products/387

I used the I.R. break beam sensor ( https://www.adafruit.com/products/2168), but you can recycle any broken device that uses an I.R. remote, as long as the I.R. L.E.D. and sensor aren't what's broken.

Step 2: Assembly

Wire it up like the picture above. You can add an external L.E.D. , I recommend pin 12, it wouldn't blink an external on pin 13, for me, but the on board L.E.D. did.

Step 3: Download the Code Below


IR Breakbeam sensor demo!


#define LEDPIN 12

// Pin 13: Arduino has an LED connected on pin 13

// Pin 11: Teensy 2.0 has the LED on pin 11

// Pin 6: Teensy++ 2.0 has the LED on pin 6

// Pin 13: Teensy 3.0 has the LED on pin 13

#define SENSORPIN 4

// variables will change:

int sensorState = 0, lastState=0;

// variable for reading the pushbutton status

void setup()


pinMode(LEDPIN, OUTPUT); // initialize the LED pin as an output:

pinMode(SENSORPIN, INPUT); // initialize the sensor pin as an input:

digitalWrite(SENSORPIN, HIGH); // turn on the pullup



void loop()


// read the state of the pushbutton value:

sensorState = digitalRead(SENSORPIN);

// check if the sensor beam is broken

// if it is, the sensorState is LOW:

if (sensorState == LOW) {

digitalWrite(LEDPIN, HIGH); // turn LED on:


else {

digitalWrite(LEDPIN, LOW); // turn LED off:


if (sensorState && !lastState) {



if (!sensorState && lastState) {



lastState = sensorState;


<p>do you know if it works with objects?</p>

About This Instructable




Bio: lost my arm at 18, now I'm hacking stuff for disabled people (or animals)
More by tankapotamus:Arduio biometric, or vioce controlled robotic hand Robotic prosthetic hand  with claw or 3d printed hand Cheap Filament Spool Holder 
Add instructable to: