Go Down

Topic: How to control LEDs of my Star Trek Enterprise NCC-1701-A model  (Read 301 times) previous topic - next topic


Hi all,
My (almost) finished model of the Star Trek Enterprise NCC-1701-A is has about 80 different LEDs. They all have a resistor based on 12 Volt supply and I use an Arduino/Atmega328P to control six groups of LEDs (on/off).
I do understand a single Atmega328P-port supplies 5 Volt and between 20m-40mA, but because I am new to elektronics I don't know how to get from one 20mA-40mA, 5 Volt port to control for example a group of 30 LEDs of 20mA each.
Can somebody please tell me:
How to do the math to know what transistor I need?
 What other parts I need?
 What the schematic is to implement/solder this?
Kind regards,
Jan Speyer
 The Netherlands


First things first, that is a really fine ship, I love it!

Now for the problem, its really easy, you need to feed your LEDs a certain amount of current for each of them to glow, while applying a correct voltatge to them.

If you know what the current rating of them is(20mA) then you will add all the currents when you connect them them in parallel.
You also need to know the voltage drop across the LED, so that you know what voltage to apply, if you connect them in series, you want to subtract voltage drops from supply voltage to get how many LEDs you need in a series.

Say you have 30 LEDs
So parallel: 20maX30=600mA, but that will be on about 1.5V supply...
Series:30x1.5V=45V on 20mA supply...
Since none of the above fits you will want to combine the two metods...

For exact formulae take a look at kirchoffs circuit laws.

If your power supply is, lets say 12V, you best put 12/1.5=8 LEDs in series and then parallel those lines of 8 LEDs, 8*4=32
so you will have 4 series lines containing 8 LEDs, that draw 20mA each because the current is the same everywhere in a series connected circuit, you will put those lines in parallel then, since all items in parallel share the same supply voltage, for a total of 80mA draw on 12V. 4*20mA=80mA Total amount of LEDs is 32 in this case

Observe how the current is lower with higher voltage...

you can also make a voltage drop using a resistor instead of an LED as per ohms law, only limit there is resistor power rating.

You say that your LEDs have resistors in series each, you can then put those led/resistor combos in parallel, each will have 20mA draw,but you lose some energy this way for the sake of wiring simplicity, not much, 1.6A is still kind low for 80 of them 19,2W, but considerable because without the resistors it would amount to about 2.4W total I guess, the resistors dissipate more then LEDs in your case but there is maybe no way around it if its the nacelles and you need row by row activation :)

you could perhaps series the row and add a different series resistor to match the voltage
anyways you can combine the two wiring techniques for some energy vs simplicity optimization

For a different supply voltage you can do the same math
note that 1.5V LED drop is maybe not your case (search forward voltage drop to be sure) or multiply 0.02A by your resistor value to get a voltage drop on your resistor and subtract that from 12V

For the control part you will need to chose a tranzistor that is rated higher collector(bjt)/drain(mosfet) current then that you calculate, and higher voltage then your supply, you can choose from bjt(npn) or mosfet(n-channel imho)... my rule of thumb is to go double rating since they are very cheap at this low power range...

to drive a bjt you will need a base resistor to limit the current arduino supplies to it, it will require a very small current (datasheet).

for a mosfet you might want to use a pulldown resistor(can be fairly large) to keep the gate grounded while arduino starts, and a very small gate resistor to keep it from ringing (probably not needed here), and chose a logic level gate voltage so you can drive it directly. MOSFETS don't use current to stay on, just a minuscule jolt to turn on, and need to be discharged to turn off. What they do require is a proper voltage between source and gate

you will want to put your transistor in series to the LED array you want to switch, so that the LEDs are connected to supply positive, colector or drain is after the LED array while the emitter or source is grounded, and connected to arduino ground as well.

If you connect the base or gate of the transistor to your arduino pwm pin and use analog write, you can even fade the group connected to that transistor to chosen brightnesses for extra smoothness.

If you don't care about saving a cent or two by getting the weakest possible optimized transistor that will work take a look at this, for a mosfet
2n3904 is an even cheaper logic level npn bjt that can take 200mA
Since I don't know what LED setup you will use I can't be of more help here

Lastly, your supply should be stabilized, or intended for LEDs, because LEDs don't tolerate overcurrent well that is caused by variations in supply voltage.

Sorry for such a long post, hope you find it as useful as it is long, and get those warp nacelles operational XD


Or use two MAX7219s, each controlling up to 64 individual LEDs, from a 5V supply.
LEDs are multiplexed at 800 Hz, so in reality only 8 are on at any one time.

If the 12V & ED/resistors are already wired up, then TPIC6B595 shift registers can be used instead. Each output can sink 150mA from a 50V source.  12V, no problem. Group LED/resistor in groups  of 7 at 20mA each in parallel, each output could drive one group.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


First things first, is that the real Enterprise NCC-1701-A ?     :o

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.


Or use two MAX7219s,
If the 12V & ED/resistors are already wired up, then TPIC6B595 shift registers can be used instead.

There is a lot of IC variants that can be used for for this sure, forgot to mention it. xD
question now is how does he need the LEDs grouped physically, since he builds fine models I figured it's good to know all options



