IR Infrared Serial Link

julianE

Senior Member
For my Volume Control project I would like to use infrared but not in the usual sense with sending codes using remote control unit. What I would like to do is establish a serial connection with the picaxe but instead of using RF modules do it using IR LED and IR receiver.
I did some googling and found this. I'm thinking to generate the 38KHz pulse it would be easiest to do with a schmitt trigger inverter oscillator or a 555 timer and use the picaxe uart to control the LED.
Has anyone already tried it, will it work with a picaxe?
As far as speed, even 300 baud is ample and the control distance would be 3 meters at most.
 

Buzby

Senior Member
There have been a few posts about exactly this task. This is the only post I could find, but there are others ... https://picaxeforum.co.uk/threads/ir-telemetry.6323

The simplest way to generate 38Khz is with PWM, which is then ANDed with serial data.
( If the IR LED current is less than about 20mA, then the LED can be wired directly between PWM pin and serial out pin, a zero parts solution ! )
 

hippy

Ex-Staff (retired)
As Buzby suggests, using PWM ANDed with Serial is an easy way to do it -
Code:
           |    ___
Serial Out |---|___|---.
           |          _|_
           |         _\ /_  ->
           |           |
   PWM Out |-----------'
The problem there is that it can be quite low power and have only a short range. It is possible to reduce the resistor value, violate the current specifications, over-draw current for short periods of time, but it's of course not recommended and could damage the PICAXE if the Serial Out is ever set to permanently high or for some prolonged period.

To drive higher currents it's best to use a transistor or FET driver, but the problem then is that the ANDing has to be done in hardware.

That can sometimes be done with discrete components -
Code:
                       ___
               5V  ---|___|---.
                             _|_
                            _\ /_  ->
                              |
           |    ___        |--'
Serial Out |---|___|---.---|
           |           |   |--.
   PWM Out |----|<|----'      |
           |                 _|_ 0V
But, if using an M2 chip which has an on-chip Data Signal Modulator peripheral, that can perform an actual AND on-board -

https://picaxeforum.co.uk/threads/how-fast-can-can-i-transfer-4096-bytes-between-two-picaxes-using-ir.21531/#post-208587

Code:
                       ___
               5V  ---|___|---.
                             _|_
                            _\ /_  ->
                              |
           |    ___        |--'
   DSM Out |---|___|-------|
           |               |--.
                             _|_ 0V
 

erco

Senior Member
Of course, rather than go for serial - One could simply use IROUT and IRIN.
If you're open to creative solutions, I have sent IR commands over a simple 433 MHz radio link.

 

julianE

Senior Member
As Buzby suggests, using PWM ANDed with Serial is an easy way to do it -
I had a chance to work on it today before i read your comments. works great, used a 220 ohm resistor in series with the IR LED. have not tested the range i have them on same breadboard now. it works even if i place a sheet of paper between the led and the receiver. i will test the range tomorrow, i'm not opposed to using transistors. I'll read the link you mentioned as well.

thanks everyone for all the help. i'll have many more questions as i keep working on this project.
 

julianE

Senior Member
tested the range today, half a meter at best and that's with the IR Led and receiver aligned. I'm using a single LiPo cell so around 4V and I lowered the resistance to 80 ohms from 220 ohms. Looks like I'll need a transistor driver to boost current, I might have a MOSFET that triggers under 3 volts.
It's not looking very promising, might have to use the IRIN and a remote control.
 

Buzby

Senior Member
There are a few variables that affect the transmission distance.

Obviously the LED current is one, and a transistor circuit is the best answer to that. ( However, I got a good few metres by using no resistor ! )

A less obvious variable is the 38Khz frequency. I found in my experiments that I neeeded a slightly higher frequency to get the maximum distance. I have no idea why. It could have been that I was using a receiver with a different response curve, it did come out of my bits box.

Dropping the baud rate also increased the range.

Keep at it, it will work.

Cheers,

Buzby
 

mikeyBoo

Senior Member
hi Julian, The attached pdf is from an old 805x project that sends/receives IR & X10 codes. It's been working a long time so I guess the design is sound. Maybe you can use the portion that shows the IR transmit & receive for your project. Good luck!
 

Attachments

kfjl

Member
The carrier wave frequency for a Sony remote is 40Khz, not 38. That would explain why Buzby got better range using a "slightly higher" frequency.
 

hippy

Ex-Staff (retired)
Looks like I'll need a transistor driver to boost current
Boosting current will help and one can even reduce the resistor beyond what it would be recommended to be without the LED melting, though it might if an output pin gets left in an inappropriate state.

Adding parallel and/or serial LED's can also help but your limit will likely be restrained by voltage.

There are two ways round that; either generate a higher voltage than the supply, and that can be done by a PICAXE but I don't know with what current sourcing capabilities, or use a higher supply to drive the LED with a regulator to supply the PICAXE.
 

Tvmender

Active member
I use a constant current driver in my laser tag system and get good range from a single IR led. I can't remember the part number at the moment but I'll post it later.

 

inglewoodpete

Senior Member
I recently used a couple of 5mm IR LEDs in parallel. They each had a maximum forward current of 50mA (Vf was 1.2v), which is more current than the average 5mm LED and more than you can get from a PIC pin. As long as they are 'idle off' and you do not pound them 100% of the time, they should not overheat.
 

julianE

Senior Member
I have some good news. Used an NPN transistor, 2N3904 and the diode mixing circuit hippy suggested. For the base resistor going to serial I used 220 ohms and the collector resistor is a 15 ohm. If aimed well I got 2 meters of range a large improvement over what I had without the transistor.
I will try all the suggestions posted and once it all works will draw up a schematic. Honestly, I'm surprised it worked at all with just guessing at the resistor values and the simple diode mixer.
Next step is to increase the PWM frequency and to add another IR LED in parallel, will also try it with a slower baud rate. If I can get a reliable communication at 4 meters I will call it a success. BTW, I'm using IR LEDs i got on ebay I also have some premium IR LEDs to try.

As always, thank you.
 
Top