< async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"">

Friday, February 7, 2014

IR blasters - All you need to know about infrared remotes and ir extenders [for DIYers]

ADVERTISEMENT
IR blaster or Infrared blaster is the term used for a wide range of products which can send infrared remote commands to a wide range of equipment like television sets, Satellite receivers, Set-top boxes, HVAC, projects etc. This can range from simple infrared extenders to control the devices hidden in a cupboard or in a different room to smart devices which can turn on the recording system or air-conditioner at specified times or via internet. Here is a simple guide to help you deal with infrared remote controls in a smart setting. A small over view of the function is given below

IR blaster and Infrared Extender basics (click to enlarge)

Basically an ir blaster or extender needs the following

  • An Infrared Sensor which detects the infrared signals from various remote controls
  • A controller which power-up and control the whole system
  • A blaster which will emit the infrared signals (it can be multiple in number to extend the range and locations)
  • In an advanced system, the controller can be interfaced to a network or internet which enables a lot of advanced capabilities like controlling devices from smartphone,tablet etc and also allowes teaching the remote and doing multiple operations with a single button
For a DIY project, the controller can be made from atmega (arduino), PIC or even a raspberry pi with media center like raspbmc can be used as an ir blaster, hence doing multiple things with a simple raspberry pi.

The entire range of  possibilities are shown in the following figure

IR blaster with raspberry pi/arduino-possibilites [click to enlarge]
A simple IR extender system can be made without any microcontroller. In this case the system simply relays the infrared pulses it receives from the remote controles. This is the basis of simple IR extenders which can be used to control the stack of devices inside a cupboard. An example circuit is given below

A simple IR extender for DIY


A simple IR extender/blaster circuit diagram

In the above circuit, the IR detector generates pulses based on the input signal. The 555 act as an oscillator at the IR carrier frequency (36-40khz) and can be adjusted with 10K linear potentiometer and need to be optimized for the receivers.  Finally the modulated pulses are transmitted from the IR led. The details of ir signalling and codecs are too long to be discussed in this post and hence is kept for later.

More powerful IR blasters - increasing the strength of IR signals 

Often it is necessary to have more power output in the form of ir signals to extend the range of the remote controller. It is also necessary when we need to control an over head projector or a fan which is located higher up in a ceiling. In such cases the following schematic may be useful. Just connect the output signal from the microcontroller or raspberry pi or even the signal from the previous circuit (extender , use output from pin3 of 555 timer ic) to the input of the circuit shown below. It uses two Infrared led's connected to BD139. Other possibilities are using a mosfet switching or an scr.

Powerful ir blaster led_driver

Basics of Infrared Remote


Infrared remote has  a special led (light emitting diode) which emit infrared light, which is invisible to our eyes. But part of it can be viewed if observed through a mobile phone camera. So point your TV remote to a camera and press a button. You will see something like the video below


The blinking led is transmitting  a message to the receiver. The rate of blink, basically the time space between the blinks or the length of on time (depending on different encoding protocols) determines the content of the message. As there is ambient infrared signals in the room, these visible blinks are in turn composed of faster invisible (to our eye due to the fast rate) blinks of the order of 38-40khz , known as the carrier waves. In scientific term, this is a pulse width modulation.

There are different encoding schemes like NEC, Sony, Philips etc. But all of them convey messages based on the length of  blink and non blink intervals. There is a nice description of IR message encoding by Giorgos which can be read here

IR protocols- tools of the trade

As mentioned there are several protocols for IR remotes. To analyse the IR protocols and signals from a remote control, it is ideal to have an oscilloscope, so that the signals can be seen. But in practice we dont need it. An ir receiver and some of the freely available tools can achieve the same results. If you work with linux or raspberry pi, your best friend is LIRC. Although it is a bit difficult to understand, it offers an extensive and comprehensive range of tools to deal with ir remotes. This is useful when dealing with various type of ir devices like usb irda, soundcard (connecting ir sensor to audio in!!) or GPIO (for raspberry pi) and so on.

A more elaborate tutorial on using a soundcard to capture IR protocol can be seen here

You can also use the reverse to generate an IR signal from sound card output and can form the basis for converting a smartphones audio output to an ir output with suitable adapter (if the phone lacks an ir transmitter). A simple example can be read in this instructable.

Bridging with a micro-controller or raspberry Pi


These simple ir blaster circuits shown above relays the information from their sensor to the devices in the cupboard or other targets. Adding a microcontroller like Arduino (atmega)/PIC can make things even more smarter. The device can then be linked to a wireless network, which allowes to control the ir devices over the internet and also to extend the capability to a very long range over the ip network (with in intranet or via internet!). If you use a raspberry pi as  a media center, then the same can be used as the controller! allowing a wide range of possibilities. More on controller integration are discussed in an other post which can be read here.

Smartphone as ir-blaster

Lately, there are smartphones like S4 with built in infrared led. Converting them to a simple ir transmitter is as easy as downloading an android app. If the phone lacks an ir led, it may be possible to use the audio jack and convert it in to ir transmitter. But in that case, using a system as mensioned above with a micro-controller- wifi-net bridge and hence the phone can be used to control the devices by using a simple web-browser.

Integrating the raspberry Pi based webcontrolled ir blaster

After reading a wonderful article by James on integrating a web controlled ir device on the raspberry Pi, I made a simple single step process for the beginners to quickly integrate a python and flask based web controller for their infrared projects for htpc (home theater projects).

Adding web control to ir blaster

To add web control, you need to follow the commands given below. Here it is assumed that the username is still pi (if not, you need to edit the remote.py file at a later step)

ssh in to the pi and issue

cd /home/pi

wget https://github.com/riyas-org/irweb/archive/master.zip

unzip master.zip
mv irweb-master irweb
cd irweb
python remote.py

Now the remote control can be accessed by navigating to the IP address of the raspberry pi

For eg http://192.168.0.100:5000 and see the magical interface (Thanks to James for bringing this)

Commercial solutions

If you want a quick solution there are some commercially available ir systems. They are bit expensive when it comes to features. It is worth searching for flirc, logitech harmony.

1 comment:

  1. can 2n3904 replaced with any other TR. bc547 or pn2222a ?
    any equivalent available ?

    ReplyDelete