1
\$\begingroup\$

I am pretty new to electronics and trying to learn some basics. What I am having trouble with is how to figure what resistor value to use. I'll put links in to the data sheets of the parts I am using. If someone could explain the formulas I'd greatly appreciate it. Here is the setup I have... I have an MCU that produces 3.3V and max rating of 20mA. I really want to stay between 5mA - 10mA on each pin. What I would like to do is use the MCU + tinyled + solid state relay (which has small led in it) + resistor (or maybe no resistor?).

So we have 3.3V to work with.

The led I was thinking of using 550-1304 on this datasheet.

Then in series with this solid state relay.

So here is what I got to but I don't know if it is correct or not:

3.3V - 1.8V (Vf of the led) - 1.15V (Vf of led in SSR) = 0.25V (So my resistor needs to handle 0.25V?)

3mA is needed to activate the SSR, and it looks like 2mA is needed to make the led light up, so I am guessing 5mA.

I then took that for the Ohm's law formula, R = V / I which I did this: R = 0.25 / 0.005, R = 50. Is this the correct way to do it? And I am hooking these up in series, how do I know that the led is going to get 2mA and the SSR 3mA and that they don't share it equally i.e. both get 2.5mA? How do I determine how much each component uses? Also is this the correct formula to figure out what I need? I was trying to keep my part count down and not have to throw in a transistor if possible since the pins seem capable of driving the 5mA load. Some insight and general how you figure it out info would be great to see. Thanks!!

\$\endgroup\$
  • \$\begingroup\$ The "Test current" rating on the datasheet for your low current LED is 2mA. (On the standard ones on the datasheet its 20mA) So it's not clear to me whether its recommended or not that you push 5~10mA through it. \$\endgroup\$ – Wesley Lee Oct 29 '17 at 2:22
0
\$\begingroup\$

3.3V - 1.8V (Vf of the led) - 1.15V (Vf of led in SSR) = 0.25V (So my resistor needs to handle 0.25V?)

3mA is needed to activate the SSR, and it looks like 2mA is needed to make the led light up, so I am guessing 5mA.

Current is the same for all the elements that are in series, but voltage is dropped at each element. (In parallel the voltage is the same, but the current is shared/divided).

Assuming your LED is rated for 2mA and that your SSR requires 3mA to turn on, you cannot put them in series without:

  • Exceeding the recommended current of the LED, or
  • Not be guaranteed to turn the SSR on

Both are unwanted scenarios, so you have to go with another route.

Considering that a GPIO on your MCU can source 20mA, even if we stay within the desired ~10mA, you could wire them in parallel:

schematic

simulate this circuit – Schematic created using CircuitLab

Calculating R LED:

Vled = Vtotal - Vforward

3.3V - 1.8V = 1.5V

U = R * i

1.5V = Rled * 2mA

Rled = 1.5V/0.002A = 750R (Which is a standard value, so you can use this or use the next higher one)

Calculating R SSR:

If we aim at 5mA (3mA + 2mA margin), datasheet says about 1.1Vf.

So, same thing:

(3.3V - 1.1V) = Rssr * 5mA

Rssr = 2.2V / 0.005A = 440R (which isn't a standard value, so you can use 420R which should give a bit more than 5mA, or 470R which will give a bit less)

enter image description here

So, in total, you have 2mA for the LED + ~5mA for the SSR, so about 7mA coming from your pin.

schematic

simulate this circuit

So, in summary, you got Ohms law right, but you got the series current wrong. :)

\$\endgroup\$
  • \$\begingroup\$ Thank you so much for your explanation. Very helpful, lol I have a lot to learn \$\endgroup\$ – bri Oct 29 '17 at 2:44
  • \$\begingroup\$ @bri - glad to be of help. I just added a second schematic showing current and voltages, might be helpful. \$\endgroup\$ – Wesley Lee Oct 29 '17 at 2:45
  • \$\begingroup\$ @bri - p.s.: you could put both LEDs in series if you used one rated for more than 3mA (most of them are). Then, assuming 1.8Vf and 1.1Vf again, and 5mA If, R = 80 Ohm \$\endgroup\$ – Wesley Lee Oct 29 '17 at 2:52
  • \$\begingroup\$ if I get my led vf and ssr vf to total to 3.3v and both are 5ma draw, can I skip the resistor and be in series? 1.1vf + 2.2vf \$\endgroup\$ – bri Oct 29 '17 at 5:19
  • \$\begingroup\$ In practice no. Variations in production, operating temperature, etc will throw current around very fast through the I/V curve (i.e.: a small bump in the predicted Vf characteristic could throw your current way up). If you tried that, it would possibly work (vide tons of Arduino examples with no resistors), but its bad practice. \$\endgroup\$ – Wesley Lee Oct 29 '17 at 5:36
0
\$\begingroup\$

It is easier if one has tight spec tolerances on Vdd, Vf , and use a low current 2-5mA at desired intensity, Iv which varies from 10 to 10k mcd. Since every device has a threshold and incremental knee resistance Including BJT’s , FET’s LEDs you can estimate from the stack up of ESR or RdsOn tolerances. Then with better Ultrabright LED , the lower the current, the lower Vf is from Vth+I*ESR where ESR is knee R slope often ~15 ohms for 5mm LEDs with 3.3V MCU port in the 50 ohm range (Vol/Iol) with 50% tolerance.

Depending on function of SSR you may consider direct drive both IR and Red/Yellow LED in series from 3.3V CMOS logic port. The SSR is an excellent choice when you need to receive logic from a long twisted pair cable to get better ground and AC line stray noise isolation with a 2 ohm switch but overkill for driving a local indicator LED.

Vth It is easier if one has tight spec tolerances on Vdd, Vf , and use s low current 2-5mA at desired intensity, Iv which varies from 10 to 10k mcd. Since every device has a threshold and incremental knee resistance Including BJT’s , FET’s LEDs you can estimate from the stack up of ESR or RdsOn tolerances. Then with better Ultrabright LED , the lower the current, the lower Vf is from Vth+I*ESR where ESR is knee R slope often ~15 ohms for 5mm LEDs with 3.3V MCU port in the 50 ohm range (Vol/Iol) with 50% tolerance. Depending on function of SSR you may consider direct drive both IR and Red/Yellow LED in series from 3.3V CMOS logic port .

Item ~ Vth threshold ~ ESR (Ohms 50%)•• Vf=Vth+If*ESR

  • R\Y led ~ 1.8V ~ 16 ohms AlGaAs @10mA , get 1k~10k mcd
  • IR led ~ 0.9V ~ 10 ohms
  • 3.3V rated logic 33 ohms
  • 5V rated logic 66 ohms
  • 18V CD4xxx logic 300 ohms
  • ESR will rise when Vdd drops due to Vgs/Vgs(th) ratio ( >3 ideally)

example

5V MCU run at 3.3V has higher ESR (Vol/Iol) than MCU or logic rated for 3.3V ( e.g. ARM)

Eyes are somewhat log scale to LED intensity ,Iv.

Actual LED current , ESR and choice of series R depends on quality choices and batch to batch tolerances.

Alternatively, If you computed R for 0.12 V drop for 5 mA that would be 24 ohms but then you will understand tolerances better now when your test result is 0.1V or 0.2V

Often very low tolerance in single batch.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.