IR LED brighter on an Arduino than a Raspberry Pi - Page 1
Forum section: electronics / projects

author: risshuu
author_rank: Contributor
timestamp: December 12, 2016, 09:16:41 am
content: 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

author: CM800
author_rank: Frequent Contributor
timestamp: December 12, 2016, 09:29:55 am
content: Quote from: risshuu on December 12, 2016, 09:16:41 amYour Pi's voltage is 3.3V where as your Arduino isLikely5V.I could imagine it's the gain on your transistor. If you tried a mosfet instead I bet you'd be better off.

author: risshuu
author_rank: Contributor
timestamp: December 12, 2016, 09:48:51 am
content: 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 12, 2016, 09:53:10 am
content: Quote from: risshuu on December 12, 2016, 09:48:51 amThe actual Logic I/O on the RPi is 3.3V

author: risshuu
author_rank: Contributor
timestamp: December 12, 2016, 09:55:51 am
content: Oh okay. So you mean the pin that I have connected to the base of the transistor.Thanks

author: Fungus
author_rank: Super Contributor
timestamp: December 12, 2016, 12:59:30 pm
content: Quote from: risshuu on December 12, 2016, 09:55:51 amYes.Maybe.A simple schematic would help a lot. Just draw the circuit and photograph it.

author: risshuu
author_rank: Contributor
timestamp: December 13, 2016, 06:58:17 am
content: 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

author: sleemanj
author_rank: Super Contributor
timestamp: December 13, 2016, 07:37:27 am
content: 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-Emitterthis 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-Emitterwhich 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-Emitterwhich 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

author: slashguitar
author_rank: Contributor
timestamp: December 13, 2016, 08:47:25 am
content: Try moving the LED to the collector of the BJT-->base current will be higher

author: risshuu
author_rank: Contributor
timestamp: December 13, 2016, 05:13:09 pm
content: sleemanj: Thank you so much for the information!slashguitar: Thanks. I will look into that.