# IR emitter doesn't work on 3.3v arduino mini pro but works on 5v one

#### flash01694

Joined Mar 7, 2018
26
Hello guys so I've been experimenting with IR emitters and I have encountered the following problem.

Basically my IR emitters work on any Arduino I have except for the 3.3v mini pro. At first I thought the emitter needed more voltage but what happens is that if I "flash" the code on the 3.3v arduino while selecting the 5v 16Mhz mini pro in the tool menu it works normally, but if I flash it as a 3.3v (which it is) it no longer works.

futhermore this workaround only works if I have nothing else but the emitter wired into the arduino, if I connect for example an rgb strip (just two leds) the emitter stops working.

Anyone knows how to make an IR emitter work normally on a 3.3v mini pro?

thanks for help!

#### Sensacell

Joined Jun 19, 2012
2,544
Connecting a LED directly to an IO pin without a current limiting resistor is not good practice.
Use a resistor, or an external transistor driver if you need more output power.

#### flash01694

Joined Mar 7, 2018
26
I am a noob in this field so if something I ask is very dumb I apologize in advance

Sounds like clock issue.

3.3v pro mini runs at 8 MHz.
5v pro mini runs at 16 MHz.

The "regular" libraries expect 16 MHz because "you told" the IDE that you have 5v board.
Dig into the library files and see what they have there for the clock. You may be able to simply change 16 to 8 MHz.
I suppose I need to find some kind of value in the IRremote.h library and change it from 8 to 16 but I can't find it (I used a simple text editor)

Connecting a LED directly to an IO pin without a current limiting resistor is not good practice.
Use a resistor, or an external transistor driver if you need more output power.
ah I thought a resistor would draw power so I took it off, will try putting it back. I tried with a simple transistor amplifier but the result doesn't change. not sure by what you mean by external though, I wired my transistor in the 3.3v arduino output.

#### Raymond Genovese

Joined Mar 5, 2016
1,658
I suppose I need to find some kind of value in the IRremote.h library and change it from 8 to 16 but I can't find it (I used a simple text editor)
No, you don't need or want to do something like that.

Anyone knows how to make an IR emitter work normally on a 3.3v mini pro?
Yes, in fact I am using one on a board a few yards from where I am typing and it works fine.

I am a noob in this field so if something I ask is very dumb I apologize in advance
Everyone is a noob at some point. I think you need to back up and get a little bit of background on what you are doing and how the library works.

Select the appropriate board and processor in the Arduino IDE period. Changing it to a 16 mHz board when you have an 8 MhZ board will not make it a 16 Mhz board. In this case, I am surprised it even compiles and if it does, I am wondering whether you have a 5V Pro Mini and not a 3V mini.

So, first question: What makes you think that you have a 3V Pro Mini?

Second question: What is the specific library that you are using?

Is it this one, https://github.com/z3t0/Arduino-IRremote or this one https://github.com/cyborg5/IRLib2/blob/master/IRLib2/IRLib2.h or another one?

The libraries, in general, want the GPIO used to turn the emitter on/off to be on certain pins only....and they use interrupts and timers.

How are you turning the emitter on/off? Yes, you definitely need a current limiting resistor. The value of the resistor is going to depend on how much current your emitter can take AND how much current the GPIO can provide.

For example. if you use a 100 ohm resistor....if the GPIO is 5V when high, you are providing 50 mA to the IR LED. But, if you use the same set up on a GPIO that is 3.3V when high, you are only providing 33 mA to the IR LED. In these cases, does the GPIO have the capability to source that current?

Using the GPIO to turn on a transistor and the transistor to turn on the IR LED is a good way to drive the LED at a higher current, but the voltage is still a consideration.

This should give you an idea of what to consider and also how little information that you have provided. Sometimes, providing enough information is the hardest part of these exchanges. If you can provide more information - including a good clear picture of your set up and all the details, I think that you will be able to get a solution and increase your understanding as well.

