Introduction: LinkIt One - IR Distance Interrupter

This instructable is a part of a series where I show you how to get started with the link it one. In the last instructable I showed you how to build a simple battery level indicator for the LinkIt One. Make sure to read through my previous tutorials before starting with this one.

In this tutorial I'm going to show you how to get started with a Grove IR Distance Interrupter sensor, which I will later show you how to connect to the internet.

The Grove IR Distance Interrupter sensor is a proximity sensor which can detect the presence of any obstacle in front of it.

So lets get started....

Step 1: Tools and Components

All that you need for this instructable is -

LinkIt One Board

IR Distance Interrupter

Breadboard

Jumper wires

Note - No soldering skills are required for this instructable as we will be using a breadboard. Also that the Particle Core is no longer available so you can get a photon and all the instructions and code in this tutorial run fine on a Photon.

Step 2: IR Distance Interrupter

The Grove IR Distance Interrupter is a proximity sensor which can detect objects in front of it by sending out a beam of IR ray and once the rays are reflected back by the object the sensor sends a LOW pulse which is read by the LinkIt One.

The level of sensitivity can be modified by varying the pot behind the board.

Step 3: Circuit

The circuit is very simple all you have to do is connect -

  • IR Sensor signal pin to LinkIt One Digital pin 2
  • IR Sensor Gnd pin to LinkIt One Gnd
  • IR Sensor VCC pin to LinkIt One +5V

Also you need to connect an LED to LinkIt One digital pin 13, this is optional as the LinkIt One has an onboard LED on the same pin.

Step 4: Code

The code is quite simple all it does is turns the LED on when an object is placed in front of the sensor. You need an arduino IDE with a LinkIt One plug in to upload the code to the board. You can read through my first instructable on how to do that.

const int buttonPin = 2;
const int ledPin = 13;

int buttonState = 0;

void setup() { pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); }

void loop() { buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) { digitalWrite(ledPin, LOW); } else { digitalWrite(ledPin, HIGH); } }