IRremote: receiving ok but transmitting don't work

Hi.
IR receiver ok with following code:

#include <IRremote.h>
const byte IR_RECEIVE_PIN = 3;
decode_results results;

void setup()
{

Serial.begin(9600);

Serial.println("IR Receive test");
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

}

void loop()
{
if (IrReceiver.decode()) //this line checks if we received a signal from the IR receiver
{
Serial.println(IrReceiver.decodedIRData.command, HEX); //Print the value captured in HEX
Serial.println(IrReceiver.decodedIRData.command); //Print the results in decimal
IrReceiver.resume(); //receive the next value
}
}
Have tried with several TV remotes and working fine

But cant make own IR transmitter to work
Uno rev 3, transistor BC547 B331, emitter 1497-1062-ND (DigiKey)
Code
#include <IRremote.h>
const int switchPin = 3;
IRsend irsend;

void setup() {
Serial.begin(9600);

pinMode(switchPin, OUTPUT);
}

void loop() {
2BKAC8
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0x18, 32);

delay(40);
Serial.println (0x18, 32);
}

delay(10000);
}

Serial. println gives 0 and if instead 0x18 send 0x4BA2988; gives 2BKAC8.

My receiver don't get any info from my transmitter. Have tried all Christmas Days but can't find mistake. Any suggestions please!

Please read the forum guidelines to see how to properly post code and some information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post.

The transmitter code will not compile.

What version of the IRremote library are you using?

Please post a schematic. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.

Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

It is always a good start to first have a look at the examples provided by this library. Start with the Simple* and the *Demo examples.
Examples for this library are available in the Arduino IDE under File > Examples > Examples from Custom Libraries > IRremote > ...
Examples are also available at Github: Arduino-IRremote/examples at master · Arduino-IRremote/Arduino-IRremote · GitHub

Hi- I am back.
Device 1. IR remote device (from shop) - press on button- gives values as on the table.
Device 2. IR remote made by me Amazon.uk.co IR transmitter KY-005
Device 3. IR remote made by me Digikey IR emitter 1497-1062-ND
Device 4. IR remote made by me Digikey IR emitter 365-1042-ND

Enquiry behind every result in given in sketch IRRedA1 loop part.

Result 1 Result 2 Result 3 Result 4 Result 5

  1. E619FE01 19 25 8 Protocol=NEC Address=0x1 Command=0x19 Raw-
    Data=0xE619FE01 32 bits LSB first

  2. E619FE01 9 25 8 Protocol=NEC Address=0x1 Command=0x19 Raw-
    Data=0xE619FE01 32 bits LSB first

  3. 0 40 64 17 Protocol=RC5 Address=0x0 Command=0x40
    Raw-Data=0x0 0 bits MSB first

  4. 0 0 0 0 Protocol=UNKNOWN Hash=0x0 1 bits (incl. gap and start)
    received

In every remote made by me is the code the same and 2 own breadboard and 3-4 same own breadboard.

In SimpleSender_Forum there is the second TAB PinDefinitionsAndMore and don't work without this tab. Firstly don't undestand it and secondly why it is given in #include?
Secondly could someone help to tell how I get Device 3-4 to work.

Down pictures and code. In 2nd picture the red wire to 5V, blue gnd.

// A simple receive sketch modified from Irremote receiver

#include <IRremote.hpp>

const byte IR_RECEIVE_PIN = 3;

IRrecv receiver(IR_RECEIVE_PIN);

void setup()
{
  
  Serial.begin(9600);
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
 
  Serial.print("IR Receiver ready!");
}

void loop()
{
  decode_results results;
  if (IrReceiver.decode())
 
  {
	              
	  
  Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); //Result 1
  Serial.println(IrReceiver.decodedIRData.command, HEX);              //Result 2
  Serial.println(IrReceiver.decodedIRData.command, DEC);              //Result 3
   Serial.println(IrReceiver.decodedIRData.protocol);                        //Result 4
  IrReceiver.printIRResultShort(&Serial);                                               //Result 5          
                                                       
	receiver.resume(); 
}
}

Here the sender part

/*  SimpleSender.cpp
 Modifications made
  *  This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
 */
#include <Arduino.h>

const int switchPin = 3;  

#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.h>

void setup() {
    pinMode(switchPin, OUTPUT);

    Serial.begin(9600);  

    // Just to know which program is running on my Arduino
    Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing IRremote library version " VERSION_IRREMOTE));
    
    IrSender.begin(); // Start with IR_SEND_PIN as send pin and if NO_LED_FEEDBACK_CODE is NOT defined, enable feedback LED at default feedback LED pin

    Serial.print(F("Ready to send IR signals at pin "));
    Serial.println(IR_SEND_PIN);
}

uint32_t aRawData = 0xE619FE01;


void loop() {
    
        
       IrSender.sendNECRaw(aRawData);

      delay(10000);
   
}

PinDefinitionsAndMore.h I did not copy here as it is better to look in Irremote library SimpleSend example

Pictures from breadbord

HI- Back again.

Now all IR remotes sends the same message, which is
E619FE01

19 (Hex)

25 (Dec)

8 (Protocol)

Protocol=NEC Address=0x1 Command=0x19 Raw-Data=0xE619FE01 32 bits LSB first

In devices 3 and 4 transistor was left out and connection as in 2 (= first picture). Transistor 220 ohms. First did not work, uno was blinking, reason 9V battery was only 6 V. After replacing it with new battery everything was ok.

NOW SOME SERIOUS WORDS:
When solving this problem spent hours in internet, also Arduino Forum. Unfortunately with poor results. Most discussions were Tik-Tok level. This message made by me is the first in Forum where you get the answer to this problem. Pls inform if I have overseen something.

Still question:
hoping someone could help. The sender part is a modification from IrRemote SimpleSender. There is secoond tab PinDefinitionsAndMore and don't work without this tab.
Here it was not coopied as can been found in library. Firstly don't undestand it and secondly why it is given in #include, but is not a library.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.