# What is the best circuit simulation for beginners/novices?

#### danwbangor91

Joined Feb 8, 2017
22
Hi

I have spent all day trying to find out whether or not my proposed circuit plan will work or not. I have a very basic understanding of some electrical components. I have spent the last few days trying to design a circuit for my planned project involving sequential LEDs using a Picaxe microcontroller, NPN transistors and P-Channel JFETs.

I have used EagleCAD, CircuitMaker, DesignSparkPCB and numerous online programs to try and simulate my circuit but NONE have helped me.

So where should I turn? The schematic of my circuit is attached if anyone would like to help. It's a relatively simple circuit so I can't see why this has been so difficult for me.

For reference: the picaxe output pins are to be programmed such that the base of each transistor receives power at a different interval. Output pins that are attached to a transistor and a JFET are meant to power the base of the LED's transistor and the gate of the previous LED's JFET, effectively opening the previous LED's connection to GND and allowing the current to flow to the next LED (when the transistor allows current to flow from C to E).

Any help would be GREATLY appreciated. Many thanks.

#### Attachments

• 59.5 KB Views: 16

#### AlbertHall

Joined Jun 4, 2014
9,830
I haven't got anything which will open that file. I thought it might be an eagle schematic but apparently not.

#### danwbangor91

Joined Feb 8, 2017
22

PDF attached

#### Attachments

• 75.3 KB Views: 23

#### spinnaker

Joined Oct 29, 2009
7,835
Only the very expensive simulators will simulate something like a picaxe. I certainly have not seen a free one.

#### crutschow

Joined Mar 14, 2008
24,942
I don't know anything free that can simulate the Picaxe but Ltspice is a good, free simulator from Linear Technology that is used by several of us on these forums, and can simulate everything else.
You just have to add signal sources to emulate the outputs from the Picaxe.
Ltspice has a somewhat steep learning curve, but there are good tutorials on it to help you get started, with many example circuits to show how it works.

#### AlbertHall

Joined Jun 4, 2014
9,830
Let me see if I understand what it is supposed to do. No LEDs lit; one LED lit; two LEDs lit ... ten LEDs lit, depending on the control inputs.
If that's wrong please correct me.

One problem I see is that there is no current limit for the string of LEDs. You cannot use a resistor as the voltage drop will vary considerably depending on how many are lit, so you will need some sort of constant current source to feed the top of the string.

You should also have current limit resistors for the bases of the transistors.
There is also a problem with the JFET current handling. These must carry the LED current but the specification for the JFET shows this maximum current may be as low as 1.5mA. See below.

Why can you not use a picaxe pin to drive a transistor for each LED like this.

#### spinnaker

Joined Oct 29, 2009
7,835
And depending on the LED the picaxe should be able to drive the LED direct. I don't understand the need for this overly complex circuit for such a simple function.

#### danwbangor91

Joined Feb 8, 2017
22
With regards to picaxe simulation, I did try to work around this by implementing simple push-switches to represent pin outputs, but still coukd not simulate the circuit on any software.

Let me see if I understand what it is supposed to do. No LEDs lit; one LED lit; two LEDs lit ... ten LEDs lit, depending on the control inputs.
If that's wrong please correct me.

One problem I see is that there is no current limit for the string of LEDs. You cannot use a resistor as the voltage drop will vary considerably depending on how many are lit, so you will need some sort of constant current source to feed the top of the string.

You should also have current limit resistors for the bases of the transistors.
There is also a problem with the JFET current handling. These must carry the LED current but the specification for the JFET shows this maximum current may be as low as 1.5mA. See below.

Why can you not use a picaxe pin to drive a transistor for each LED like this.

