Pic Microcontroller Programming Tutorial For Beginners using MikroC With Step By Step Guide.

Thursday, December 17, 2015

IR (Infrared) Communication Between Two Microcontroller -Step By Step Tutorial : Part-1

PART 1 : Basic Introduction

PART 2 : Interrupt 

PART 3 : Timer

PART 4 : Calculation

PART 5 : LED Switching Project [END

 

Introduction and Some Basic Descriptions :

IR (Infrared) Communication Between Two Microcontroller -Step By Step Tutorial : Part-1
IR (Infrared) Communication Between Two Microcontroller -Step By Step Tutorial : Part-1

IR means Infrared light . Generally Infrared light is invisible to us .We can find this in our TV remote controlling system. It's very popular and widely used in wireless technology and it's really cheap to buy . You can find more details in Google . In this tutorial I will try my best to make you understand . I will try to skip complexity .

When we press any key of our TV remote , IR light signal comes out . You can't see through your eyes but you can see that if you look through the mobile camera screen. During creating signal the IR-Led turns ON and OFF randomly . 

We will also try this for communication between two pic microcontrollers . When IR-LED remains ON, it transmits 36KHz IR signal continuously. When IR-LED remains OFF there is no signal.



Now take a look on IR-Led (Transmitter) and IR Receiver 

Picture of Transmitter Module:

IR (Infrared) Remote Control Communication Between Two Microcontroller -Step By Step Tutorial : Part-1
Infrared LED (Transmitter Modude)

Picture of TSOP38236(36 KHz) Receiver Module:

IR (Infrared) Remote Control Communication Between Two Microcontroller -Step By Step Tutorial : Part-1
TSOP38236 Receiver Module

 What happens in IR communication ? We transmit a signal in a systematic procedure through Transmitter Unit and Receiver Unit receives that signal .


What happens in IR communication ? We transmit a signal in a systematic procedure through Transmitter Unit and Receiver Unit receives that signal .

Transmitter Unit's Working   

IR (Infrared) Remote Control Communication Between Two Microcontroller -Step By Step Tutorial : Part-1
IR (Infrared) Remote Control Communication Between Two Microcontroller

This picture edited from a picture of https://learn.sparkfun.com



The transmitting signal is a combination of pulses . Consider we would like to send 4 bit data(1011) through transmitter then we might set unique identification for each bit . 

For example,
we can use (562 us ON & 1.6875 us OFF ) for Logical 1
          and (562 us ON & 562 us OFF ) for Logical 0

By measuring the time duration of each pulse, we can identif each bit in receiver unit.


If we want to get the receiver to receive the signal, then we have to follow the systematic procedure. 
That means , if we want to send 1011, first we need to send a start signal. After sending all data we need to send an ending signal. Actually we need to send start signal to get MCU ready to fetch data accurately.



   [ start_signal + 1101(reverse)+1011(main)+ ending_signal ]  Total Signal                    
 
Now the question is how much time should be selected . We will use NEC Protocol's data type.You can use your own . Generally most of devices are using NEC Protocol. In NEC Protocol data contains 






[ start signal + 8bit Address+ Reverse 8bit Address+ 8 bit Command + Reverse 8bitCommand ]
Start Signal : 9 ms ON and 4.5 ms OFF 
(You can use as your wish but should be grater than bit's pulse)

Logical 1: 562 us ON and 16875 us OFF
Logical 0: 562 us ON and 562 us OFF


In this tutorial, we will use 4 bit data signal and we will use only data type .Our signal will be like this .


  Start + (reverse 4 bit command 4 bit command Combination total 8bit) + End



Receiver Unit's Working

I took this from http://learn.sparkfun.com
When IR-Led turns OFF or no signal comes to IR-Receiver, IR-Receiver provides 5v or high output to microcontroller's external interrupt pin .When IR-Transmitter turns ON, IR-Receiver provides 0v or low.
IR (Infrared) Remote Control Communication Between Two Microcontroller -Step By Step Tutorial : Part-1
IR (Infrared) Remote Control Communication Between Two Microcontroller

Transmitter unit sends Start Signal 9 ms ON and 4.5 ms OFF consequently IR-Receiver provides 9 ms OFF(0v) and 4.5 ms ON(5v)
After finishing this stage when first bit is sent, transmitter sends out pulse  562us ON and 562us OFF and consequently IR-Receiver provides 562us ON(5v) and 562us OFF(0v) . That will make external interrupts on microcontroller and timer0 will start to count duration of time so that each bit can be uniquely identified .In this way all bit's comes to the receiver unit . Finally we need to get our microcontroller understand about ending of signal and we send last signal pulse .

So First we need Interrupt to ditect signal .
Secondly , we need timer to measure time duration of signal so that we can identify each bit from signal (0 or 1). We also need PWM (Pulse width Modulation).
Reactions:

2 comments:

Post a Comment

Share and Bookmark this Blog

Learn at Udemy :

Tags

: (1) 18F2550 (1) 36KHz (3) and (1) Based (1) battery (1) Bipolar (1) Blinking (1) blinks (1) Bluetooth (1) bluetooth device interfacing (1) bluetooth module (1) button (1) circuit (1) clock (1) control (1) crystal oscillator (3) Db9 (1) DC Motor (2) digital (2) Digital Voting Machine (1) digital voting machine using pic (1) display (2) DS1307 (1) electronic (1) embedded c programming tutorial (11) embedded c tutorial (11) experiment kit (4) external interrupt (4) flash (1) flashing (1) Gas Leakage detector (1) HC-06 (1) home (1) how (1) How to (10) i2c tutorial (1) in (1) indicator (1) infrared Connection (3) interface (8) interfacing (3) Interrupt (3) Introduction (1) IR Connection (3) IR Receiver (4) IR Transmitter (4) key pad (1) keypad (1) lavel (1) Lcd 16x2 (2) lcd 2x16 (2) led (1) lm35 (2) LPG (1) machine (1) make (1) Make bootloader (1) making (1) matrix (1) max232 (1) membrane keyboard (1) meter (2) Micocontroller (1) microchip (4) microchip pic (2) microchips (3) microcontroller (9) microcontroller based (3) microcontroller programming (3) Microcontroller Project (4) Microcontroller Projects (1) microcontroller_project (2) microcontrollers (4) Microprocessor (2) mikroC (5) mikroc code to start and stopstart and stop dc motor (1) mikroc pro for pic (2) Motion detector (1) MQ-9 Gas Sensor (1) musical (1) NEC Protocol (4) pcb (5) PIC (3) pic controller (11) pic microcontroller (11) pic microcontroller tutorial (11) pic programming (1) pic programming in c (12) pic proteus (1) Pic Tutorial (12) pic18 (2) pic18f2550 (11) picmicrocontroller (4) picRFモジュール (1) PIR Motion Sensor (1) printed circuit board (1) proteus (6) pulse width modulation (1) push (1) push button (1) PWM (1) real (1) rf transmitter (3) Rs 232 (1) Rs232 (1) scroll (1) scrolling (1) Serial communication (1) Serial Connection (1) Serial Port (1) serial port rs232 (1) Servo Motembedded c programming tutorial (1) simulation (2) Soil Moisture Meter (1) speed control (1) step by step (7) step bystep (1) Stepper Motor (2) text (2) Thief Detector (1) time (1) timer (4) timer0 (4) tone (1) TSOP38236 Receiver (4) tutorial (2) Unipolar (1) USART Connection (1) USB (1) usb 1.0 (1) USB bootloadere (1) USB HID (1) using (9) voltmeter (1) voting (1) water level indicator (3) with (2) work (1)

Definition List

Comment Option isn't working properly

Comment option isn't working properly. If you have anything to say, you are requested to use the "Contact Form" below here.

Leave Your Message Here

Name

Email *

Message *

Google+ Followers

Like on Facebook