Do I need a resistor?

Hi, long time hacker first time Arduino-er. Wishing I'd started earlier, it's a lot simpler than a Raspberry Pi!

I've bought one of these old buttons from a tube carriage and am in the process of making it light up and trigger some action on the network when you press it. I've gone with an Arduino Nano 33 iot to drive it, i've got a force sensitive resistor to trigger when it's pressed, all that seems to be working fine.

First question: I've got a system of 8 LEDs in series embedded within the button. They've each got a forward current of 20mA with a forward voltage of 3.2 to 3.8v. Since I'm running these at 3.3v off the Nano, do I need to put a resistor in? All the calculators spit out zero because the input and the forward voltage are (I guess) the same. But I don't want to burn out the LEDs, soldering them took a while. If I do need one, can anyone help me work out the right resistance?

Second question: is it OK to drive the LEDs by taking the output of multiple (4) PWM pins combined to increase the brightness? I originally tested them with the voltage pin, hadn't realised at that point that I was going to need to use the PWM pins if I wanted to turn the LEDs on and off, and using one of those makes them substantially dimmer.

Advice gratefully received!

Dave.

Yes, you always need a resistor.

8 LEDs of that sort in series will require above 25V to light. Please post a hand drawn wiring diagram.

is it OK to drive the LEDs by taking the output of multiple (4) PWM pins combined to increase the brightness?

No, that will destroy the outputs, as they are not synchronized.

Use a separate power supply with a transistor switch and drive the lot with a single PWM output.

Hi,
Ops buttons;


Button from London Jubilee Line underground tube train. :slight_smile:
Tom... :slight_smile:

LameDave:
First question: I've got a system of 8 LEDs in series embedded within the button. They've each got a forward current of 20mA with a forward voltage of 3.2 to 3.8v.

Second question: is it OK to drive the LEDs by taking the output of multiple (4) PWM pins combined to increase the brightness? I originally tested them with the voltage pin, hadn't realised at that point that I was going to need to use the PWM pins if I wanted to turn the LEDs on and off, and using one of those makes them substantially dimmer.

Advice gratefully received!

Dave.

Because you have the LEDs is series, the forward volt drop ADD together to give you about 25V TOTAL volt drop.
As you are only using 3.3V as a supply, they will never conduct and draw current.
Do you want to DIM the LEDS?
If not you can use the PWM pins as digital pins to just turn the LED ON or OFF.
Tom... :slight_smile:

Good point, I mean in parallel don't I! For the LEDs, something like the diagram below. Not shown: force sensitive resistor across the 3.3v pin and other ground, feeding a result into A0 so it knows then to turn LEDs on.

circuit
arduino.png

Bonus: the actual beast

You are limited to 20 mA per port pin on a standard Arduino.

Please post images in line as shown in the link below.
Image posting guide

Yeah, I saw the 20mA thing mentioned, saw above that combining multiple is meant to be bad because of synchronisation of the outputs. It does seem to work, though - the LEDs turn on and off, and they're brighter than a single pin...

(attempting to upload images properly now, they'll appear above when it works)

[images added by Moderator]
arduino.png

arduino.png

is there any reason not to combine the output from multiple pins for more current?

Yes.

I explained the reason in reply #1. Please take a moment to read it.

The circuit you posted in reply #4 won't work, and may destroy the Arduino. LEDs generally cannot be connected in parallel, as you propose.

jremington:
Yes.

I explained the reason in reply #1. Please take a moment to read it.

The circuit you posted in reply #4 won't work, and may destroy the Arduino. LEDs generally cannot be connected in parallel, as you propose.

I did read it, and I appreciate the help - the thing I'm confused about is that as you can see, functionally, it does work. So if anything it's got to be a question of reliability/lifespan...

You're gonna smoke the Arduino pin, and perhaps damage the entire '328P chip, wiring it up like that. Maybe not immediately, but surely before not too long. Each IO pin has an absolute max of 40mA, 8 LEDs with no current limit resistors will draw that easy.

Preferred approach is one resistor in series with each LED. At a minimum one between D13 and all the anodes, or between all the cathodes and Gnd.

CrossRoads:
You're gonna smoke the Arduino pin, and perhaps damage the entire '328P chip, wiring it up like that. Maybe not immediately, but surely before not too long. Each IO pin has an absolute max of 40mA, 8 LEDs with no current limit resistors will draw that easy.

Preferred approach is one resistor in series with each LED. At a minimum one between D13 and all the anodes, or between all the cathodes and Gnd.

OK, cool. Any idea what resistance I need?

I'd power those LEDs at 5V for starters, due to the high Vf.

Cathodes can be linked together, and switched using an NPN transistor (1k base resistance should do) or n-channel MOSFET (must be one that's on properly at 3.3V, many logic level MOSFETs are not!), which needs a 330R gate resistance & 10k pull-down on the gate.

Then just calculate the resistance using a LED calculator. If using an NPN mind the additional 0.2-0.3V drop.

10 mA is normally enough to light up the LEDs nice and brightly.

So if anything it's got to be a question of reliability/lifespan

Exactly. "Work" means function as planned, for a long time.

You seem to have been lucky so far, but all of us have learned that lesson, either instantaneously, or a while later.

So much misconception in a single thread.

Driving a LED without some current limiting is dangerous. This is true. But many people believe in too simplified model of electronics. In reality with 3V3 supply

  1. Arduino output drivers have non-negligible resistance. It is higher at higher temperature, lower supply voltage and higher current drain. It is impossible to get 40mA of current from an Arduino pin with any reasonable amount (let say <100) small signal white LEDs - even if they are all parallel without current limiting resistor.

  2. I did not test it but I believe even direct short between OUTPUT LOW and OUTPUT HIGH won’t cause 40mA of current. It is bad to do this but I doubt a short drive contention for a brief period (like 1 ms) from time to time can cause much harm.

  3. LEDs are not perfect diodes. They start conducting at much less than nominal voltage and with increasing current the voltage is higher than nominal.

  4. All wires and connectors have some internal resistance as well as any power source.

Conclusion: ideal solution would be to power the LEDs from a higher voltage with every LED having its own current limiting element (resistor or even a constant current source).

You have already soldered them in parallel - I wouldn’t change this. Of course the current will be distributed unevenly between the LEDs. Due to logarithmic nature of human senses you will probably never notice this and there is minimal risk the LEDs will be damaged if you drive them at reasonable current. From the photo it looks like “normal” small signal LEDs, I would target for about 10mA per LED average as maximum.

To increase the current for the LEDs there are two options - either connect more Arduino pins in parallel or use a transistor. For Arduino pins you do not need a current limiting resistor. However you should ensure all PWM pins switch synchronously - it is not hard and there will be no doubt the pins are safe.
If you decide to use a transistor there may be a need for a current limiting resistor - it depends on the power source, transistor used and resistance of the wiring to the LEDs. The best way is to measure the current the LEDs consume. But beware - depending on connector type there may be some resistance in the connection (about single Ohms) and it changes with every move. I think when using a transistor it would be better to power the LEDs from some higher voltage source and use low side switching + current limiting resistor.

It all also depends how “brave” you are - mostly the shame caused when something fails. If it is for yourself and you can easily replace a damaged part (and make it “safer”) you may be much more careless. The only way to find the limits is to try to push them.