Problem with an IR sensor

Hello world!

I've got a problem with my InfraRed sensor, I found it in my "Elegoo Super Starter Kit"; I connected the left pin of the sensor with GND, the central pin with 5v and the right pin with the pin 11 on Arduino; There's a red light in the sensor that always remains on and it sends out an impulse when I click a button on my remote control.
The code is here:

#include "IRremote.h"

int receiver = 11; 


IRrecv irrecv(receiver);     
decode_results results;   


void setup()   
{
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver

}


void loop()   
{
  if (irrecv.decode(&results)) 

  {
    Serial.println(results.value, HEX);
    irrecv.resume(); // receive the next value
  }  
}

The problem is this: when I click a button on my remote control nothing happens in the serial monitor but sometimes, when I move the wires, some values appear in the monitor.

I hope that you can help me,

Sorry for my bad english but I am italian and I'm learning this language.


This is my remote control;


this is my IR sensor.

"sometimes, when I move the wires, some values appear in the monitor."

Show us a good schematic of your circuit.

Show us a good image of your wiring.

The remote and the receiver migh also work on different frequencies.
A 36kHz remote? and a 38kHz receiver? will work together, but at a limited range (centimeters, not meters).
The starter kit should have the frequency of the sensor listed. e.g. a TSOP4038 is 38kHz.
Leo..

Wawa:
The remote and the receiver migh also work on different frequencies.
A 36kHz remote? and a 38kHz receiver? will work together, but at a limited range (centimeters, not meters).
The starter kit should have the frequency of the sensor listed. e.g. a TSOP4038 is 38kHz.
Leo..

The remote control that I use is the remote control that I found in the starter kit, so I think that the remote and the IR sensor have got similar frequencies.

1 Like




larryd:
"sometimes, when I move the wires, some values appear in the monitor."

Show us a good schematic of your circuit.

Show us a good image of your wiring.

I post the images :slight_smile:

"some values appear in the monitor."

  • Give us some examples of values that are printed to the serial monitor.

  • Please try some new different wires.

  • Try a different location on the breadboard for the circuit.

Edit:
Your code works fine on my hardware.
Must be an intermittent connection on your breadboard.

.

larryd:
“some values appear in the monitor.”

  • Give us some examples of values that are printed to the serial monitor.

  • Please try some new different wires.

  • Try a different location on the breadboard for the circuit.

Edit:
Your code works fine on my hardware.
Must be an intermittent connection on your breadboard.

.

Ok, thank you, I will try this in the afternoon;

Anyway, can you attach the library you used? Can you tell me how you loaded the library?
Maybe I made a mistake with them.

See:

Read these:
Libraries

A bit more:
https://brainy-bits.com/blogs/tutorials/ir-remote-arduino

larryd:
See:
GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols

Read these:
Libraries
Arduino Libraries | All About Arduino Libraries | Adafruit Learning System

https://www.arduino.cc/en/Guide/Libraries

A bit more:
https://brainy-bits.com/blogs/tutorials/ir-remote-arduino

A Multi-Protocol Infrared Remote Library for the Arduino

I tried to change the position of the wiring on the breadboard and now, in the serial monitor, some values continue to appear but if I click a button on my remote control nothing happens.

This is the text that I can read in the serial monitor after some seconds with this sketch:

#include "IRremote.h"

int receiver = 2; 


IRrecv irrecv(receiver);     
decode_results results;   


void setup()   
{
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver

}


void loop()   
{
  if (irrecv.decode(&results)) 

  {
    Serial.println(results.value, HEX);
    irrecv.resume(); // receive the next value
  }  
  delay(500);
}

IR Receiver Button Decode
FFFFFFFF
A20A17E7
1F7E007E
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
ACA6E7ED
BA392674
15FB7F1A

larryd:
See:
https://github.com/z3t0/Arduino-IRremote

Read these:
Libraries
Arduino Libraries | All About Arduino Libraries | Adafruit Learning System

https://www.arduino.cc/en/Guide/Libraries

A bit more:
https://brainy-bits.com/blogs/tutorials/ir-remote-arduino

A Multi-Protocol Infrared Remote Library for the Arduino

I forgot to say that now the red led in the IR sensor continue to pulse when I push a button on my remote control

I click a button on my remote control nothing happens

You are using pin 2 for receive on the Arduino?

We assume you have tried a new battery in your remote?

Try a TV remote to see if you get anything (it may, however, be incompatible).

IR Receiver Button Decode
FFFFFFFF
A20A17E7
1F7E007E
FFFFFFFF
FFFFFFFF
FFFFFFFF
FFFFFFFF
ACA6E7ED
BA392674
15FB7F1A

These look reasonable.

If it doesn’t work and the. You wiggle the wires and it does for a second it’s a wiring issue.

larryd:
You are using pin 2 for receive on the Arduino?

We assume you have tried a new battery in your remote?

Try a TV remote to see if you get anything (it may, however, be incompatible).

These look reasonable.

It doesn't work... Can the IR sensor be broken?

If you are doing everything correctly and the receiver is matched to the remote, the receiver can be a faulty component.

The part may have been damaged by improper wiring or it may have be faulty from the start.

.