programming via IR link

Roughly 1 or 2 month ago somebody asked for more information regarding programming the chips 08 etc via IR communication. I was working on the same issue. Finally a found a working low cost solution. So if someone is interrested in this issue, let it know. Next week I am on holiday and the laptop stays home so my reply will be after next week.


Senior Member
"Cubum autem in duos cubos, aut quadrato-quadratum in duos quadrato-quadratos, et generaliter nullam in infinitum ultra quadratum potestatem in duos eiusdem nominis fas est dividere cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet".

In other words -Yes Please!!! To avoid a repeat of Fermat's last theorem (Latin comments he pencilled in the margins were never then taken further <A href='http:/// ' Target=_Blank>External Web Link</a>),I for one suggest you spill the beans ( &quot;beams&quot; ?) for us now ! Stan
The issue is simple if you know why things won't work. At a speed of 2400Baud the bittime is 417 usec ( check wipikedia subject RS 232 for more details). The TSOP reciever which I use (vendor Vishay) worked on 40Khz that gives a pulstime of 25 usec. The IR receiver needs at least 13 pulses for a stabilized output, thus it takes 13 x 25= 325 usec. This is well within the timeframe limit of 2400 Baud bittime of 407 usec.
At a rate of 4800 Baud ( programspeed of the 08 etc) the bittime is 207 usec. Therefore the 40 Khz IR link doesn't work.
Remedy increase the carrierfrequency of the IR communication channel. The vendor Vishay manufactures the TSOP 7000 IR receiver which work on a carrier frequency of 455 kHz. This equals a time of 2 usec, 13 cycles are required, thus this makes a time of 26 usec. This is well within the 208 usec needed for 4800 Baud.
I build one set (= receiver and a IR transmitter on 455 kHz) The receiveroutput needs to be inverted ( use a NAND). The oscillator is build with two NAND's 74HCT00 followed by a BC547 transistor which drives the IR diode. I test the circuit in the Rx en Tx channel ( pin 2 and 7 on a 08M). A complete systeem, that is a two way communication LINK, will be build after the next week. I will check this Topic after my short holiday so if you encouter a showstopper write it down and I will try to guide you trough it.
The parts I use are:

IR receiver TSOP 7000 vendor Vishay
IR high speed diode TSHF 5410 vendor Vishay or
HSDL 4220 vendor Avago Techno;ogies( not tested yet)

OK succes with finding the parts or equivalent and enjoy the victory.


Technical Support
Staff member
Many thanks for the explanation. Basically the IR receiver is too slow in responding, thus delaying the received data stream so it is corrupted when read, or missing short transmissions altogether. The delay with the faster modulated IR Receiver is much shorter, allowing the PICAXE to recover the data stream without corruption.

And a picture is always worth a thousand words, but's here some Asciii-Art instead ...<code><pre><font size=2 face='Courier'>Transmitter

1 0 1 0 0 1 1 0 = %01100101
Start 0 1 2 3 4 5 6 7 Stop
.-----. .-----. .-----.-----. .-----.
___| |_____| |_____| |_____._____| |_____.___


.-. .-. .-------. .-.
_______| |_________| |_________| |_______________| |_________
1 1 1 0 1 1 1 1 = %11110111

.---. .---. .---------. .---.
_____| |_______| |_______| |_____________| |_________
1 0 1 0 0 1 1 0 = %01100101 </font></pre></code>

Edited by - hippy on 17/08/2007 19:23:02
I gotta say I'm dead impressed that it works.
When I 'scoped the PC connection some time ago the initial 'high' from PC-&gt;AXE initiated a brief pulse train from AXE-&gt;PC.
These signals overlapped time-wise so I gave up the idea as there would be 2 IR signals overlapping.
But apparently this doesn't matter. Excellent.
Sorry, can't do drawing.


Senior Member
Great stuff! I'd never considered IR beyond 40 kHz either,but see these 455kHz units have been around since 2001 (i.e PRE Picaxe)! Wonder if that freq. relates to the classic superhet. AM radio 455 kHz IF?


Technical Support
Staff member
Dippy : <i>When I 'scoped the PC connection some time ago the initial ... signals overlapped time-wise so I gave up the idea as there would be 2 IR signals overlapping. </i>

That is a problem with radio or any common carrier medium, but if the two IR signals can be isolated enough from each other so they only see the other's signal then it should all work. I believe someone ( apologies for forgetting who ) did download working with I think normal non-modulated IR over a short range so it's still in with a good chance.

I look forward to hearing from janh when the full bi-directional link is up and running.
Absolutement hippy. My point exactly.

I was under the impression that this was an 'across the room' programming link rather than an opto-isolator.
If it's just an inch or two I can't see the point of modulating.

If it can go a few metres then fan-dabby-doody me laddio! (Sorry, just been watching Red Dwarf again!)

Perhaps they are moving higher in IR carriers to make interactive remote controls - push a button and the remote screen lights up with additional data (graphics) - or just moving higher to stay out of the compact fluorescent lamp ranges and reduce interference.

