Pic2Pic light wave communication

JBrookes

Member
It would be possible to communicate via light sequences of pulses - What I am interested in is is to have 4 receivers, and a receiver "knows" what its unique pattern is.
This is similar to a remote TV control, and as well spread spectrum algorithms.
Has anyone implemented this in a Picaxe?

I am foggy how the receiver achieves alignment...This would be a "start" sequence sent out by the transmitter...Obviously a cyclical code, just not sure how to code it..
As well, the receiver would have to measure time delay between pulses...

Any idea?

Thanks in advance.
JB
 

eggdweather

Senior Member
You can use the standard serial output as your signal source, just get that to modulate (switch on/off) an infrared LED and have a IR receiver LED at each station. Then devise a communications protocol, perhaps:
Send a communications start series of bytes, perhaps "AAA", and then add a device ID / Address such as "001" so each listener would only respond to the correct address.
Then send your data and perhaps keep repeating that for a given amount of times.
Your listening PICAXE would then be programmed to listen for AAA001 if it was the first device, after reception it would then act on the data, there are commands in the PICAXE to do all of this: Check out the SERIN command:

The command serin 1,N2400,("AAA001"),b1 requires to receive the string "AAA001" before the next byte read is put into byte b1. - See more at: http://www.picaxe.com/BASIC-Commands/Serial-RS232-Interfacing/serin/#sthash.JZb00ZVl.dpuf

The hardest thing to do is switch on/off the IR LED, range will be about 5-8Metres maximum I guess. Lasers are an option too. These modules makes things really easy:
http://www.ebay.co.uk/itm/Digital-38KHz-Infrared-IR-Sensor-Transmitter-Kit-for-Arduino-Remote-Control-New-/111681233223?hash=item1a00b86147

The PICAXE does have 38KHz commands too.

Worth a quick read of this: https://learn.sparkfun.com/tutorials/ir-communication

Regarding reception by more than one device, you could either sequentially go through all transmissions for all receivers, perhaps channel-1,2,3,4 then repeat or only send data when it's needed, or perhaps send the sequences in a random way, all have their pros/cons. Of course optical alignment will be necessary and expect a beam width of ~5-degrees and you may get communications from reflections off a wall etc.
 

westaust55

Moderator
Although now somewhat old you may find it worth having a read through my IR comms tutorial here:
http://www.picaxeforum.co.uk/showthread.php?17303-Infrared-(IR)-Communications-Basic-Tutorial

Since that was written, the IRIn and IROut commands have been added to newer PICAXE parts however the concepts are unchanged.

In another thread on this forum hippy explains why "UUUUU" rather than some other sequence is best as a preamble immediately prior to the qualifier and data transmission.
 

JBrookes

Member
Thanks for all the good links. An interesting angle on all this is the SNR-boosting technique of lock-in amplifiers. In one simple embodiment, a digital code is expected by the receiver. It then
compares the signal strength between expected 1's and 0's. The transmitter is sending such a coded sequence. Using this type of SNR-boosting, messages are routinely bounced off the moon and received back on earth. The implementation in a picaxe (I'm no expert on that) would presumably involve a high speed assessment of signal strength along a time-line, with simple pattern matching. A transimpedance amplifier and photodiode can go fast enough, but high-speed storage of values I have no immediate idea about. ? On further reflection, high speed may not be necessary, as the algorithm doesn't depend on apeed. The lock-in could conceivably take say 3 seconds rather than millisecs. But exact implementation with a picaxe seems more than a minor issue, if you get my point. Anyone have a handle on this?
 
Top