# How close is LTspice to the real world.

#### Pommie

##### Well-Known Member
I have the following (simplified) circuit,

And, according to LTspice the LED current will be 22mA. How accurate is this? The LEDs are rated at 20mA but will be mutiplexed with an average current of ⅓ of that. However, during a crash or update they could be on constantly. The LEDs I'm using state a Vf of 2.8 to 3V, the LEDs chosen have a Vf of 2.9V.

Should I worry about the extra 10% current? Should I change R2 to 170R?

I know there are a few LTspice gurus on here and hope for an answer. Thanks in advance for any help.

Mike. Asc file attached.

#### Attachments

• LEDs.asc
1.8 KB · Views: 1

#### ronsimpson

##### Well-Known Member
Spice is only as good as your component models. and your understanding of components. The Vf is temperature dependent and changes from batch to batch.

I made a LED advertising sign many years ago. We used multiplexing and drove the LEDs hard. If the computer crashes the updating stops and some LEDs got too hot. With a simple circuit we monitored the CPU. It it stopped updating, after 50mS we cleared the LED. The LED driver IC has a reset pin that would turn off all the LEDs. Or you could shut down the LED power supply.

#### crutschow

##### Well-Known Member
As long as the LED forward drop of the simulated LEDs is close to the real value, then I would expect the actual current to be within ±10% of the simulated value.

What's the purpose of the two MOSFETs?

Last edited:

#### augustinetez

##### Active Member
Not an LT user, but a back of the envelope calculation using the assumption of 12 supply for the LED's and ignoring the drop across the transistors, the resistor should be 165 ohms for 20mA.

But what is the MAX If of the LEDS? 20mA is more or less the recommended forward current for a particular brightness and the max If for many LED's is 30mA+.
On that basis, you could safely ignore the extra 10%.

#### Pommie

##### Well-Known Member
Thanks Ron,

The models are all contained in LTspice so I assume (I know, never assume) they're accurate.

To monitor the CPU would be ideal and a watchdog timer the obvious (and simplest) answer. However, this is for beginners to learn programming and WDTs are a somewhat advanced subject. Doing it in hardware would still require the CPU to kick the watchdog circuit - or would it?

I think I'm just going to change the series resistor as modern LEDs are incredibly bright at the rated current - maybe too bright. I've got circuits where the LED current is 3mA and they're very bright.

Mike.

#### Pommie

##### Well-Known Member
What's the purpose of the two MOSFETs?
It's so the logic of turning rows and columns on can be explained as if it was a simple matrix. The top mosfet was added so 5V (CPU pin high or open circuit - assumed protection diodes) would not partially turn on the PNP transistor, causing ghosting. Hence the bottom one was added for consistency. Trying to explain a simple matrix where both row and column have to be high makes it difficult for beginners to grasp.

Mike.

#### Pommie

##### Well-Known Member
But what is the MAX If of the LEDS? 20mA is more or less the recommended forward current for a particular brightness and the max If for many LED's is 30mA+.
On that basis, you could safely ignore the extra 10%.
Just checked the datasheet and glad I did, the forward voltage at 20mA is ~2.1V so my current setup would result in a If of 38mA. So changing the resistor to 300R is probably prudent.

Mike.

#### rjenkinsgb

##### Well-Known Member
To monitor the CPU would be ideal and a watchdog timer the obvious (and simplest) answer. However, this is for beginners to learn programming and WDTs are a somewhat advanced subject. Doing it in hardware would still require the CPU to kick the watchdog circuit - or would it?
You could just add a series capacitor with a pulldown resistor and parallel diode combination to one set of FET drive connections., either row or column.

That should safely limit the ON times without affecting the normal operation or MCU side at all.

#### Pommie

##### Well-Known Member
You could just add a series capacitor with a pulldown resistor and parallel diode combination to one set of FET drive connections., either row or column.

That should safely limit the ON times without affecting the normal operation or MCU side at all.
I like that idea. However, I decided that modern LEDs are too bright at the normal current (20mA in my case) so I'm happy that the average will be ~6mA. Just checked my schematic and the series resistors are 300R so actual current is 19mA and average 6.3mA.

Mike.

##### Active Member
The LT Spice models come mainly from the manufacturer, and often omit
proprietary design effects. Long standing debate over models. So one confirms

For example many RRIO OpAmps exhibit crossover distortion in input xover design
in the N and P MOS structure, thats rarely in model.

Even though this is old I think it still pertainent.

There should be a model standard and a model police force to enforce compliance

Regards, Dana.

#### audioguru

##### Well-Known Member
Simulators usually do not care about overloading voltages or currents so a real circuit might get too hot and fail soon.
Simulators use "typical" specs and do not care about minimum and maximum spec parts that might not work in your circuit.

#### schmitt trigger

##### Well-Known Member
A friend of mine had this saying:
Simulators don’t allow the magic smoke out.

#### Pommie

##### Well-Known Member
A friend of mine had this saying:
Simulators don’t allow the magic smoke out.

Mike.

#### crutschow

##### Well-Known Member
A friend of mine had this saying:
Simulators don’t allow the magic smoke out.
No, but they can usually predict it.

Replies
2
Views
13K
Replies
4
Views
6K
Replies
7
Views
8K
Replies
58
Views
83K
Replies
2
Views
4K