Introduction: Particle Core / Photon - Proximity Sensor
In this tutorial I'm going to show you how to design a Proximity Sensor (infra red) along with the Particle Core or photon. This instructable is a part of a series of instructables using the particle core you can check that out before trying out this instructable.
I'm trying to keep this instructables as simple as possible so that no one is left back, but it is recommended to read my previous instructables first.
So lets get started....
Step 1: Tools and Components
All that you need for this project is -
- Particle Core or Photon
- IR LED
- Photo diode
- 10K resistor
- 330ohm resistors
- Breadboard
No soldering skills are required to proceed with this instructable.
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 Particle.io
- 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 circuit is really simple and has only a few components, also like I told earlier we will be using a breadboard so no soldering skills are required.
Remember to keep the photo diode insulated from the IR LED and the surrounding light by covering it with some tape. Make all the connections by following the circuit above.
Step 4: Code
The code is really very simple, login into your particle account and upload the code to your core. The core will flash a pink color indicting that the code is being written and after that is done the core will connect back to the internet.
Now placing your hand a few centimeters away form the IR LED and the photo-diode will trigger the LED at digital pin 7 ON and OFF.
d
const int buttonPin = 0;
const int ledPin = 7;int buttonState = 0; void setup() { pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); }
void loop(){ buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }