Pages: [1]   Go Down
Author Topic: IR-RF converter  (Read 7611 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My first contribution to the exhibition!

To show you what this device is for a short video first:

[media]http://www.youtube.com/watch?v=mcnjdv4eLCA[/media]

Now the story behind it:
Universal remote controls are very useful devices. I have a very nice Philips Prestigo remote control that replaces all my Infrared remote controls very well. But I also have some devices that are controlled with Radio Frequency (RF) e.g. a lamp in my living room and a FM receiver. More than once I couchpotatoed reading a newspaper and listening to music and, when I wanted to watch TV had to get up and fetch the RF-remote. Yes, I know, no real drama, but still enough reason to think about a way to control the RF-devices with my Infrared remote control...

The hardware setup is astonishingly easy:
you only need an Infrared receiver and a RF-transmitter.
I used:
Infrared receiver:
Vishai Semiconductors TSOP1838 = 4838 bought at www.conrad.de (item nr. 171115 - 62)
RF-transmitter:
I tried 2, both of them work very well.
from www.conrad.de
transmitter/receiver module set 433 mhz (item nr. 130428 - 62) for 14,95€
and from www.seeedstudio.com
433Mhz RF link kit for only 4.90$ (but shipping costs of course)
As already mentioned, both work very well, in my final draft I used the one from seeedstudio simply because it has nice breadboard compatible pins.
Here is a picture of the finished device. The LED on the top right is simply inserted between pin 13 and ground and blinks shortly when a valid IR-signal is received.


The wirings may seem a bit strange, most of them were just inserted to reposition the parts on the breadboard.

What you need for the program:
The IRremote from Ken Shirriff
http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm
The RemoteSwitch library v2.0.0 made by Randy Simons
http://randysimons.nl
Many thanks to Ken and Randy since they did the REAL work, I only had to combine their outcome...

The code:
Code:
#include <IRremote.h>
#include <RemoteSwitch.h>
/*IF-RF Bridge: This program is intended to enable any infrared universal remote control
to also switch devices connected to RF-switched plugs (e.g. Intertechno or, as I learned,
klikaanklikuit in the Netherlands.
What you:
Hardware:
-an arduino (of course)
-an infrared receiver module: I took Vishay Semiconductors TSOP4838 available for 1,65€
 here: http://www.conrad.at/ce/de/product/171115/
-a RF-Transmitter, i took it from Conrad too, although there are cheaper ones around
 http://www.conrad.at/ce/de/product/130428/
 I also had Seed Studios RF link kit available, works too, but that from Conrad worked better (better range)
 http://www.seeedstudio.com/depot/433mhz-rf-link-kit-p-127.html?cPath=101_103
-a Universal remote control or a remote control that you do not use any more.
 
 Software:
 The Remoteswitch library from Randy Simons:
 http://randysimons.com/overige/browsable/433MHz/
 The IRemote library from Ken Shirrif:
 http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
 
 The hardware setup is extremely easy:
 simply connect ground and 5VCC to the respective pins on the IR receiver and RF transmitter module,
 connect the data pins to the respective Digital pins (here 11 for the IR receiver and 10 for the RF transmitter
 only 6 wires in total!
 
 Software adaptions:
 I have a Philips Prestigo remote control. To get unused IR-codes I randomly chose a Philips-brand device and
 started the program on the Arduino, then started the serial monitor and clicked some buttons on the remote control,
 to see the codes for those buttons in the serial monitor. Write down some of the codes, one pair for
 each device you want to switch (one for switching on and one for switching off). Now replace the values in the case
 statements with the codes you want to use. The device I randomly chose sends different codes for the numeric
 keys 0-9 alternately, so I have 2 codes at each case statement. Delete one of them if not needed.
 If you have Intertechno (or klikaanklikuit) you have to declare a KakuSwitch variable, in Randy Simons RemoteSwitch library
 there are two other types of remotes defined. Try them if the KakuSwitch is not working for you.
 The Internechno(klikaanklikuit) remotes can switch up to 16 devices, if you want to use all of them you have to add up
 32 case statements. I only switch four devices so there only are 8 distinctions...

Credits:
This program can only be that simple, because Randy Simons and Ken Shiriff encapsulated the complex parts in their
libraries. I messed around a little bit trying to decode the RF codes from my remote before I found Randys library and I
was really happy when I found it, because I think I could not have it done...
Many thanks to Randy and Ken for sharing their knowledge!
*/


int RECV_PIN = 11;
int RF_PIN =10;
IRrecv irrecv(RECV_PIN);
decode_results results;
//the Intertechno(klikaanklikuit) simulator
KaKuSwitch kaKuSwitch(RF_PIN);

void setup()
{
  //initialize LED-pin
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
  Serial.println("Serial interface initialized");
}

void loop() {
  if (irrecv.decode(&results)) {
    switch(results.value){
      case 0x001: //the values in the case statements have to be adapted to your needs! See above...
      case 0x801:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',1,true);
        break;
      case 0x002:
      case 0x802:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',1,false);
        break;
      case 0x003:
      case 0x803:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',2,true);
        break;
      case 0x004:
      case 0x804:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',2,false);
        break;
      case 0x005:
      case 0x805:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',3,true);
        break;
      case 0x006:
      case 0x806:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',3,false);
        break;
      case 0x007:
      case 0x807:
        digitalWrite(13, HIGH); //turn signal LED on...
        kaKuSwitch.sendSignal('K',4,true);
        break;
      case 0x008:
      case 0x808:
        kaKuSwitch.sendSignal('K',4,false);
        break;
    }
    delay(200);              // wait a little bit...
    digitalWrite(13, LOW);   // and set the LED off    
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}

When you browse the code the question may arise, what IR-codes to use (the values behind the case statements...).
In my case I simply added another device with my remote control. The Philips Prestigo remote has a huge database of devices and since the IR library is compatible for Philips devices (they use the RC5 standard, I think...) I chose a random Philips TV set. Then I built a simple circuit with just the IR-receiver on the breadboard connected to power and digital pin 11, started the following program and watched the codes that were shown in the serial monitor when I pressed the buttons on the remote control. These codes are the values behind the case statements. Since Philips uses 2 codes for each button alternately (e.g. the first time you press the 1-button the IR-Code is 1, the second time it is 0x808 (=2049 decimal)) there are two case statements for each button. You will have to find out these codes for the (virtual)device you want to use...

Code:
#include <IRremote.h>
/*Test program for IRemote library.
testet on 27.05.2010
IrReceiver lib:
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
Simply connect IR receiver on 5V, ground and Digital Pin 11, start the program
and watch the IR codes in the serial monitor. Tested for Philips and Sony devices
*/
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Serial interface initialized");
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);
    irrecv.resume(); // Receive the next value
  }
}

