Site Loader

Infrared Sensor:

Infrared Sensor is a sensor that measures the light radiating from an object in front of it and detecting if the light reflected back or not.An infrared sensor consists of IR transmitter, which sends an invisible light to human being using a light emitting diode (LED) and the distance can be adjusted by an adjustable potentiometer. An infrared sensor is also consists of IR receiver which is a special photodiode that only detects infrared light. When the IR transmitter sends a light if there is an object comes across the light some of the radiation reflects back as shown in the figure below.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

Infrared Sensor Layout:










Distance Adjustable


IR Receiver


IR Transmitter


Obstacle LED


Power LED


Infrared Sensor Specifications:

Operating Voltage

3.0V to 5.0V


3.3V : approximately 23 mA
5.0V: approximately  43 mA

Detection Range

2cm to 30cm (Adjusted using potentiometer)

Detection Angle


Active output level

Outputs Low logic level when obstacle is detected


On board Obstacle Detection LED indicator
On board Power LED indicator


3.1cm * 1.5cm


Testing Infrared Sensor:

Testing Infrared Sensor Arduino code:

int inputPin = A0;void setup() {  Serial.begin(9600);  pinMode(inputPin, INPUT);} void loop() {  int inputStatus = digitalRead(inputPin);  Serial.println(inputStatus);  delay(1);} 

Circuit Schematic for Testing Infrared Sensor:








Tuning Infrared Sensor:

1.      Put a paper on front of infrared sensor.

2.      Adjust the distance by adjusting the potentiometer until the obstacle LED turned on or from the Arduino IDE open the Serial Monitor.






Gating Started With Cayenne:

First of All, you need to create an account with myDevices. You can use a computer or Mobil Application.

User Creation Using Computer:

1.      Go To Website and press “SIGN UP FREE”.

2.      Type your first name, last name, email address and password. Check the checkbox of “I agree to the myDevices Cayenne terms.”  and Press “GET STARTED FREE”.



3.      Cayenne is going to ask to choose a device, select Arduino.


4.      An Arduino IDE is needed to connect to Cayenne. To download Arduino IDE go to and choose your computer operating system. After that, install the program and run it.

5.      Adding Cayenne library to an Arduino IDE is needed. To add the library go to “Sketch” then “Include Library” then “Manage Libraries…”.


6.      Type Cayenne in the search bar then the library “Cayenne by myDevices” is going to show up. Choose the latest version then press “Install” and wait for the library to download.

7.      Verify that Cayenne library installed properly by going to “Sketch” then going to “Include Library”. Make sure that the Cayenne library included at the bottom in the “Contributed libraries” section.

8.      Change the following selections by going to “Tools”:


Arduino/Genuino Mega or Mega 2560


ATmega2560 (Mega 2560).


Choose the port that is connected to Arduino

9.      Go back to Cayenne website and press “Next”.









10.  Select the “Arduino Mega” then “W5500”.


Configuring Ethernet Shield:

1.      Ethernet Shield library is necessary in order to use the Ethernet Shield, which can be download by going to and press “Clone or download”. After that, press “Download ZIP”.




2.      Add the library by going to “Include Library” then “Add .ZIP Library…” and select the file that you download.

3.      Make sure that the library was added correctly by going to “Sketch” then “Include Library” then “Ethernet2” must be included in the libraries.



Arduino Mega Code:


//#define CAYENNE_DEBUG         // Uncomment to show debug messages

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space



// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.

char token = “”;


void setup()






void loop()




Adding a new Stuff Widget:


Edit Current Stuff Widget:


Setting Up Email and SMS for a Stuff:




Post Author: admin


I'm Erica!

Would you like to get a custom essay? How about receiving a customized one?

Check it out