Dunno if it has anything to do with the 455 KHZ I.F. of the classical superhet AM radio, but look at all the cool stuff that could be used. AM radio chips usually have a pin for the I.F. output with the intent that a ceramic resonator be used for a bandpass filter. Which suggests to me, that it would be painfully simple to adapt a 455 IR to something like IR headphones using AM radio stuff. Or just using it as a gain stage, and demodulator for IR data.

Then there's the 455 ceramic resonators - could be used for bandpass filters and oscillator frequency standards for send and receive IR.

Easy to adapt to tone signaling and audio.

Thanks for the info.

And using it as an easy way to wirelessly reprogram picaxes . . . great.

Will you publish/post your schematics too? or some links where you gleaned this info?

<A href=';forum_id=31&amp;Topic_Title=Programming%2Bvia%2Ban%2BIR%2BLink%2B%253F&amp;forum_title=PICAXE+Forum' Target=_Blank>External Web Link</a>;forum_id=31&amp;Topic_Title=Programming%2Bvia%2Ban%2BIR%2BLink%2B%253F&amp;forum_title=PICAXE+Forum
I just came home from my short holiday. Have nice ideas so the wintertime will be stuffed with experiments. This week I try to esthablis a bidirectional LINK and my target to catch is a distance of at least 6 meters. Uh that is 20 feet ( for the overseas boys who are not familiar with teh metric system)
Here some facts of the battle zone. It was hot there and the air was full of hot radiation :)-). Nevertheless victory was mine. Of course the working test-setup is far from a usable product. Hippy you make a comment about segregation ( isolation) of the two IR paths. You'r vision ( expertise!!) is absolute correct. I 'chamber ' the diode which is not a problem because the angle is +/- 10 degree. Yes for a real transmitter it is small but for the experiment sufficient. The segregation is roughly 20 centimeters (= 8 inches) and an additional paperscreen was placed between the two LINKS because I didn't chamber the receivers yet. The transmit distance is also 8 inches. It seems that the receivers are less sensitive than the 38kHz version ( I can not measure it so it is just a feeling). Also I noticed some echo responses on the receiver, so I assume that increasing to a distance of approx. 20 feet will give an extra tension on the segregation issue. So that was a brief follow-up and now back to the lab.


Technical Support
Staff member
Thanks for the update. I'm wondering if there's any advantage to be had in having the receiver and transmitter isolated in tubes of different lengths ...<code><pre><font size=2 face='Courier'> --------------------------
|) --&gt; IR out
|) &lt;-- IR in
-------- </font></pre></code> This would limit the transmission from bleeding into the receiver but does nothing to help with reflections. This might be a compromise between full-on channel separation and compactness.


Senior Member
Surely narrow &amp; channeled IR beams will hinder their &quot;wireless&quot; benefits? As the usual IR broadcast is versatile enough to bounce off ceilings &amp; windows etc,I've visions hence of point &amp; shoot links being required. If this is the case then laser pointers,rather than IR, may be more feasible. Stan
I'm wondering if filtering may be worth a go, you could try 1 x IR &amp; 1 x UV Ch.
Either way any crosstalk between chanels is going to give you problems. LASER would be a better option over 20 feet or so, I'd still use a few inches of separation tho.


Senior Member
How about disabling the RX while transmitting and disabling the TX while receiving. Add a bit of handshaking and Robert just might marry your aunt.


Technical Support
Staff member
For PICAXE download one doesn't get the option of disabling receive while transmitting; that's the big problem to overcome with IR downloading if simply converting RS232 to IR.

The initial wake-up for download signal to the PICAXE is the TX line put high and kept high ( an RS232 'break' signal ) until the PICAXE has responded. You don't know when the PICAXE will see the signal or respond, so cannot turn it off before it does respond.

This is also what stops download over wireless on a bi-directional single frequency / channel.

To make it work one would need to send just a momentary signal to indicate the start of 'break' and the PICAXE being downloaded to would need something at its end which kept its Serial In high until told the 'break' was over. It rapidly becomes complicated.


Senior Member
Boriz: Bravo! &quot;Bob's your uncle&quot;,a commonly used expression in Britain and Commonwealth countries, means &quot; You can't fail&quot;, but &quot;Robert marries your Aunt&quot; is a superbly colourful variation.

Who says electronics is just for geeks.
Aha, so the miracle link hasn't occurred then.

Tubes and lasers? Oh dear. Not exactly point'n'shoot. Perhaps the answer lies with PICAXE-PIC &gt;&gt;&gt; PIC-PICAXE. Quite feasible I'm sure, but it's time...

Edited by - dippy on 01/09/2007 13:53:38
The replies seem to me progressing in a very english idiom in which I am not trained very well, I'm afraid. But what I pick up from the discussion is that a narrow beam seems to be a disadvantage or make the IR project not very usefull.