That's it so far. Let me just show you how I configured my remote control to comfortably switch my RF devices. The remote control has a configurable touchscreen. You can even add own icons. Here's the result:



Hope that this idea and this posting is helpful or at least interesting for someone else! I look forward to your comments!

BitCurrent

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Congratulations with your project! It looks good.

I am wanting do to something similar, controlling my remote switches from my Arduino.

Do you know the use/meaning of device, address and system code in the examples below, taken from the library examples:


 //Switch off KaKu-device 10 on address M
 kaKuSwitch.sendSignal('M',10,false);
 
 //Switch on Action-device B on system code 1.
 actionSwitch.sendSignal(1,'B',true);
 
 //Switch on Blokker-device 7.
 blokkerSwitch.sendSignal(7,true);



I am trying with a remote switch of another make and I am completely lost as of how to modify the code.

Thanks.
« Last Edit: October 22, 2010, 04:43:05 am by marlar » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The remote control device seems very cool. It has touch screen!
Where can I more information about it?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for the late answer, I thought I would be notified by E-mail when a reply is posted, but that was an error...

@marlar
I can explain in detail the meaning of the kaKuSwitch command:
kaKuSwitch.sendSignal('M',10,false);
parameter 1 means the channel that you are using. Kakuswitch (in the Netherlands) or Intertechno (in Austria, Germany?) products all have this channel selector. There must be the same setting on all receivers and all transmitters you are using.
see http://www.intertechno.at/medien/produkte/sender/manual-ITS-150.pdf for an example
in the drawing you can see the selector for the sender (3) and the receiver (1)

parameter 2 means the device you want to switch: Intertechno or KakuSwitch allow 16 devices to be switched. In your example you would switch device 10, that you could select on the sender by setting the group switch (5) to position 3 and then select button 2.

parameter 3 says if you switch on (true) or off (false)
In the example you would switch device 10 off.

The actionswitch devices seem to work similar, but I don't know them and the blokker device seems to be a little simpler, I would guess that paramters 1 and 2 are the same as parameters 2 and 3 on the KakuSwitch/Intertechno

look here for pictures and explanations from the creator of the library...
http://randysimons.com/overige/browsable/433MHz/

In the meantime I can also swich another device with my IR-RF converter emulating a Fernotron roller blind remote control. I had to do all the decoding of the signals myself since I did not find any references. The decoding process could be interesting for you too. I plan to describe it in detail here in the forum or somewhere else on the Arduino site, but this will take some more time...

@swseansw
The remote control is a Philips Prestigo ST9320.
The touch screen is not the exactest one but still very nice and the concept is very cool. It has a huge device database, you can reposition the buttons of your remote controls on the touch screen as you want, you can add Favorites and store them with the channel's symbols and, it has a good usability, because it is not overloaded with buttons and, quite important for me, it is by far the remote control with the best design (in my opinion )...
It replaces all my remote controls completely, I've never had to use the original remotes since all functions for my devices are there...
I can even open open my car with it (I have quite an old one with an infrared central locking system) smiley-grin
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 49
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks bitcurrent. I am looking forward to read about the decoding process  smiley
« Last Edit: November 16, 2010, 04:43:00 pm by marlar » Logged

Pages: [1]   Go Up
Jump to: