Problem with KEYES IRremote & reciever

Hi!
I’m new to Arduino and i thought it would be fun to try it out, so i bought a Arduino Rev.3 UNO and a IRremote with a reciever.

Basically, my problem is that i don’t get a response from the controller. I am using this code:

#include <IRremote.h> //include the library
//PIN
int receiver = 11;
IRrecv irrecv(receiver); //create a new instance of receiver
decode_results results;
void setup() {
 Serial.begin(9600);
 irrecv.enableIRIn(); //start the receiver
}
void loop() {
 if (irrecv.decode(&results)) { //we have received an IR
   Serial.println (results.value, HEX); //display HEX
   irrecv.resume(); //next value
 }
}

Which i found on another website.
Sometimes it prints out HEX numbers randomly when i’m not pressing anything on the remote. The little light on the sensor doesn’t even light up when i press the remote.

I think i have set all the wires up correctly, but i’m not entirely sure.
I would be very thankful if any of you could help me with this.

Here are some pictures:


Thanks in advance!

Your connections are OK and the code is fine and should work.

Double-check that your wires are making a good connection at both ends, and especially the signal wire from the receiver to pin 11. The random numbers that you're getting indicate that pin 11 might be 'floating'. ie Not being held either high or low. The receiver should hold it high when not receiving codes, and so you should not receive garbage.
Because of this symptom, it's unlikely to be a problem with the actual remote control unit, but at the receiver end.

Just one other thing, not related to your current problem. Since it never changes during execution, it's a good idea to declare the IR receiver pin as a constant, to avoid using more RAM than necessary:-

const byte receiver = 11;

This is the receiver datasheet, in case you don't already have it:-
Keyes Infrared Receiver

Put a 47uF capacitor between ground and +5V (observe polarity).
Feed the receiver +5V through a 47-100 ohm resistor.
.

LarryD:
Put a 47uF capacitor between ground and +5V (observe polarity).
Feed the receiver +5V through a 47-100 ohm resistor.

Of course. I should have noticed that there wasn't a capacitor on the module. Maybe he'll be lucky and that's all that's needed. I've never needed a series resistor though, but it can only help.

I haven't needed the resistor either but this data sheet suggests one.
https://arduino-info.wikispaces.com/file/view/IR-Receiver-AX-1838HS.pdf

LarryD:
I haven't needed the resistor either but this data sheet suggests one.
https://arduino-info.wikispaces.com/file/view/IR-Receiver-AX-1838HS.pdf

Well at least the pullup resistor is already on the module, (if it's datasheet is correct).

Sorry for not responding in a while, but I tried some of your suggestions and none of them worked. I returned the the controller and receiver and bought a new one today. I set it up just like i did in my pictures and it works perfectly fine now! :slight_smile:

Anyways, thanks for your help!

Thanks for reporting back.
I always order/buy multiples.
.