Electrical – MCU + LED + SSR + (how to determine resistor value)

ledmicrocontrollerresistorssolid-state-relay

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!!

Best Answer

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. :)