Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Infrared Communication

Status
Not open for further replies.

flemmard

New Member
Hi,
I'm working on PIC .I wish to send some data stored in my PIC's EEPROM to my computer using Infrared. On the other end , in my PC, I need to catch the information and store it in Visual basic .

How do i do that ? Which IR modules will help me?
Thanks
 
Here's one way if you have a PIC with built-in hardware PWM. http://www.rentron.com/Micro-Bot/IR_Serial.htm
If you're using a MAX232, the IR detector output pin can connect directly the the MAX IC, and you can eliminate the 2N3906. If not, the receiver circuit shows how a direct connection works.

You can also program a small PIC, like say a 12F or 10F part to sample an input pin, and generate the IR carrier. I have .asm code on this page http://www.rentron.com/IR_TO_RF.htm using a 10F200.

Using the dedicated PIC to generate the carrier is the easiest way. You just fire serial data at it, and it outputs the data modulated at the carrier frequency. It's easy enough to modify the code to generate a different frequency depending on the IR module you have on hand.

If you need a higher data rate, the Vishay TSOP7000 would work. These allow data rates up to 20K bps, but the IR carrier needs to be 455kHz, and the cost goes up a bit. I've done this with a 12F675 @20MHz generating the 455kHz carrier similar to the 10F version above.

With most 38 to 40kHz IR modules, you can get around 1200 or 2400 bps (check data sheet for max), and the cost is lower.

You can use these to build IR wireless serial data links for sending data to a PC, wireless control of serial LCDs, and tons of other things normally done with a hard-wired serial connection. It's pretty easy, and a lot of fun.
 
breyno2 said:
Here's one way if you have a PIC with built-in hardware PWM. http://www.rentron.com/Micro-Bot/IR_Serial.htm
If you're using a MAX232, the IR detector output pin can connect directly the the MAX IC, and you can eliminate the 2N3906. If not, the receiver circuit shows how a direct connection works.

You can also program a small PIC, like say a 12F or 10F part to sample an input pin, and generate the IR carrier. I have .asm code on this page http://www.rentron.com/IR_TO_RF.htm using a 10F200.

Using the dedicated PIC to generate the carrier is the easiest way. You just fire serial data at it, and it outputs the data modulated at the carrier frequency. It's easy enough to modify the code to generate a different frequency depending on the IR module you have on hand.

If you need a higher data rate, the Vishay TSOP7000 would work. These allow data rates up to 20K bps, but the IR carrier needs to be 455kHz, and the cost goes up a bit. I've done this with a 12F675 @20MHz generating the 455kHz carrier similar to the 10F version above.

With most 38 to 40kHz IR modules, you can get around 1200 or 2400 bps (check data sheet for max), and the cost is lower.

You can use these to build IR wireless serial data links for sending data to a PC, wireless control of serial LCDs, and tons of other things normally done with a hard-wired serial connection. It's pretty easy, and a lot of fun.


Hi, thanks for your great reply.I'm using PIC16f877.
So which procedure i should follow? And moreover, i need to send just 2 bytes [i wish to store in EEPROM]from my PIC to PC using infrared?
Thanks again
 
Last edited:
The circuits in the first project link should work fine. If you don't need long range. The hardware PWM module providing the carrier with I/O-pin driving the IRLED directly is cheap, and easy, but it does limit how hard you can drive the IRLED and range.

If you need more range, then program a small 10F or 12F part to use as the dedicated carrier generator. If prefer this route since it can be used with any I/O-pin on the main controller, and you can drive the IRLED with a mosfet, transistor, etc, for much better range.

Edit: And Nigels' tutorial here offers yet another approach.
 
Last edited:
breyno2 said:
If you need more range, then program a small 10F or 12F part to use as the dedicated carrier generator. If prefer this route since it can be used with any I/O-pin on the main controller, and you can drive the IRLED with a mosfet, transistor, etc, for much better range.
I think you can get just as much range with the PWM if you use "a mosfet, transistor, etc, " on its output to drive the IR LED.

But I like the idea of a dedicated carrier generator esp if you have the PWM tied up with the motors.

EDIT:
breyno2: It is not a good idea to PM people with the same question you post. It is best to do one or the other. Posting is best because everyone can read the answers.
 
Last edited:
breyno2 said:
Here's one way if you have a PIC with built-in hardware PWM. http://www.rentron.com/Micro-Bot/IR_Serial.htm
If you're using a MAX232, the IR detector output pin can connect directly the the MAX IC, and you can eliminate the 2N3906. If not, the receiver circuit shows how a direct connection works.

You can also program a small PIC, like say a 12F or 10F part to sample an input pin, and generate the IR carrier. I have .asm code on this page http://www.rentron.com/IR_TO_RF.htm using a 10F200.

Using the dedicated PIC to generate the carrier is the easiest way. You just fire serial data at it, and it outputs the data modulated at the carrier frequency. It's easy enough to modify the code to generate a different frequency depending on the IR module you have on hand.

