EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: risshuu on December 12, 2016, 09:16:41 am
-
I want to drive an IR LED with my Raspberry Pi 3. At first I did this project with an Arduino because it was easier to record the IR codes on it and then test them.
For some reason, the IR is brighter on the Arduino (it can reach my fan from across the room, but I have to bring the fan within 4 feet or so of the Pi when using the same circuit.
In both setups I am using a 2n3904 with 5 volts from the devices and two 10-ohm 1-Watt resistors in series.
Why would I be getting such different results between the two platforms?
Thanks
-
I want to drive an IR LED with my Raspberry Pi 3. At first I did this project with an Arduino because it was easier to record the IR codes on it and then test them.
For some reason, the IR is brighter on the Arduino (it can reach my fan from across the room, but I have to bring the fan within 4 feet or so of the Pi when using the same circuit.
In both setups I am using a 2n3904 with 5 volts from the devices and two 10-ohm 1-Watt resistors in series.
Why would I be getting such different results between the two platforms?
Thanks
Your Pi's voltage is 3.3V where as your Arduino is Likely 5V.
I could imagine it's the gain on your transistor. If you tried a mosfet instead I bet you'd be better off.
-
What do you mean that my Pi's voltage is 3.3v? I'm using the 5v pin. Sorry if this is a stupid question; I am new at this.
-
What do you mean that my Pi's voltage is 3.3v? I'm using the 5v pin. Sorry if this is a stupid question; I am new at this.
The actual Logic I/O on the RPi is 3.3V
-
Oh okay. So you mean the pin that I have connected to the base of the transistor.
Thanks
-
Oh okay. So you mean the pin that I have connected to the base of the transistor.
Yes.
Maybe.
A simple schematic would help a lot. Just draw the circuit and photograph it.
-
This is the first circuit I have ever "drawn". I couldn't find a VCC like I have seen on other diagrams, so I just used the one in the picture. It is positive 5V from the device and ground on the device.
This is how I originally did it. For some reason I used a 100 ohm resistor to the base with the arduino, but a 10k ohm resistor with the Pi. Is this what could have been causing my problem? I didn't think that the amount of current on the base would matter at all. I switched out the Pi's resistor to a 100 ohm resistor and it seems I am getting more range, but nowhere near what I want.
Let me know what you think.
Thanks
-
Let us do some calculations based on your diagram.
The 2n3904 has a base emitter voltage, as is typical for BJT, of about 0.7v, and an IR led, I don't remember but let's say it's about 1.7 Forward Voltage.
With 100R and 5v (Arduino output) on the base, you have in the region of
( 5v - 0.7v (Vbe) - 1.7v (Vfwd) ) / 100 = 26mA through the Base-Emitter
this should be well into the saturation of the transistor ( "full throttle" in other words ).
With 10k and 3v3 (Pi Output) on the base, you have in the region of
( 3v3 - 0.7v (Vbe) - 1.7v (Vfwd) ) / 10000 = 0.09mA through the Base-Emitter
which is nowhere even close to saturation, at best maybe you might get 9mA into the LED, probably less.
With 100R and 3v3 on the base you have
( 3v3 - 0.7v (Vbe) - 1.7v (Vfwd) ) / 100 = 9mA through the Base-Emitter
which should in theory be hitting saturation OK, just, but the IO strength of a pi isn't huge, so you may not have 3v3 to start with (or 5v if you are powering the pi from the same supply), or your transistor might be on the low end of the available gain etc.
Try this video for a refresher on BJT basics
https://www.youtube.com/watch?v=ZEDdFjvnAAo (https://www.youtube.com/watch?v=ZEDdFjvnAAo)
-
Try moving the LED to the collector of the BJT-->base current will be higher
-
sleemanj: Thank you so much for the information!
slashguitar: Thanks. I will look into that.