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.

Best way to do IR communication...

Status
Not open for further replies.

Marks256

New Member
What would be the best way to communicate via IR (infrared) between two microcontrollers(basic stamps, or a computer)? I am talking more along the software side of things...

For those of you that need to know exactly what i am doing; I have an old 486 Compaq Laptop, and a tower server. I want to connect the two via infrared for simple data transfer (text files, maybe some data from the internet)

First off, how should the signal be sent? if pulses are sent out, wouldn't the room lighting "confuse" the receiver? I really know nothing about wireless data transfer, so this is new to me.

Second, how should the receiver algorithm be setup? I am guessing that there would be quite a few errors in the transmission(s) due to random sources of infrared, so how should the algorithm be made to compensate for these errors?
Also, what about CPU processing power? I don't like the idea of the CPU being bogged down continuously searching for a signal that may not be there for a long time... I am not worried about the laptop, for it will be running MS-DOS, but the server will be running windows (xp or 2k, probably xp), so the server can not be bogged down too much (i guess the algorithm could be put into a thread, just so it doesn't kill the CPU)



if none of this makes sense right now, i am sorry. :) It is late, i am tired, and i am sure there are a few things in this text that do not make sense, so, bare with me, i will try to fix it up a bit tomorrow. ;)
 
The only way to get descent transmissions speeds is to use a non-modulated IR signal. Just use a basic IRDA protocol, all they do is send the raw serial data over IR. You can use software flow control to help prevent false triggering (most of the time) and a basic data frame format with CRC information. For example, send a pre-amble byte (Capitol letter U is a good choice as using an 8N1 serial protocol this outputs a transistion at every clock which gives you a very good indication of reception at a given bit rate) followed by a pair of bytes that say how many data bytes are to follow, then the data packet itself, then a couple CRC bytes. Parsing this is almost trivial on a PC end.

Even the highest of high speed serial transmissions isn't going to bog down a computer very much even if it's constantly parsing a stream full of garbage, as long as the code for it is relativly clean. There are plenty of communication protocols for sending data over serial streams like this, a common one being Xmodem which handles all the details for you.
 
Last edited:
I would suggest that you go in for two Infrared ports connected to each computer. They are very cheap and are freely available in the market. The popular and cheap ones are Kingston ports. They have drivers available. If you can install the basic version of XP on the 486, you can get both your computers to transfer data.
 
I agree with Nigel.

Just network the computers. They will work faster and the transfer rates are more than the IR anyway.

WiFi may be a bit too expensive (considering the fact that you hv not yet upgraded / got rid of ur old 486) but u could use ethernet cards use crossover cat 5/6 cables
 
If you can install the basic version of XP on the 486, you can get both your computers to transfer data.

Can't. The laptop doesn't have a hard drive! :) I boot from floppy...

Why not just network the two computers?, use wireless WiFi if you don't wnat a wire - far more effective, and dead simple to do.

I agree, but like i said, the laptop will be running DOS, and it doesn't have a hard drive... I really don't feel like writing my own software for wireless in dos... :s

WiFi may be a bit too expensive (considering the fact that you hv not yet upgraded / got rid of ur old 486)

Actually, i did upgrade... 2 years ago... I got the compaq on ebay for like $20 for projects and what-not. This laptop is the oldest [running] machine i own...


I was thinking about just using a PDA with wireless in it, but i think the Compaq would be geekier... :) Another thing i was thinking of doing is getting ahold of a Parallax Ethernet module. That way i could network them, but i think IR would be more cost effective. ;)


So just making a simple IrDA device for both computers would be the best bet? Correct me if i am wrong, but i don't think IrDA can go farther than a few inches away... i need to be able to transfer data from about 10-15 feet away (15 is pushing it, by the way). Would an amplifier and a large array of IR LEDs boost the distance?
 
There seems very little point in what you're looking at doing, and a 486 floppy only machine is a serious waste of time these days, and not worth connecting to another machine - like many users here I've thrown out many perfectly working Pentium machines, complete with hard drives. I'm sure you can find loads of MUCH better machines thrown out in your local area.
 
i agree with nigel.

if u put in a price tag on your time and relate it to the time that you may spend on this project, it would be well worth 100 times the cost of the 486.

my advice to you would be to just forget about the 486 and look at a new ebay option where you can load XP and use the ethernet ports and network.
 
No. What i want to do is make an automated room. Now that my programming skills have gotten better, i plan on having voice recognition built into the room, voice synthesis, the central server (acting as a TV, planner, AI, and communications center), and maybe a LED display for data, and maybe a few other odds and ends.