The sole purpose of tubing the diode is to reduce spourious IR emission in all NOT wanted directions. It has nothing to do with focussing of the IR beam.
I am busy in an investigation to the possibility to run a channel on a dfferent frequency, say 200kHz or something like that. I that case the 'isolation' should improve. For the calculators in this issue there is a 75kHz receiver on the market. As far as my analyses is OK it shows that it is on the edge but 10% safeguard is may be sufficient.
Those who think that this IR link is just a optocoupler, I advise to read the spec's. A distance of 9 to 15 meter is given if the IR LED is powered sufficiently( Id=300mA in case of the TSOP 7400). So I'll be strong and carry on.
Please continue with the project janh. It sounds great.

My comments are simply this:
1. Lasers I'm sure would work but the 'link' would be very, very directional.
2. Tubes and baffles will help obviously but there's no avoiding that there is a signal overlap at the start. If any of the beam from the PC end reflects back to your PC receiver then it'll mess up. I'm sure lenses would help.
3. Running your 2 beams at different modulation frequencies may improve things but if you're using standard IR then your carrier is the same. So, any unwanted reflection may (repeat 'may') upset things a bit.

Having said all that I'm sure you'll get it to work albeit very directional. It's just that when this thread started I assumed you were making a link that could programme PICAXE when aimed in the general direction like a TV remote control. A buffered PIC inerface that I mentioned could do that with IR and radio.

Get it to work and you'll get a lot of Brownie Points - sorry for the English idiom :)
Just brainstorming here, but a pulse of infrared light is the same as visible light - once a led is on and is illuminating the room then any other led that comes on is going to cause interference. One could use different frequencies, as in different light frequencies - eg transmit in infrared and receive, say, in green.

But transmitting on different carrier frequencies with the same infrared colour is not going to work.

One could think of more complex code systems - eg run the IR at 1Mhz - transmit a high as 2 brief 1us pulses and a low as 3 pulses. When a receiver detects pulses coming in it disables that device's transmitter for a brief time. The second transmitter could use 4 pulses and 5 pulses for its code. Almost all the time there are no pulses being sent. Some sort of very fast pic (too fast for a picaxe) decodes these pulses and turns them into RS232 signals.

This is all extremely complicated though. It would need error correction as well in case a byte didn't go through.

Perhaps one could use IR for Tx and radio for Rx?
Your first 2 paras were exactly what I was on about.

I didn't quite follow your 3rd para but I would envisage a PIC that emulates the PICAXE download stuffing the code onto flash, then sends to a second PIC via IR/RF (maybe Manchestered) storing it onto Flash, then the second PIC emulates the PC download 'conversation' to the PICAXE. Not very fast but there wouldn't be any carrier overlap.
Job done and Robert would be your cousin's Dad. It wouldn't infringe any firmware rights as you simply copying bytes blind.

I'm sure the lads at Rev-Ed could do this easily but is it worth the effort for half a dozen customers?


Technical Support
Staff member
Dippy : That's similar to how PICAXE.Net is used to program a remote PICAXE at the .Net end. It's also similar to how I tried to get wireless downloading to work through XBee, although I tried to do that live, one byte at a time, rather than by buffering.

Rev-Ed could add an extra layer to the download protocol ( using two bytes sent instead of one with the first simply indicating if 'break' were present or not ) which would mean just needing a simple interface at the PICAXE Serial In end ( which could perhaps be an 08M ). That would simplify wireless and IR download, but I do not expect it's going to be on the cards any time soon as it's an esoteric problem which most people have no need to solve. Plus there are all the other 'problems' which it introduces.

My XBee attempt was to take the actual serial stream and create the extra prefix byte. It wasn't a total success but did show some promise.

For anyone not quite following the plot, I have thought of a real world analogy ( and it doesn't necessarily involve Marx ! ) ...

You go to a house and ring the door bell. You cannot hear the person shouting back because the door bell drowns them out, but you have to keep ringing the door bell until they respond, because you will disappear in a puff of smoke as soon as you stop doing so if you haven't heard a response.

What's needed is a means to just knock once on the door so the knocker can hear the subsequent response. But the home owner will not respond back until they hear the door bell ringing. What's needed is a door knock detector which makes the home owner think the doorbell is ringing when the knock occurs ( and some means of stopping the home owner thinking that if the knocker does unexpectedly disappear in a puff of smoke ).

Plus some means of converting what would have been a door bell push from the caller into a single door knock to start with. <code><pre><font size=2 face='Courier'> Mr Marx the Door bell A door Door knock to Mr Engles
door bell to door knocker fake door the responder
pusher knock converter bell ringer
.-------. .-------. | .-^-.
O | | -.- | | | (| O |)
-|- C|------| |-----&gt; O &gt;-----| |-----' -|-
/ \ | | | | / \
`-------' `-------'
/|\ |
Response </font></pre></code> ( yes, it is fun in my 'own little world' ).


Senior Member
Just an idea to improve the IR link. This should be able to receive from any angle within 180 deg and transmit much further with a tighter beam. Also elliminates local feedback.

<A href='' Target=_Blank>External Web Link</a>

Edited by - boriz on 02/09/2007 21:04:50