0

I just bought VS1838B IR module (from here) and I’m trying to make it work. Below you can find the circuit to see how I have connected the 1838B IR receiver:

enter image description here

My Code (Here) :

#include <IRremote.h>

int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define CH1 0xFFA25D 
#define CH 0xFF629D
#define CH2 0xFFE21D
...
#define BUTON8 0xFF4AB5
#define BUTON9 0xFF52AD

void setup()

{

 Serial.begin(9600);

 irrecv.enableIRIn(); 

}

void loop() {
 

 if (irrecv.decode(&results)) 
  {

 if (results.value == CH1) 

 {

 Serial.println("CH-"); 
 }

 if (results.value == CH) 

 {

 Serial.println("CH"); 

 }

 if (results.value == CH2) 

 {

 Serial.println("CH+"); 

 }

 ...

 if (results.value == BUTON8) 

 {

 Serial.println("BUTON8"); 

 }
if (results.value == BUTON9) 

 {

 Serial.println("BUTON9"); 

 }
 irrecv.resume();

 }

 

}

But I'm not getting any output from Serial Monitor. Can you help me for debugging it?

3
  • Are you sure you have a proper remote control? How did you get the constant values from?
    – jfpoilpret
    Aug 25, 2014 at 20:30
  • 1
    You should add Serial.println(results.value); after if irrecv.decode(&results)) { to check what codes are really received from your remote.
    – jfpoilpret
    Aug 25, 2014 at 20:35
  • @jfpoilpret It's not printing anything, it's not going inside of that if() . I'm use I'm using a proper controller because all they came together, as a kit.
    – Eray
    Aug 25, 2014 at 21:42

5 Answers 5

3

Looking further here

http://forum.arduino.cc/index.php/topic,188236.0.h...

I found the following

"Removing the files - libraries\RobotIRremote\IRremoteTools.cpp and libraries\RobotIRremote\IRremoteTools.h solved the problem. They are example files which somehow are getting included. You can move those two files to some other location as backup."

I went to my libraries file and did this and can confirm that the example given above then compiles fine without downloading a new library. Its an Arduino libraries problem .

Either way will work

answer from here and worked for me

i use this code:

#include <IRremote.h>
int input_pin = 10; //set D10 as input signal pin
IRrecv irrecv(input_pin);
decode_results signals;
void setup()
{
    Serial.begin(9600);
    irrecv.enableIRIn(); // enable input from IR receiver
}
void loop() {
if (irrecv.decode(&signals)) {
        Serial.println(signals.value, HEX);
        irrecv.resume(); // get the next signal
    }
}
1
  • Yup, this was my issue as well. On macOS the files are stored in the contents of Arduino.app, so using Finder you need to go to /Applications, then right-click Arduino.app and click "Show Package Contents". Now, navigate to the folder /Applications/Arduino.app/Contents/Java/libraries and delete the folder "RobotIRremote". You can also do this easily from the Terminal using the rm -r /Applications/Arduino.app/Contents/Java/libraries/RobotIRremote command.
    – cody.codes
    Oct 5, 2018 at 23:01
2

i have also bought this IR receiver with a remote controller (as a kit), and i had the same problem, i changed the remote controller and it worked perfectly, so even if the IR and RC came as a kit it doesn't mean they will work, if you don't have another remote controller in hand you can use a lighter just to check if the IR is working.

1

I could be wrong, but I believe that this receiver operates at 38kHz (at least that is listed in the specs), so the IR source must be oscillating at that frequency for this receiver to see it. Check out this link to see how to create a circuit to oscillate your IR LED:

http://www.electro-tech-online.com/threads/ir-emitter-at-38khz.94119/

1
  • Whilst you link may answer the question, it would be preferable to include the essential parts of the linked here, and provide the link for citation. Thanks! May 3, 2015 at 22:58
1
void loop(void) {
   int numberpulses;

   numberpulses = listenForIR();

   Serial.print("Heard ");
   Serial.print(numberpulses);
   Serial.println("-pulse long IR signal");
   if (IRcompare(numberpulses, ApplePlaySignal)) {
      Serial.println("PLAY");
      if (ledState == LOW)
         ledState = HIGH;
      else
         ledState = LOW;

      // set the LED with the ledState of the variable:
      digitalWrite(ledPin, ledState); 

   }
   if (IRcompare(numberpulses, AppleRewindSignal)) {
      Serial.println("REWIND");
   }
   if (IRcompare(numberpulses, AppleForwardSignal)) {
      Serial.println("FORWARD");
   }
}
0
1

connect vcc to 5V connect Gnd to GND connect In to D11 pin onto Uno, Nano etc. download the library from here and follow the instructions/where to unzip and removing the other folders/: http://z3t0.github.io/Arduino-IRremote/

Open the Arduino program and paste this code onto a new Arduino project:

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(results.value, HEX);
     irrecv.resume(); // Receive the next value
    }
}

Select 'Sketch'/Import Library from Arduino and select IRremote from the drop-down menu.

Upload the sketch Open Tools/Serial monitor then select 9600 as baud rate Use a Tv remote, IR car remote or the remote from the module. You will see the HEX code of each button after pressing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.