View attachment 120214
That was my initial plan, but the driver that will power the LEDs outputs 350ma of constant current, and varies the voltage output accordingly (it's the Luxdrive Flexblock driver). Because of the fixed current output I presumed I'd need two parallel strings of LEDs (175ma each), with as many in series as the max V output of the driver will allow.

Regarding the JFETs, is there anything else besides a bulky relay that would serve the same purpose? Ie. Allow current to pass from Source to Drain until the Gate receives power, and subsequently blocks current from S to D?

Thanks for all your help so far.

#### danwbangor91

Joined Feb 8, 2017
22
And depending on the LED the picaxe should be able to drive the LED direct. I don't understand the need for this overly complex circuit for such a simple function.
I honestly didn't consider that as I assumed this would require each LED to have a separate driver, especially as each LED needs 175mA. BTW I'm so hung up on the LEDs being driven properly (in case you haven't noticed lol) because this project is meant to be for automotive use.

#### AlbertHall

Joined Jun 4, 2014
9,830
Do away with FETs, connect the emitters of the transistors to 0V. Then when a transistor is turned on it will divert the current to 0V at that point so only the LEDs above that point will light.

I don't know how well these LEDS cope with being in parallel. It isn't usually a good idea as there's no guarantee that they will share the current equally. Also, you could have different numbers of LEDs lit in the two strings as they would need different voltages.

#### danwbangor91

Joined Feb 8, 2017
22
Do away with FETs, connect the emitters of the transistors to 0V. Then when a transistor is turned on it will divert the current to 0V at that point so only the LEDs above that point will light.

I don't know how well these LEDS cope with being in parallel. It isn't usually a good idea as there's no guarantee that they will share the current equally. Also, you could have different numbers of LEDs lit in the two strings as they would need different voltages.
Regarding the parallel LEDs, I thought of this and then forgot about it, so thanks for pointing it out. The solution to this was that both strings would have the same amount of LEDs lit at the exact same time- I assumed the current would split [almost) equally.

About the transistor solution you gave, wouldn't a transistor with its collector connected between the cathode of LED1 and anode of LED2 prevent current from flowing through LED2, even if LED2's cathode was connected to GND, for example? I was always told that electricity 'finds the path of least resistance,' which I assume would be the transistor rather than a 175ma LED

#### AlbertHall

Joined Jun 4, 2014
9,830
About the transistor solution you gave, wouldn't a transistor with its collector connected between the cathode of LED1 and anode of LED2 prevent current from flowing through LED2, even if LED2's cathode was connected to GND, for example? I was always told that electricity 'finds the path of least resistance,' which I assume would be the transistor rather than a 175ma LED
But when the transistor is turned off (base = 0V) there will be no collector current so the 175mA will carry on to the next LED.

#### danwbangor91

Joined Feb 8, 2017
22
But when the transistor is turned off (base = 0V) there will be no collector current so the 175mA will carry on to the next LED.
Yes, but I wasn't sure if the microcontroller could switch two outputs at precisely the same time, this would alleviate my problems perfectly but I didn't want to run the risk of the LEDs flashing on and off between switching, ie. LED1 goes off for a short time before LED1 and LED2 lights up (because of any possible delays in picaxe output changes or transistors functioning).

If I could program the picaxe to switch immediately (ie. quicker than the naked eye can judge LED1 going from on-off-on) then I suppose I have over-complicated this...

If the above does work, and I insert current limiting resistors in series with the transistors, and ensure both parallel strings carry more-or-less the same current at any given time, do you think that the circuit would work and I could start looking into pcb design?

Thanks so much for all of your help so far, I appreciate the time you've spent helping me

#### AlbertHall

Joined Jun 4, 2014
9,830
The time between switching pins will be much less than your eye can see.
In any case it won't matter if you handle the pins correctly.
All transistors on, just the one LED lit. Then you switch off the top transistor (one action) and now you have two LEDs lit and so on down the chain.

#### danwbangor91

Joined Feb 8, 2017
22
The time between switching pins will be much less than your eye can see.
In any case it won't matter if you handle the pins correctly.
All transistors on, just the one LED lit. Then you switch off the top transistor (one action) and now you have two LEDs lit and so on down the chain.
Now that's some thinking, amazing what experience brings lol. Thanks so much Albert, you've probably saved me hours of wasted time

#### spinnaker

Joined Oct 29, 2009
7,835
I honestly didn't consider that as I assumed this would require each LED to have a separate driver, especially as each LED needs 175mA. BTW I'm so hung up on the LEDs being driven properly (in case you haven't noticed lol) because this project is meant to be for automotive use.
OK these are general purpose LEDs then which will be much, much lower. Have you considered logic level mosfets? Probably a lot easier way yo go.

#### AlbertHall

Joined Jun 4, 2014
9,830
Incidentally, as stated before you will need resistors between the picaxe and the transistor bases. About 220Ω should do the job.

#### shortbus

Joined Sep 30, 2009
7,676
Probably a dumb question, but if you just want to display a series of led's to show how something is changing, wouldn't a LM3914 work? No uc involved.

#### Willen

Joined Nov 13, 2015
294
Try www.falstad.com/circuit for the really beginning. It do not need software download and installation. It's online simulator and output display seems awesome like in real. Just need flash web enabled web browser in a computer with internet.

Last edited:

#### danwbangor91

Joined Feb 8, 2017
22
OK these are general purpose LEDs then which will be much, much lower. Have you considered logic level mosfets? Probably a lot easier way yo go.
Ok so since seeing this I did a bit of reading up and thought this was a better idea- a resistor in series with the MOSFETS will not be needed (I THINK) as they work from voltage rather than current- each output pin of the Picaxe can only output 20mA max. They also seem to be able to switch faster than BJTs which is ideal.

So I've done another schematic (attached), which includes (to my theory) a way to run the LEDs at full or half of the operating current- so that they can be dimmed. The reason that there are two parallel MOSFETs at the top is because the max voltage these can handle is 20V (I need about 30-35V), so I've effectively split the voltage between the two.

Each MOSFET gate will be connected to a separate Picaxe output pin. So my thinking is that if MOS1 receives gate voltage, the first two LEDs will light up in parallel (150mA each from 300mA source).
If only MOS5 and MOS3 receive gate voltage, four LEDs will light up in a series of 2 parallel strings (150mA per LED).
If only MOS5, MOS2 and MOS4 receive gate voltage, four LEDs will light up as 2 parallel strings of 2 parallel LEDs (75mA per LED).

The MOSFETs I've selected, based on my limited knowledge, are
HTML:
http://uk.farnell.com/nxp/pmzb290une/mosfet-n-ch-20v-1a-sot883b/dp/2114785?exaMfpn=true&categoryId=&searchRef=SearchLookAhead&searchView=table&iscrfnonsku=false
Please could you help point me in the right direction if these are incompatible for any reason?

So how does this look? I've spent ages on this lol. Any advice would be greatly appreciated.

#### Attachments

• 45.4 KB Views: 5