Finally, you should know (if you don't already, that almost any digital camera can be used to see whether the IR LED is on or not - when on, you will see a distinctive glow in the camera.

#### flash01694

Joined Mar 7, 2018
26
No, you don't need or want to do something like that.

Yes, in fact I am using one on a board a few yards from where I am typing and it works fine.

Everyone is a noob at some point. I think you need to back up and get a little bit of background on what you are doing and how the library works.

Select the appropriate board and processor in the Arduino IDE period. Changing it to a 16 mHz board when you have an 8 MhZ board will not make it a 16 Mhz board. In this case, I am surprised it even compiles and if it does, I am wondering whether you have a 5V Pro Mini and not a 3V mini.

So, first question: What makes you think that you have a 3V Pro Mini?

Second question: What is the specific library that you are using?

Is it this one, https://github.com/z3t0/Arduino-IRremote or this one https://github.com/cyborg5/IRLib2/blob/master/IRLib2/IRLib2.h or another one?

The libraries, in general, want the GPIO used to turn the emitter on/off to be on certain pins only....and they use interrupts and timers.

How are you turning the emitter on/off? Yes, you definitely need a current limiting resistor. The value of the resistor is going to depend on how much current your emitter can take AND how much current the GPIO can provide.

For example. if you use a 100 ohm resistor....if the GPIO is 5V when high, you are providing 50 mA to the IR LED. But, if you use the same set up on a GPIO that is 3.3V when high, you are only providing 33 mA to the IR LED. In these cases, does the GPIO have the capability to source that current?

Using the GPIO to turn on a transistor and the transistor to turn on the IR LED is a good way to drive the LED at a higher current, but the voltage is still a consideration.

This should give you an idea of what to consider and also how little information that you have provided. Sometimes, providing enough information is the hardest part of these exchanges. If you can provide more information - including a good clear picture of your set up and all the details, I think that you will be able to get a solution and increase your understanding as well.

Finally, you should know (if you don't already, that almost any digital camera can be used to see whether the IR LED is on or not - when on, you will see a distinctive glow in the camera.

hello and thanks for the answer!

I'm pretty sure it's a 3.3v 8 Mhz unit, it runs on a 3.7 battery and the serial connection works only at 4800 baud rate.

https://github.com/z3t0/Arduino-IRremote this is the library I'm using.

The IR emitter is attached to pin 3 which in the tutorial I found on the internet is the one to be used, however pin Number 3 can't be changed in the code (it doesn't come up at all), so I just thought it had to be precisely that pin and that's what I'm using.

About the IR diode I'm using: the only specification I have is the working voltage which is 2.7 ~ 5.5 V, I bought a bunch on Amazon and there wasn't much else in the spec sheet.

just to clarify, this is the setup I'm having problems with:

Arduino mini pro 3.3v with:
- IR transmitter cathode on Pin 3, anode to ground via a 100 ohm resistor. (I also tried with a transistor amplifier, and it still doesn't work)
- RGB strip with red green and blue on pin 7,8,9

this is basically the code I'm running :

C:
#include <IRremote.h>
#include <IRremoteInt.h>

IRsend irsend;
int buttonPin = 6;
int pinR = 7, pinG = 8, pinB = 9;
int switchState = 0;
int keepEmitting = 1; // 0 if you want it to work with the button, 1 to keep emitting
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
white();
}

void loop() {
if (switchState == HIGH || keepEmitting == 1 ) {
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xa90, 12); // Sony TV power code
Serial.print("Code sent \n");
delay(500);

}
} else if (switchState == LOW){
}
}

/* note: this rgb strip has a voltage connection and 3 color connection,
so LOW means current is flowing through that particolar color */

void white(){
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinB, LOW);
}
it just keeps the strip white while emitting the infrared signal, but the signal emitter still doesn't work even though it does with every other arduino

Last edited by a moderator:

#### Raymond Genovese

Joined Mar 5, 2016
1,658
- RGB strip with red green and blue on pin 7,8,9
it runs on a 3.7 battery and the serial connection works only at 4800 baud rate.
There is something wrong. I suspect the battery. You can easily test this out by replacing the battery with a good 5V 1A supply into the raw pin on the Pro Mini. How much current is used by each LED strip? Can the Pro Mini port pins provide that much?

But, before that, I don't understand what it is you are doing. You are sending a code using the IR LED to what?? To another Arduino that has an IR receiver and the LED strips? Where is White() called? What is operating the RGB pins apart from White() which is never called?

#### flash01694

Joined Mar 7, 2018
26
There is something wrong. I suspect the battery. You can easily test this out by replacing the battery with a good 5V 1A supply into the raw pin on the Pro Mini. How much current is used by each LED strip? Can the Pro Mini port pins provide that much?

But, before that, I don't understand what it is you are doing. You are sending a code using the IR LED to what?? To another Arduino that has an IR receiver and the LED strips? Where is White() called? What is operating the RGB pins apart from White() which is never called?
I tried with a usb power source and it still doesn't work.

I was also thinking it might be a current factor, I mean the pro mini can supply 20 mA on every output and a 150mA maximum output combined or through the Vout pin, but if that was the case wouldn't it be working with a transistor?

the strip should draw 20mA from each of the 3 colors so 60mA total

what I'm doing it's a test circuit for a laser game project I'm working on, and since the "gun" will have an IR sender and an rgb led I was trying to figure out how to make that work

white it's called in the loop function I think but it's just to turn the strip on to simulate the current draw

BTW to test the IR sender I use an arduino IR receiver circuit which basically blinks a led if it receives anything (that works fine and I'm sure of that).