IoT is very famous in today’s era many application works on
this technology and we have seen much application such as car automation, room
automation, smart home, and smart parking systems, etc. Ever thought how all
this happen? How this IoT works?
Quite simple for instant making communication between hardware
and software using some communication channel is known as IoT (internet of
things) this is a very general definition and explained in very simple words. Now, how to can we implement it? Simple by using some components such as controller
which we will program using some programming language such as C, C#, Python,
C++ etc. communication devices which compatible with a microcontroller such as
HC-06 Bluetooth module, Wifi module and
IR Sensor with IR remote.
We can easily make communication between hardware and
software (any application which controls hardware) using any of the aforementioned
components for communication. For instant, we have used IR remote and IR sensors
in our experiment for turning the different LEDs on and off.
Our experimental setup is shown below having different LEDs
and breadboard IR sensor connected with Arduino microcontroller and IR remote
which actually communicates with the Board using the IR sensor. The sensor will read the
input then the input will convert and switch condition will execute the instruction
such as on the LED or off the LED code for the implementation is given below.
#include <IRremote.h>
//Define Pins
int redLed = 5;
int yellowLed = 4;
int greenLed = 3;
int blueLed = 2;
int RECV_PIN = 11;
//IR Library stuff
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
//Set Led Pins
pinMode(redLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);
//Enable serial usage and IR signal in
Serial.begin(9600);
Serial.println("Enabling IRin");
irrecv.enableIRIn();
Serial.println("Enabled IRin");
}
void loop() {
if (irrecv.decode(&results)) {//irrecv.decode(&results) returns true if anything is recieved, and stores info in varible results
unsigned int value = results.value; //Get the value of results as an unsigned int, so we can use switch case
Serial.println(value);
switch (value) {
case 2295:
digitalWrite(redLed, HIGH);
delay(500);
digitalWrite(redLed, LOW);
break;
case 34935:
digitalWrite(yellowLed, HIGH);
delay(500);
digitalWrite(yellowLed, LOW);
break;
case 18615:
digitalWrite(greenLed, HIGH);
delay(500);
digitalWrite(greenLed, LOW);
break;
case 10455:
digitalWrite(blueLed, HIGH);
delay(500);
digitalWrite(blueLed, LOW);
}
irrecv.resume(); // Receive the next value
}
}
Project Title and Team Member Submission:
Note anyone from the group of max 3 and min 1 person can fill this form only:
MCP Project Phase 2 Submission:
Please Comment Below if you find any issue or suggestion to improve the Quality of content.
Please Comment Below if you find any issue or suggestion to improve the Quality of content.
Informative
ReplyDeletePost a Comment