If you need a higher data rate, the Vishay TSOP7000 would work. These allow data rates up to 20K bps, but the IR carrier needs to be 455kHz, and the cost goes up a bit. I've done this with a 12F675 @20MHz generating the 455kHz carrier similar to the 10F version above.

With most 38 to 40kHz IR modules, you can get around 1200 or 2400 bps (check data sheet for max), and the cost is lower.

You can use these to build IR wireless serial data links for sending data to a PC, wireless control of serial LCDs, and tons of other things normally done with a hard-wired serial connection. It's pretty easy, and a lot of fun.

Hi there,
How do i connect it to RS232?
Thanks
 
Last edited:
breyno2 said:
Here's one way if you have a PIC with built-in hardware PWM. http://www.rentron.com/Micro-Bot/IR_Serial.htm
If you're using a MAX232, the IR detector output pin can connect directly the the MAX IC, and you can eliminate the 2N3906. If not, the receiver circuit shows how a direct connection works.

You can also program a small PIC, like say a 12F or 10F part to sample an input pin, and generate the IR carrier. I have .asm code on this page http://www.rentron.com/IR_TO_RF.htm using a 10F200.

Using the dedicated PIC to generate the carrier is the easiest way. You just fire serial data at it, and it outputs the data modulated at the carrier frequency. It's easy enough to modify the code to generate a different frequency depending on the IR module you have on hand.

If you need a higher data rate, the Vishay TSOP7000 would work. These allow data rates up to 20K bps, but the IR carrier needs to be 455kHz, and the cost goes up a bit. I've done this with a 12F675 @20MHz generating the 455kHz carrier similar to the 10F version above.

With most 38 to 40kHz IR modules, you can get around 1200 or 2400 bps (check data sheet for max), and the cost is lower.

You can use these to build IR wireless serial data links for sending data to a PC, wireless control of serial LCDs, and tons of other things normally done with a hard-wired serial connection. It's pretty easy, and a lot of fun.

Hi,
I'm using PIC16f877 which runs in 20Mhz.I guess.Need i change the PWM etc now?
Thanks
 
somebody talked about infrared..?

somebody talked about infrared..?

i have the answer...

buy the infrared LED.. and interface with the circuit that uses " 555 timer to generate the frequency of 38 KHz"..
the serial output of microcontroller should be at pin 4 of 555 timer...
the serial output should be preferably at 9600 baud...


on the receiver side..
in windows operating system --- > go to start menu --- > go t programs ---> accessories ---> communications ---> hyperterminal --- > rs232 ( if the option is there..) ----> then name the file --- > then select the com port available ---> then select baud rate as 9600 & flow control as 'hardware' or 'none' ( this you have to check..) --->

the data sent by your microcontroller automatically appears at this window...

for this you should add this hardware..

TSOP 1738 on reveiver pin of serial port..

Regards..

Simran..
 
simrantogether said:
somebody talked about infrared..?

i have the answer...

buy the infrared LED.. and interface with the circuit that uses " 555 timer to generate the frequency of 38 KHz"..
the serial output of microcontroller should be at pin 4 of 555 timer...
the serial output should be preferably at 9600 baud...

It's not really a very helpful answer though?.

You appear to be missing the point of micro-controllers, you don't use the micro-controller to trigger a 555 - you simply generate the 38KHz dorectly in the micro-controller. It's easier, cheaper, simpler, more accurate and more reliable.

It's also a bad idea to try and send simple RS232 over an IR (or radio) link, you need to use some kind of coding if you want it to be at all reliable. Particularly important for IR, where the width of the pulses from the receiver isn't the same as those supplied to the transmitter.
 
Nigel Goodwin said:
You appear to be missing the point of micro-controllers, you don't use the micro-controller to trigger a 555 - you simply generate the 38KHz dorectly in the micro-controller. It's easier, cheaper, simpler, more accurate and more reliable..

is it possible.. ?

is it possible to generate data at 9600 baud and modulating with 38khz on the same pin?

The microcontroller can only generate data at specific baud rate.. it has to be modulated so that it can be read by tsop1738...



It's also a bad idea to try and send simple RS232 over an IR (or radio) link, you need to use some kind of coding if you want it to be at all reliable. Particularly important for IR, where the width of the pulses from the receiver isn't the same as those supplied to the transmitter.

it may be bad.. but effective .. all you have to do is to be in range of 10-20 feet.. the width of receiver will surely match of out transmitter...

also we need to add an amplifier at transmitter side.. for high power..

Regards,

Simran..
 
simrantogether said:
is it possible.. ?

is it possible to generate data at 9600 baud and modulating with 38khz on the same pin?

Check my IR tutorial - there's no need (or use) in trying to use the hardware UART for this.

The microcontroller can only generate data at specific baud rate.. it has to be modulated so that it can be read by tsop1738...

Serial data is just a string of 1's and 0's, assuming you want the 1's to be bursts of 38KHz you simply toggle the pin at 38KHz the required number of times (again, check my IR tutorial).

it may be bad.. but effective .. all you have to do is to be in range of 10-20 feet.. the width of receiver will surely match of out transmitter...