I want to use my Compaq due to it's simplicity, and it's four-hour battery life. The main function of the laptop would be to act as a portable "terminal" within my room. It would allow the user to tweak settings on the server, schedule tv programs to be recorded, and act as an interface to the planner.
Yes, i know that using the 486 will be inefficient, especially since i already have a brand new Gateway laptop running at 1.3GHz with wireless networking and Windows XP pro, but i want to use the 486 just for the shear thrill of it. Now may i please get some help, instead of the usual attempt at trying to talk me out of doing my idea?


Now, if someone would answer my question; would an amplifier boost the range of IrDA?
 
Note that I've never tried this, but this fellow lists a couple of DOS IR drivers which you might be able to use and/or modify.

http://www.mbudde.de/mp3player/mp3_download_eng.htm

You'll have to scroll down a bit to find the drivers.

If you're willing to try Linux instead of DOS, the whole thing should become easier, since everything has pretty much been done for you:

http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/

Another site a quick googling turned up:

**broken link removed**

Looks to have quite a bit of discussion, including circuits and info on Window/DOS software for IR remote control.

Again, I haven't tried any of these things, but it does look like fun. And I too have a stack of old machines in the corner which every so often get turned into appliances (usually routers or firewalls) and then retired again when I get sick of the roar of old fans. :)

Hm. The amplifier question I'm not sure on. At some point you're going to hit the limit of what your IR LED can pump out. Maybe use a few IR LEDS on the transmitter? Repeaters are also possible (at least, they're on the market) but I have no idea how tough it might be to make one.

Anyway, just some thoughts. Use or discard as appropriate. :)


Torben
 
No. What i want to do is make an automated room. Now that my programming skills have gotten better, i plan on having voice recognition built into the room, voice synthesis, the central server (acting as a TV, planner, AI, and communications center), and maybe a LED display for data, and maybe a few other odds and ends.

C'mon get Real !
 
I settled for the following two devices from digikey for my IR project;
QED233-ND LED IR EMITTING ALGAAS 940NM 5MM
PNA4602M-ND PHOTO IC INFRARED 38.0KHZ

The first is the emitter, 940nm wavelength

The second is a logic IR reciever that will provide a logic (5V or 0V) depending if a modulated signal is present.

Modulating the signal would be pie with TMR2 on any PIC. Just set up the pre/post scalers and PR2, then with a single command you can turn the modulated signal on/off, perhaps leading to USART coms - dunno yet, I'll let you know how I go
 
Please be aware that you can't just do standard RS232 type comms via such an IR link, as the pulse width coming out of the IR receiver isn't the same as that from the transmitter - and even more so if you're using a timer to generate the 38KHz, because you don't have as accurate control over the width of the pulse as you do in software.
 
But you know I'm doing it the PIC Basic way :p

From the Swordfish help file;

function Encode(pValue as byte) as word
Takes a byte value and returns 16 bit (word) Manchester encoded number.


function Decode(pEncodedValue as word, byref pDecodedValue as byte) as boolean
Decodes a Manchester encoded number. Returns true if the number has been decoded successfully, false otherwise.​
 
Torben said:
Note that I've never tried this, but this fellow lists a couple of DOS IR drivers which you might be able to use and/or modify.

http://www.mbudde.de/mp3player/mp3_download_eng.htm

You'll have to scroll down a bit to find the drivers.

If you're willing to try Linux instead of DOS, the whole thing should become easier, since everything has pretty much been done for you:

http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/

Another site a quick googling turned up:

**broken link removed**

Looks to have quite a bit of discussion, including circuits and info on Window/DOS software for IR remote control.

Again, I haven't tried any of these things, but it does look like fun. And I too have a stack of old machines in the corner which every so often get turned into appliances (usually routers or firewalls) and then retired again when I get sick of the roar of old fans.

Hm. The amplifier question I'm not sure on. At some point you're going to hit the limit of what your IR LED can pump out. Maybe use a few IR LEDS on the transmitter? Repeaters are also possible (at least, they're on the market) but I have no idea how tough it might be to make one.

Anyway, just some thoughts. Use or discard as appropriate.


Torben

Thanks for the info. I did find the last link on my own a while back. I was thinking of something like that, but it really don't want to have to use a remote control... Even if i had to hack it to get it connected to the parallel port... :)



Brevor said:
C'mon get Real !

Who are you to judge what i can and cannot do?









Ok, so maybe IR is not a good idea? Then what else would prove to be a good way of wireless transmission?
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top