I made custom pcb that serves as a switch to any 230VAC device in household and it can be controlled through IR remote. The problem I encounter is finding or making specific ir remote that would send unique code for a single device (for example if I have a coffee maker, different lamps or whatever I would want one remote to send code that would control just one specific lamp and not turn on multiple devices or lamps). Is there any done remote that you can program it to send specific code you want (I want it to be designed solidly so I would prefer if it was already done in some cool casing over me making some DIY remote controller)? Ive managed to control my devices via generic remote which Ive read ir code that it sends and just used that code to manage my devices but Ive noticed that my other remotes (TV) also interfere with my devices (sending same code).
Do you mean something like this ?
https://www.ebay.co.uk/b/Programmable-Remote/61312/bn_7023626046
It sounds from your description that all YOUR receiver devices are expecting the same code, hence they all are triggered when they see that specific code.
What I mean is that I got some generic remote controller that sends same code as my TV remote. I programed my device to react on the code from generic controller and now it also reacts on TV controller because I assume they send same code? So what I want is to find a controller that I can program so it sends unique code that I would use to trigger just my device and other controllers wouldnt be able to trigger my device.
I cant see it, it says server is down.
Working for me in the UK but maybe not from Croatia
Do a search for Programmable Remote
Every IR transmitter and receiver are "paired" using IR frequency, encoding scheme, no. of bits and address.
For typical systems, the IR frequency, encoding scheme and no. of bits is largely standardised (defined by sony and philips independently, if I'm correct, and they are not compatible). What changes is the address - in an 8 bit system, 4 bits are the address bits that is programmed on both the transmitter and receiver. So different receivers react to only their remotes.
If you program a receiver and remote as per the TV remote even the TV remote will control the receiver.
In summary you will need to program both sides with unique address bits - which may not be as simple as programming the remote with another remote...
What I did so farfound hex value of the signal ir remote sends and then I would put that value into microchip that had ir receiver connected to it so every time it receives that code microchip would activate relay. So if I understood you correctly I need to somehow send unique address from my ir remote?
Yes...you need an address that is not used by any other remote - atleast amongst the ones you would use around this.
The hex that you captured is probably the address + data. So you need to change the address part - typically in an 8-bit packet, 4 bits form the address and 4 bits are the data. Plus you also need to figure out which four are the address bits - press different buttons and see which four bits do not change...those are the address bits.
I have noticed with my "basic" remote that it sends different hex code for same button sometimes and its not even always same length of hex code which is weird, it has 2 buttons for one it sends:
0x20FE4DBB and 0xFFC23D, and for other button it sends: 0xFF6897 and 0xC101E57B.
First combinations in each case are more common (I would say 75% of time its first ones for each button).
That should not happen, unless its something which I am not aware of. Are you sure its not some quirky behaviour on the receiver side (the one that displays the hex codes)?
I am not sure, I am using vs1838b ir receiver connected to arduino uno digital pin. The code that I use for reading the signal and getting hexadecimal code is:
#include <IRremote.h>
const int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop(){
if (irrecv.decode(&results)){
Serial.println(results.value, HEX);
irrecv.resume();
}
}
The baud rate - is it the same as the transmitter?
Is there any way I can find out transmitters baud rate since there isnt anything in specification of the remote where I bought it.
Maybe it does not matter - the IR sensor on the receiver probably takes care of this. What you need to match is the baud rate between arduino and the reciever board (one thay the irrecv library interfaces with).
Not sure what you mean, my receiver board is Arduino UNO that has vs1838b ir receiver connected to it, and my transmitter is some generic remote controller I bought for 2 bucks on aliexpress.
My bad, by "receiver" I thought a separate circuit.
This device does the job of converting the 38kHz carrier bursts into the actual data. So it does look like the IR transmitter is intermittently sending a different code for the same button (is it the same with the original TV remote that was used tovprogram this transmitter?) OR the irrecv.decode() method might be giving incorrect results...try having a small delay at the end of loop() - so the irrecv.decode() is called a bit slowly.
What does irrecv.blink13() do?
As far as I can see from library it is just used for enabling/disabling led on pin 13 if the data is received on ir receiver. This is where I found it in library.
// enable/disable blinking of pin 13 on IR processing
void IRrecv::blink13(int blinkflag)
{
irparams.blinkflag = blinkflag;
if (blinkflag)
pinMode(BLINKLED, OUTPUT);
}
Here is irrecv.decode function from the library:
// Decodes the received IR message
// Returns 0 if no data ready, 1 if data ready.
// Results of decoding are stored in results
int IRrecv::decode(decode_results *results) {
results->rawbuf = irparams.rawbuf;
results->rawlen = irparams.rawlen;
if (irparams.rcvstate != STATE_STOP) {
return ERR;
}
/*
#ifdef DEBUG
if (results->rawlen != 0){
Serial.print("results->rawlen: ");
Serial.println(irparams.rawlen);
}
#endif
*/
#ifdef DEBUG
Serial.println("Attempting NEC decode");
#endif
if (decodeNEC(results)) {
return DECODED;
}
#ifdef DEBUG
Serial.println("Attempting Sony decode");
#endif
if (decodeSony(results)) {
return DECODED;
}
#ifdef DEBUG
Serial.println("Attempting RC5 decode");
#endif
if (decodeRC5(results)) {
return DECODED;
}
#ifdef DEBUG
Serial.println("Attempting RC6 decode");
#endif
if (decodeRC6(results)) {
return DECODED;
}
// decodeHash returns a hash on any input.
// Thus, it needs to be last in the list.
// If you add any decodes, add them before this.
if (decodeHash(results)) {
return DECODED;
}
// Throw away and start over
resume();
debug_print("ERR in IRrecv::decode");
return ERR;
}
The decode source code is interesting. Define the DEBUG preprocessor directive and see which scheme it prints last - that is the scheme being used.
Also does the same behaviour happen with the TV remote - does it still occassionally print the wrong or different hex codes?
The decode_results object - you should probably clear it before calling irrecv.resume()...or simply move its declaration inside loop() so it becomes a local object - that will ensure a fresh instance everytime decode is called. As it stands the same instance is being reused (global), and any previous result in it is probably not getting cleared thereby giving the ocassional wrong hex value.
It is NEC scheme that the remote uses, I would need to bring TV remote that used to turn on/off the device Ill do it in following days I dont have it at me at the moment. Ill try and clear decode_result object and see what happens.