You've obvoiously NEVER tried it, because it doesn't! :D

Why do you think IR remote controls don't use RS232?, it's because it doesn't work, or doesn't work reliably enough.

Get a double beam scope and set a demonstration up, one beam on the input to the transmitter, and the other on the output of the receiver - you will see they don't match - and are far enough out to prevent RS232 at 9600 being useable (works for some values, and not for others).

also we need to add an amplifier at transmitter side.. for high power..

Again, check my tutorials! - it's dead simple.
 
Nigel Goodwin said:
Serial data is just a string of 1's and 0's, assuming you want the 1's to be bursts of 38KHz you simply toggle the pin at 38KHz the required number of times (again, check my IR tutorial).

then how can we generate specific baud rate..?


You've obvoiously NEVER tried it, because it doesn't! :D


Sir Nigel.. you are Right i never tried it.. but i am confident about this.. i feel.. tell mistake..
oh..! i got my mistake.. i never mentioned about max 232 that has to be interfaced between tsop and rs232...

Why do you think IR remote controls don't use RS232?, it's because it doesn't work, or doesn't work reliably enough.

most of remote controls can be used for tv only .. for very small applications...

but what when you have an infrared keyboard and you want to interface it with desktop only through rs232..?:p

Get a double beam scope and set a demonstration up, one beam on the input to the transmitter, and the other on the output of the receiver - you will see they don't match - and are far enough out to prevent RS232 at 9600 being useable (works for some values, and not for others).



Again, check my tutorials! - it's dead simple.

BOSS IS NEVER WRONG.. IF YOU SAY IT IS EASY.. THEN I FOLLOW YOU.. BUT I WAS PRESENTING MY IDEAS..


Regards,

Simran..
 
simrantogether said:
then how can we generate specific baud rate..?

You simply time your 1's and 0's accordingly - off hand I seen to remeber 9600 baud is 105uS per bit? (check my RS232 tutorial which does mention it).

Sir Nigel.. you are Right i never tried it.. but i am confident about this.. i feel.. tell mistake..

Confident and WRONG! :D

As you've never tired it you're assuming it works, but with no basis for that assumption.

oh..! i got my mistake.. i never mentioned about max 232 that has to be interfaced between tsop and rs232...

Makes no difference to the point under discussion.

most of remote controls can be used for tv only .. for very small applications...

It's no different to any other application, in fact HDD's use the same Manchester coding as many remote controls do - and for the same reasons!.

but what when you have an infrared keyboard and you want to interface it with desktop only through rs232..?:p

You put a PIC each end, it encodes the transmission, and decodes the reception and converts it to RS232.
 
Nigel Goodwin said:
You simply time your 1's and 0's accordingly - off hand I seen to remeber 9600 baud is 105uS per bit? (check my RS232 tutorial which does mention it).



Confident and WRONG! :D

As you've never tired it you're assuming it works, but with no basis for that assumption.



Makes no difference to the point under discussion.



It's no different to any other application, in fact HDD's use the same Manchester coding as many remote controls do - and for the same reasons!.



You put a PIC each end, it encodes the transmission, and decodes the reception and converts it to RS232.

Sir,
Is it necessary to use MAX3222 to boost up? For my another school project, we have been asked to just connect two rs232 between computers for handshaking.
 
simrantogether said:
somebody talked about infrared..?

i have the answer...

buy the infrared LED.. and interface with the circuit that uses " 555 timer to generate the frequency of 38 KHz"..
the serial output of microcontroller should be at pin 4 of 555 timer...
the serial output should be preferably at 9600 baud...


on the receiver side..
in windows operating system --- > go to start menu --- > go t programs ---> accessories ---> communications ---> hyperterminal --- > rs232 ( if the option is there..) ----> then name the file --- > then select the com port available ---> then select baud rate as 9600 & flow control as 'hardware' or 'none' ( this you have to check..) --->

the data sent by your microcontroller automatically appears at this window...

for this you should add this hardware..

TSOP 1738 on reveiver pin of serial port..

Regards..

Simran..

Hi all,
This is my TX test program in PIC C. I'm using PIC16f877.
I couldn't get what i need in hyperterminal .But it works wellfor other sample HEX files online.So no problem in my circuitry.Any wrong in my code? For now, i'm directly connecting it to my PC using Rs232 9 pin
Thanks

Code:
#include <pic1687x.h>

// Transmitter test program


void main() {
TRISC = 0x00 ; //portC as output
	SPBRG = 129;	// Set the baud rate to 2.4k
	BRGH = 1;		// Set high baud rate 
	SYNC = 0;		// Set asynchronous 
	SPEN = 1;		// Enable serial port pins 
	TX9 = 0;		// Disable 9 bit transmission 
	TXIE = 0;		// Disable tx interrupts 
	RCIE = 0;		// Disable rx interrupts 
	TXEN = 1;		// Enable the transmitter

	while(1) {
		while(!TXIF) {	// Checks if the transmit flag is down 
			continue;
		}
		TXREG = 0b01010101;
	}
}

I just need to send this "0b01010101" to my PC
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top