Go Down

Topic: Bi-Directional InfraRed Transceiver (Read 1 time) previous topic - next topic


How the idea come
I developed this IrTransceiver because I have many micro controller automation projects (as swimming pool pump controller, electric motor PF corrector, garden light intensity and schedule controller etc) which by size imposed and/or by the fact that are galvanic connected to mains don't allow a embedded terminal but still I wanted to be able to read internal measured values and to change parameters.
I tried to find a cheap interface, reliable, small, wireless and electric noise proof to connect this devices occasionally or permanently to a terminal.

In what consists the solution
For the application, this IrTransceiver is like a black box, with a I2C interface and a set of commands for sending or receiving data on request. Besides sending/receiving data I implemented a set of other useful commands.
The IrTransceivers connects one to each other by infrared, data and commands being sent both ways completely transparent for the microcontrollers.
When transfers are ready, bots sender and beneficiary of data are informed in polling or by hardware interrupts.

Basic configuration and basic operation
The basic configuration consists of a master micro controller connected by I2C to a master IrTransceiver which will be wireless linked to a slave microcontroller connected by I2C to a slave IrTransceiver.
Once given a command by master micro controller, let's say to send a data stream of 32 bytes over Infra Red connection to the slave controller, the master IrTransceiver contacts the slave IrTransceiver by Infra Red.
The protocol of communication between the 2 IrTransceivers is transparrent to both microcontrollers, but is bulletproof reliable and data is sent and verifyed at destination by IrTransceiver being packed with a 16bit CRC checksum.
After safely receiving the data stream the slave IrTransceiver informs the slave microcontroller of it's availability. This is done by setting a specific flag in STATUS register, or/and by hardware interrupt.
The slave microcontroller then reads the data stream through I2C. The master IrTransceiver is informed about data being received by slave IrTransceiver and about it being read. It informs the master microcontroller of data delivery by setting a specific bit in STATUS register or/and by hardware interrupt.

Network capabilities
The IrTransceivers can be assigned with an internal address for the IR network. One network consist of one master with address 0 and 1 up to 31 slaves, being assigned with addresses from 1 to 31.
Each data or command transfer is initiated by master and is dedicated to one specific IR peer.

Data integrity
I build this transceiver for industrial control so the integrity of data sent and received was a must.
Transceivers pack every stream bay 16bit CRC and confirm data transfer only when it's integrity is verified.
Because I2C communication doesn't have a data integrity check, a 8bit CRC checksum can be optionally set for all transfers over I2C between microcontroller and IrTransceiver.
This ensures that any data transfers between microcontrollers through this interface is undistorted.

PCB size of IrTransceiver is 35x29mm. On short size a 6pin header is present.
Thea header pins are +5V, GND, SCL, SDA, /INT, /RESET.
One side is equipped with the IR receiver and transmitter and must be visually in contact with other transceiver/s.

I tested the connection inside, it is working perfect at 10m which was more than I expected.
Due to wall reflections in one 5mx5m room it works doesn't matter of the direction the transmitter/receiver is aimed.

Being a Infra Red connection it doesn't interfere with any radio communication as GSM or wireless radio remotes, and what is the most important is imune to electric noise made by big electric motors or relays or whatever.
Being a custom protocol it cannot interfere with domestic IR remotes as TV, VCR etc remotes.

The goal of this project was reliability and data integrity and then the speed. The communication between IrTransceivers works at 2400bps. Due to CRC, protocol headers, acknowledges, retries the real data speed transfer varies. The best in good aim position between transceivers is about 1800bps.
It is not intended to transfer photo or video streams, but critical industrial data and parameters.

I use this IrTransceiver since 2013 when it was operational.

More about I2C protocol between microcontroller and IrTransceiver here:


What is IrTransceiver

IrTransceiver is a module designed to connect 2 or more microcontroller based systems by infrared.
It is an intelligent transceiver designed to carry the task to perform a reliable connection, the protocol being transparent for the microcontrollers interconnected.
IrTransceiver communication is performed both ways between a master IrTransceiver and one or more slave IrTransceivers.
On the microcontroller side it has a I2C interface with a set of specific commands. Using this commands the master microcontroller connected by I2C to the master IrTransceiver can initiate data transfers in both directions to/from slave microcontrollers connected to slave IrTransceivers.
All the communication protocol is implemented inside IrTransceiver, including packing transferred data with 16bit CRC checksum and verifying data integrity at destination.

A typical send data communication session

   1) Master microcontroller activity:
   - master microcontroller check by I2C if IrTransceiver is ready by reading its STATUS register
   - the microcontroller uploads by I2C the stream of data to be transferred, the address of the destination IrTransceiver and the memory address where the data will be loaded by the destination microcontroller
   - master microcontroller initiates the transfer by setting a bit in IrTransceiver STATUS register
   2) IrTransceiver activity
   - master IrTransceiver contacts the slave IrTransceiver set as destination of data stream, transferring the data packed with 16bit CRC checksum (In fact all the protocol of communication between IrTransceivers uses 16bit CRC)


 - slave IrTransceiver verifyes the CRC and confirm the reception of data

 - if any error occurs the transfer is repeated till good completion (this is a simplification)

 - having received the data stream the slave transceiver notifies the slave microcontroller about it. This is done at choice by hardware interrupt or by setting a bit in STATUS register to be polled.

3) Slave microcontroller activity

 - reads STATUS of slave IrTransceiver to see the nature of request (in this example, data received)

 - reads the stream of data from IrTransceiver and loads it on the directed destination memory address

 - confirms data read by clearing the appropriate IrTransceiver STATUS bit

4) IrTransceiver activity

 - slave IrTransceiver informs master IrTransceiver about data being delivered to the destination microcontroller

 - master IrTransceiver notifyes the master microcontroller about data being delivered, by hardware interrupt or setting a bit in STATUS register

5) Master microcontroller activity

 - reads status to see if transfer is completed without errors

 - initiate next transfer


Great project!

By the way, could you share some more details, like schematics, components, etc.? Is your project sort of open-source or shareable?

Go Up