I'm looking for some electronics guidance as I'm an ex-coder trying to learn new things.
I built the classic Arduino robot-car which now crashes round the living room occasionally obeying my ultrasonic sensor code, amusing my wife and kids. Next I want it to track down an IR beacon.
I thought I would use I high powered IR emitter LED which seems to be ~1.6v 100mA. super bright LED
The normal IR LEDs seem to be around 20mA. I believe the Uno can drive around 40mA, so how can I construct something for an uno to send IR signals at 100mA to have a big range?
(Or am I trying to use a sledghammer when I only need a claw hammer? )
I plan to use the standard Arduino IR libraries.
Any guidance would be greatly received, please note I'm VERY new to electronics, so please use simple concepts if you can
I worked once on an IR transmission with 2 UNO (for fun and learning). I used an IR led I get on a pointer device, so I assume it was a weak power model like the "20mA".
The 2 first IR led I connected to my UNO burnt in 1 or 2 seconds. I keep the third alive by generating a roughly 40KHz signal in pin connected to the led.
My conclusion is IR led I used was not intented to be ligted on all time. I presume continuous fonctionning release to much heat from the led and destroy it.
So for your project, it will clearly lower your emmitting power but I feel you can power it up through nude UNO or others if you manage the powering. That could be good for testing without the need of others hardware.
have you info I could read about a specific way to power the IR Led you talk about?
EDIT: now I see your link for the led in you post!
Many thanks, I suspected that would be the right direction, but wasn't certain. I fell down the rabbit hole googling for transistors, wow there are lots! However I think I found the right choice by sticking to microcontroller websites.
A follow-up question would this [n-channel-power-mosfet IRLB8721PbF] (N-channel power MOSFET (30V 60A) | The Pi Hut) work?
I tried to read the datasheet, but I'm not certain what I'm reading. I want to trigger the transistor with 3.3v (using an esp32 dev board). The gate threshold min is 1.35 and max is 2.35v, does that mean 3.3 is too high?
(Maybe this cheaper one Transistor BD135? but I really couldn't find what I was looking for on that!)
Can I really send 1.5 V 100 mA across the source to drain? (if that's the right terminology)
Can it really work at the same speed as the IR signal frequency from the microcontroller?
Many thanks for the patience for the simple questions.
When I bought my arduino it had a box of electronic "stuff I didn't understand" with it. Based on the advice above I looked and found a PN2222 transistor. I found a great blog post doing a very similar task to what I'm doing DIY Engineers 2n2222 transistor
He works through the datasheet and the maths needed to prove you won't turn your electonics into melted plastic and blue smoke. I'll see if I can give it a try this week.
I feel like I'm close, but I've run out of steam. I have a page full of attempts to bend ohms law to my bidding but i'm missing some fundamentals I think.
In my Arduino box of wonders, I also found a power module, so I can simulate the power from a bettery 5v and the power from the esp32 3.3v. I have a red LED, 2n2222 transistor, a collection of resistors and a multi-meter.
I'm following the blog post above. I'm not certain what values to put in my resistors. I put the details below if anybody has the patience to help? (I'm not sure if I created the curicit diagram correctly, I've not drawn one before)
I haven't put the resistor to the middle leg as I couldn't figure out what value to use from the 3.3 v to the middle leg. (R1 in the circuit diagram. )
Hopefully somebody in the forum can shed some light for me.
I think I figured out the R2 resistor, but it wouldn't hurt for somebody to verify it, to save me frying something!
Not a problem. The datasheet shows a maximum Gate-Source voltage (Vgs) of 20V. You want a low turn-on voltage. (Some MOSFETs need about 10V.)
A regular NPN transistor might be better in this case. A transistor turns fully-on with about 0.7V between the base and emitter.
Most transistors (and MOSFETs) can handle 100mA but you should check the datasheet and leave some safety margin. The power supply voltage shouldn't be a problem either.
...There is more voltage-loss across a regular transistor and with current that gets translated to power (and the related heat). So when you're switching high current the MOSFET has the advantage.
(The circuits are a little different so transistors & MOSFETs aren't drop-in replacements for each other.)
Collector circuit: supply 5V, minus forward voltage of the LED 2V, minus saturation voltage of the transistor 0.5V leaves 2.5V for the resistor. Ohm’s law: 2.5V / 130 Ω = (rounded) 20mA.
Problem is the enormous spread in actual performance of transistors, even within a batch of a manufacturer, let alone different types and models. An amplification factor of 20 is a safe bet, that makes a base current of 1mA.
Microcontroller supply voltage 3.3V and output voltage 0.8VDD = 2.6V, minus base voltage of the transistor 0.6V leaves 2V for the resistor. Ohm’s law: 2V / 1mA = 2kΩ. Your box of “stuff” will probably contain resistors of 1kΩ, a standard value. Good enough.
Any of the transistors you named will work. Even the FET will work in this circuit (the resistor to the gate is not really functional, but it protects your output, keep the 1kΩ).
If you want to go up to 100mA you need to redo this calculation for both resistors.
@stitech that's great, thank you very much. I had calculated the first resistor based on 15 mA, so it looks like you've confirmed the calculation.
I'm confident I'll have a 1k resistor in my box of stuff, it's turning out to be well provisioned.
Thank you for the calculations, it'll take me a while to figure out what you did, but that's part of the process When I gain some confidence I'll try to redo the numbers with the super bright LED.
I get roughly 2 to 3 meters of range (direct view, no obstacle of course, and indoor) with an IR led and the corresponding detector picked up from a broken pointer device. (2 UNO devices: one emitter, one receiver).
It is clearly a weak and cheap IR led (but at least with a coating to block some visible light), so I can't wait what range you could get with the power one.
By the way, here's a popular hint: Infra red are invisible to human eye, but any camera on a cellphone would see it. It is a good way to test your circuit.
@GrandPete that's good to know. My plan is to place the receiver in a small tube, to make its field of view very limited, then mount that on the front of my little robot on a little servo. The servo will sweep 180 degrees and hopefully at a certain position, it will receive a clear signal from the IR beacon.
I should then be able to move the car in the right direction and try again, until I reach the beacon (or likely crash into it and most things round it). I've got an ultrasonic distance sensor to try and reduce head-on crashes. I have still mounted some components with elastic bands and velcro, to mitigate the damage!
yeah my first attempts with "stop the motors if too close to a wall" was direct crashes!
but I am not ready for the "seek your base through beacon", I have too much work remaining on the IMU.
the tube option is interesting. It could lower too much the window detection. What about putting reflective surface (aluminium foil?) in the inner surface of the tube?
Hi,
I did some more study and now I think I'm really close, but my answer for the resistor R1 is huge. I got a pen and paper (and a dog treat by the look of the photo) and wrote it out.
At the risk of sounding like I'm asking somebody to mark my homework, could somebody verify my scribbles please?
Assuming you can read it.