Remote ashok

Post on 13-Apr-2017

108 views 0 download

Transcript of Remote ashok

Arduino based remote control

Its very simple method to control outputs by using remote control

Prepared by:

Ashokkumar SekarBE-EEE

Requirements

• Arduino controller (atmeg328)• Tesop1738• Led • Resister• Remote

Circuit diagram

10,11,12

13,14,15

16,17,18

19,20

• There is Tsop output pin is connected to 9th pin of the micro controller, and led +ve pin is connected to 3rd pin of the micro controller

• Tsop 5v supply and gnd , and also led gnd are connected to micro controller supply pins

• After connection to upload program the program code given below slides

Project explanation

• This projects tells about how to control load by using IR remote controller

• There is I preparing , when I press number “1” button led will glow after when press “1” led

will off

Power Jack

Voltage regulator

Power Selection Jumper

USB

FTDI USB chip

Tx Rx leds Digital pins

Analog pinsPower pins

Microcontroller

ICSP Headers

Reset

Power LED

Installing Software

Understanding software

Verify

Upload NewOpen

Save Serial Monitor

Detecting your Microcontroller

SELECTING BOARD AND COM PORT

• TOOLS > BOARDS > ARDUINO DEUMILANOVE W/ATMEGA328

• TOOLS > SERIAL PORT > PORT NUMBER

STRUCTURE OF PROGRAM

Any program should compulsorily have these two functions– void setup() {……. }– void loop() {…… }

NOTE: The common header files such as stdio.h etc., are included in default.

Step1: Declaring Variables

Integer type variableint ledPin = 3;

This should be declared at the very beginning of the program (Even before void setup() and void loop()).

Step2: Setting I/O pins

• You should set the i/o pins as either input or output using the following function

pinMode(pin number, INPUT/OUTPUT);

• You should declare it inside void setup()

Step3: Writing an Output

To write a value to a pin:

digitalWrite(pin number, HIGH/LOW);

This and all the other functions should be written inside void loop()

Step4: Delay function

• To specify a certain period of time for a set of functions to be executed:

delay(value);

Eg: delay(1000);

It is very important to include this function whenever you want to see an output, as the microcontroller works in micro-seconds speed

Time In milliseconds

Getting input

Step 1: Declare a variable int buttonValue;

Step 2: inside void setup(), initialize pin as inputpinMode(A4,INPUT);

Step 3: inside void loop(), read and store the value.buttonValue = digitalRead(A4);

if-else loop if(buttonValue == HIGH) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); }

Since you are checking a condition, you have to use 2 equal-to.

Program Code #include <SPIRremote.h>SPIRrecv remote(9);int ledpin = 3; int irValue;int i = 0;void setup(){ remote.enableIR(); pinMode(ledpin, OUTPUT);}void loop(){ int irValue = remote.getIRValue();

switch (irValue) { case 1: if(digitalRead(ledpin) == HIGH) { digitalWrite(ledpin,LOW); } else { digitalWrite(ledpin,HIGH); } break; } }

Project

I attached my video here