Introduction: Grove Sensors With a Particle Core - IR Distance Interrupt

This is part two of the series of instructables where I take Grove sensors to the internet using a Particle Core or Photon. In the last instructable I showed you how to hook up a Hall Sensor which is a magnetic sensor to a Particle Core or Photon, so don't forget to check that out before jumping right into this one.

Also, this a part of a larger series of instructables where I design projects using the Particle Core, do also check that out.

In this instructable I'm going to show you how to take a Grove IR Distance Interrupt to the internet using the Particle Core. This will be a part of a robot project which I will post soon.

So lets get started....

Step 1: Tools and Components

All that you need for this instructable is -

  • Particle Core or Photon
  • Grove Hall Sensor
  • 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: Getting Started

If you have followed my previous instructables you already have set up your core and have it connected to the internet.

If you are here first, then you can check the step two of any of the previous instructables in the series for steps on how to get started. The steps involve -

  • Creating an account at
  • Getting it connected to the internet.
  • Claiming a Core
  • Trying out Tinker
  • Trying out my previous instructables

If you have gone through all of these steps, then you are good to proceed to the next step.

Step 3: Circuit

The hardware connections go as follows-

  • VCC => Core 3.3*V
  • Gnd => Core Gnd
  • Sig => Core D2
  • LED Anode => Core D4
  • LED Cathode => GND

Note- There is no connection to the NC terminal. The VCC terminal can handle +5 so you can hook it up to vin of the Core but if you experience any noise from the vin you can switch back to 3.3*. The * indicates a noise free voltage and is ideal for analog devices.

Step 4: Code

The IR Distance Interrupt is a proximity sensor that gives out a high signal when an object is placed with in the range so the program uploaded to the Particle core reads the signal and turns on a led each time the IR Distance Interrupt gives a high signal.

The code can be found below, copy and paste it in the Particle web IDE.

#define SENSOR 2
#define LED 4//the Grove - LED is connected to D4 of Arduino

void setup()
{ pinsInit(); } void loop() { if(isNear()) { turnOnLED(); } else { turnOffLED(); } } void pinsInit() { pinMode(SENSOR, INPUT); pinMode(LED,OUTPUT); } boolean isNear() { int sensorValue = digitalRead(SENSOR); if(sensorValue == LOW)//if the sensor value is LOW? { return true;//yes,return ture } else { return false;//no,return false } } void turnOnLED() { digitalWrite(LED,HIGH); } void turnOffLED() { digitalWrite(LED,LOW); }