Thanks Semtex9 for your extensive, meaningful and very technical reply. I am a programmer with hardly any knowledge of electronics. To clearify my 'situation' I have enclosed an image with a part of my scheme.

Thanks to another subscriber of this forum I have managed to delegate the code for the Landinglights and the Deflector Disk to two ATTtiny85's. They don't need extra current to work properly, so that's fine. I also knew to use a L7805 positive power regulator to make a 12 Volt adapter run my 5 Volt Atmega328P.  

Now I would like to resolve the issue of giving current to a group of LEDs, controlled by a single port on my Atmega328P. During the build I glued all the 80 LEDs in the model with each having their own resistor. So I can plug in a 12 Volt adapter to light the model, which looks nice but I want to control the lights. According to their function I have made 7 bundles of grouped LEDs, so practically I have 7 different coloured wires sticking out the front, each of them serving multiple LEDs. As an example: for the main lighting I have put in 30 warm white LEDs with a total of 600mA. From here I'm lost.... I don't know how to solder this on a PCB-board with which components :smiley-confuse: .

Can somebody help me?

Kind regards,
Jan Speyer
The Netherlands 


I apologize for this makeshift drawings... If you just parallel the 8 of them as is, you will have a 160mA current draw, and you want to put resistors in the branches because then the resistor can be weak power rating of 20mA, and it will heat less...
If you series the 8 of them the current draw is 20mA, because you don't waste energy for heating the resistors... in parallel all branch currents add,while voltage is same, while in series voltages add while current is the same, kirchoffs law 1 and 2
Check your LED forward voltage and redo my series resistor calculation if it differs, ohms law for a branch.
Simple as that :)
Instead of the transistor you can also use what crossroads said

How many LEDs in a bundle? What LEDs are they (because forward voltage)

resistor can be swapped for no8 LED in this case, but if the LEDs are 1.2V you will need a resistor even with 8 LEDs, that's why the example...

The last one is n times more eficient, as there is LEDs in a bundle, up to 8 times (12V source) If there are more you will have to combine series and parallel.
I named this bjt only because there are plenty examples working with it and I keep them stocked,
you could use a much weaker one for this series... ~40ma collector current one to be extra safe.... but this one is dirt cheap too

you can't use arduino pin directly because you need that 12V, or a much larger current, and the pin is 4.5 to 5 V and weak, can drive maybe 2LEDs in paralel, and all pins share a maximum dissipation, so you cant drive much with arduino alone

I hope this explains it in detail



Use two MAX7219s.  The cheap matrix driver boards from eBay or Aliexpress in their unassembled form are the easiest to use and will drive 64 LEDs each.  Only one microcontroller needed.

Using a matrix actually makes the wiring easier as you need no more than 16 wires for wherever the 64 LEDs are, you need no resistors beyond the one on the module and the brightness will with proper LEDs, be perfectly adequate.


Using a matrix actually makes the wiring easier.
While I agree, he will still have to make the matrix no?
Also he would need to ditch the 12V for a 5V supply.

Something like this done by https://e-radionica.com/en/blog/hum-led-matrix-8x8-with-the-max7219-driver/  ?


Out of the box again.
Why not use individually addressable LEDs?  No drivers, no complex math to turn them on or off.  Only one data pin needed. No driver transistors.

Something like this

You can cut the wires and put the LEDs anywhere you like.

I am usually so far out of the box that most people don't know what I am talking about.

Please do not ask for help by PM. I will not respond.
If you need help, post a question on the appropriate forum.


 :o this is getting more interesting every time I log in. 


If you are using a BJT to switch, use a 150 ohm base resistor, not 1k or 4k or such high values, as
you want to properly saturate the device so it's dropping only a tiny voltage when on (otherwise
it will heat up rapidly and may fail).

Ideally with a BJT base current = 10% of collector current, when used as a switch, certainly not
less than 5% of collector current.  When used as a switch the nominal small signal current gain,
called beta or hfe is irrelevant.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


you want to properly saturate the device so it's dropping only a tiny voltage when on
Oh right, how stupid of me... thx man, I mostly used fets and ICs for switching, totally forgot


Thanks Semtex9 for the drawings and you kept me going again. Powerconsumption of the 6 bundles of grouped LEDs varies from 20 mA up to 820 mA. I will use the NPN BJT transistors. Programming individual LEDs is not an option because in the model I already bundled LEDs.

After a few days of thinking how to put the wires and the electronics in that cramped space of the shuttle bay I thought I could might as well redirect the (12 or so) wires to the Docking Bay and put all the electronics there.  Definitely enough space for an audio-module to play the theme-song of Star Trek too. It's that logical and simple I, didn't even considered this option for days :smiley-confuse: . (The model is to delicate anyway to hang it on a ceiling with nylon wires .)

Coming week I will redo the electronics in the Docking Bay, including transistors :) .  

On my website, janspeyer.nl, I have some photos of the building process. When this Enterprise is finished I will put all the Arduno-code, C#-code for BlueTooth Android-app(remote control),  Fritzing-electronics schemes, and the necessary documentation on my website.

Thanks for the help!

Kind regards,

Jan Speyer
The Netherlands



- I would use 30AWG wire wrap wire for the LED conductors.

- I would use Tiger Tail beading wire (7 or 9 strand @ .3mm) for suspending the model.

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Go Up