# IRRemote with Nano

**URL:** <https://forum.arduino.cc/t/irremote-with-nano/1418944>\
**Category:** General Guidance\
**Created:** [December 10, 2025, 1:53pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944 "2025-12-10T13:53:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 1:53pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/1 "2025-12-10T13:53:00Z")

</div>

Im using IRremote (4.5.0) on an Nano clone. It works but not 100% of the time. Sometimes it misses a code.

I have scoped the power rail and also the data into the Nano, both are good, its just that the Nano sometimes doesn't catch the code.

I've stripped my code to the bare minimum shown below.

Any insights or is this normal Nano behaviour?

void loop()  
{  
if (IrReceiver.decode())  
{  
ircode = (IrReceiver.decodedIRData.decodedRawData);

```
 if ((ircode == 5179) || (ircode == 7227))
 {
   digitalWrite(11, HIGH); //Green LED On
   digitalWrite(12, LOW); //Red LED Off
 }
 else if ((ircode == 5180) || (ircode == 5438) || (ircode == 5950) || (ircode == 7486) || (ircode == 7998) || (ircode == 6462) || (ircode == 7230) || (ircode == 4414))
 {
   digitalWrite(11, LOW); //Green LED Off
   digitalWrite(12, HIGH); //Red LED On
 }

```

}

IrReceiver.resume();

}

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 1:56pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/2 "2025-12-10T13:56:07Z")

</div>

Are you sending IR signal from a TV Remote Control? Please, post the picture of your Remote Control and also the Model.

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 2:28pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/3 "2025-12-10T14:28:55Z")

</div>

Have tried multiple remotes all with the same symptom. Works but with failures.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 2:35pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/4 "2025-12-10T14:35:40Z")

</div>

Try the following sketch:

```arduino

#include <IRremote.h>

IRrecv irReceiver(9); // Create an IR receiver object on pin 11
decode_results results;

void setup() 
{
  Serial.begin(9600);
  irReceiver.enableIRIn(); // Start the IR receiver
}

void loop() 
{
  if (irReceiver.decode(&results)) 
  { // Check if there's an IR signal
    Serial.println(results.value); // Print the value of the received signal
    irReceiver.resume(); // Prepare to receive the next signal
  }
}

```

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 2:57pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/5 "2025-12-10T14:57:37Z")

</div>

I could not get your code to run, however I have already tried an equivalent to get the codes in the first instance. This seems to have the same behaviour, mostly works but will miss random instances.

```arduino
#include <IRremote.h>

#define IR_RECEIVE_PIN 6
long ircode = 0;

void setup() 
{
  Serial.begin(4800);
  IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);
}

void loop() 
{
  if (IrReceiver.decode())
  { // Check if there's an IR signal
  ircode = (IrReceiver.decodedIRData.decodedRawData);
    Serial.println(ircode); // Print the value of the received signal
    
  }
  IrReceiver.resume(); // Prepare to receive the next signal
}

```

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 3:16pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/6 "2025-12-10T15:16:00Z")

</div>

> [@duncboyd](#):
>
> I could not get your code to run

Why? Is it not compiled? What are the error messages?

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 3:30pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/7 "2025-12-10T15:30:03Z")

</div>

Compiled and uploaded but zero output on the serial monitor

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 3:31pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/8 "2025-12-10T15:31:15Z")

</div>

Please, post a picure of the Remote Control you have used with my sketch. I want to see the Model.

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 3:56pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/9 "2025-12-10T15:56:03Z")

</div>

I have tried multiple remotes, all with the same behaviour.

I now get an error message with your code saying it is for version 2.0 of IRRemote and is no longer supported. Im using rev 4.5.0

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 3:58pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/10 "2025-12-10T15:58:07Z")

</div>

Try and let me know. Why are you not posting the picture of your Remote Control? Take a picture by your mobile camera and post here.

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 4:06pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/11 "2025-12-10T16:06:59Z")

</div>

Why is it relevant?

As I've said, I have tried multiple remotes. One example is the Samsung BN59-01175N TV Remote Control

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [December 10, 2025, 4:21pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/12 "2025-12-10T16:21:02Z")

</div>

> [@duncboyd](#):
>
> Why is it relevant?

Why are you dismissing advice?

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 4:23pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/13 "2025-12-10T16:23:56Z")

</div>

I don't believe I have?

---

<div class="post-metadata">

**Author:** ![Dave\_Lowther](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dave_lowther/32/1092885_2.png) [@Dave\_Lowther](https://forum.arduino.cc/u/Dave_Lowther)\
**Post date:** [December 10, 2025, 4:24pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/14 "2025-12-10T16:24:59Z")

</div>

> [@duncboyd](#):
>
> Nano sometimes doesn't catch the code.

Does it depend on distance? I.E. if you hold the remote a few cm from the receiver on the Nano does it work reliably?

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 4:27pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/15 "2025-12-10T16:27:06Z")

</div>

> [@duncboyd](#):
>
> Samsung BN59-01175N TV Remote Control

My sketch works with this model: 2207 SMART (Colone of SONY).

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/5/e/9/5e9a95ede89cfe98ec1b4f8ee863b33ce4426148.jpeg)

---

<div class="post-metadata">

**Author:** ![duncboyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/duncboyd/32/1126810_2.png) [@duncboyd](https://forum.arduino.cc/u/duncboyd)\
**Post date:** [December 10, 2025, 4:28pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/16 "2025-12-10T16:28:20Z")

</div>

Distance doesn't matter. On the scope I can see a perfect input stream to the Nano. Just sometimes it doesn't see it.

Have used the same library with ESP32 without issue so I'm really questioning if there is some quirk with the Nano, and especially Ali Express variants.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [December 10, 2025, 4:37pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/17 "2025-12-10T16:37:08Z")

</div>

> [@duncboyd](#):
>
> Just sometimes it doesn't see it.

Can you show the connection diagram of your IR receiver circuit with your NANO?

---

<div class="post-metadata">

**Author:** ![lichurbagan](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lichurbagan/32/1126781_2.png) [@lichurbagan](https://forum.arduino.cc/u/lichurbagan)\
**Post date:** [December 10, 2025, 4:59pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/18 "2025-12-10T16:59:13Z")

</div>

IRremote 4.x on ATmega328P uses Timer2. If any part of your project or libraries (Servo, tone, PWM on pins 3/11, etc.) use Timer2, decoding becomes unreliable.

You are using digitalWrite(11). If pin 11 ever had PWM enabled before, that uses Timer2. Normally `digitalWrite()` disables PWM, but clones sometimes fail to fully reset Timer2 states.

---

<div class="post-metadata">

**Author:** ![ArminJo](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@ArminJo](https://forum.arduino.cc/u/ArminJo)\
**Post date:** [December 16, 2025, 8:07pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/19 "2025-12-16T20:07:25Z")

</div>

Use the ReceiveDemo example and you will see the reason for skipped code in the Serial output

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [December 16, 2025, 8:32pm UTC](https://forum.arduino.cc/t/irremote-with-nano/1418944/20 "2025-12-16T20:32:55Z")

</div>

> [@lichurbagan](#):
>
> but clones sometimes fail to fully reset Timer2 states.

I wonder how they fail..?

[Next page](https://forum.arduino.cc/t/irremote-with-nano/1418944.md?page=2)
