Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: Anthony on June 13, 2013, 08:29:25 pm

Title: How can I drive 12V led's from a digispark
Post by: Anthony on June 13, 2013, 08:29:25 pm
Hi All


This is going to be more of a general electronics question.



I am working on a 1/350 scale Enterprise model from star trek.  I have a lot of lighting effects I want to do and the digispark will work great with most of the effects because they use will be driving standard LEDs.  I have 2 questions.


1. How many LED's or milliamps can I draw though a single digispark io port?  There are 4 nav leds blinking on one port, and 6 markers leds that will be blinking on the other.  Should I wire these in serial, or use an transistor wire to the digispark, and the leds on the other side with seperate power.


2. I need to turn on and off 12volt LED strips, but I will probably run these at 9 volts.  I know I can't do that wired directly to a digispark port, but what can I use.  Can I use a transistor?  I would prefer not to use a relay, because I don't want to hear a click.  Maybe a different component, maybe and optical isolator?  Is there any type of component I could use?  part of the problem is I don't know what is available to even do some research.


Does anybody have any suggestions?


Thanks
Anthony
Title: Re: How can I drive 12V led's from a digispark
Post by: DeuxVis on June 14, 2013, 03:43:46 am
Can't reply 1) as I am no good at current calculations. I think I remember reading the max you can draw at once from all digispark combined pins is 60mA ?

For 2) the simplest would certainly be a transistor. Sized appropriately for the voltage and current it will have to deliver.
Title: Re: How can I drive 12V led's from a digispark
Post by: semicolo on June 14, 2013, 08:38:07 am
Just had a discussion with bluebie about the max current, the datasheet states not to exceed 60mA and that pins are not guaranteed to source current greater than 10mA@5V, but the absolute maximum is 40mA albeit with a voltage drop.
Maximum total current is 200mA for the whole chip.

So my advice would be if you designe something that must run for long times, use the 10mA limit. If it's something that you'll turn on for just a few minutes, you can push it more.

Beware P5 is weaker than the other pins.
Title: Re: How can I drive 12V led's from a digispark
Post by: semicolo on June 14, 2013, 08:43:07 am
you may be able to connect multiple leds in series or parallel if their characteristics are close enough (else some will seem brighter than others).

just found this nice led array calculator
http://led.linear1.org/led.wiz (http://led.linear1.org/led.wiz)
Title: Re: How can I drive 12V led's from a digispark
Post by: Anthony on June 14, 2013, 09:38:40 am
Thanks for the replied.  I am thinking that I should not connect the LED's direct to the digispark, I think I'm going to run the digispark pin to a transistor, and then power the leds off of a separate power source on the other side of the transistor.  That should solve my problem of overdrawing the digispark.


What is the difference between a mosfet and a transistor? As I understand it transistors are designed to work with the same voltage and mosfets are designed to work with difference voltages.  It looks like I can use 5volt on the controller size, and 9 volts on the led side.  Am I understanding this correctly?



Title: Re: How can I drive 12V led's from a digispark
Post by: dougal on June 14, 2013, 10:23:36 am
Also using PWM (either hardware or software) to drive LEDs will reduce the current requirements, proportionally to your duty cycle / frequency. It wouldn't surprise me if you could run your LEDs at half power or less, and still have them bright enough to look good. The apparent brightness is not linear.




Title: Re: How can I drive 12V led's from a digispark
Post by: semicolo on June 14, 2013, 12:32:24 pm
It really depends on your leds, if they're not too big/bright 10mA could be enough and you can save the hassle of connecting extra transistors.
Do you have the datasheets or current/voltage requirement of your leds?

I'd say the main difference between a field effect transistor(fet) and a junction transistor is fets are driven by voltage while jt are driven by current.
One advantage of the fets is they consume less power because their internal resistance is low when turned on.
Nothing to do with voltage you can use either one.
Title: Re: How can I drive 12V led's from a digispark
Post by: Anthony on June 14, 2013, 10:00:44 pm
I have 2 types of LED's in use.  The standard LED's are 2.6 or 3.0 volts, but I think they are 20mA,  They are pretty bright.


The 12 volt led's I'm using are led tapes.  There are basically 3 led's per inch, they are resistored to run at 7 to 12 volts, I have no idea what the amps is, but there could be 20 to 30 inches of tape on a circuit.


I'm starting to consider using an opto-isolator.  I remember an electronics class 25 years ago using them for a couple projects.  I think it would separate the circuits and work like a stitch(I think)


I really just need these to work like a switch, The circuits will either need to be on or off, there will be no to adjust the brightness.  A relay would work fine, but I don't want to have the click as the relay flips.



Title: Re: How can I drive 12V led's from a digispark
Post by: digistump on June 15, 2013, 01:51:50 am
A mosfet would be perfect for the light strips - no need to worry about amperage as the mosfet will be well over what you need.


If you have one LED per port run them at 10ma to be safe - I bet they'd be bright enough. Otherwise you could use a transistor or mosfet - either one will get the job done.


I'd suggest you get some transistors and mosfets and experiment - if you are pulling too much from the Digispark or voltage regulator it will get burning hot before you break anything (OK not if you pull way too much!) - and even if you break something you'll learn a lot. Not everyone's way to learn, but personally it is my favorite - I have lots of broken Digisparks/Arduinos/and even a $300 laser tube (opps! that one hurt the wallet) to prove it.
Title: Re: How can I drive 12V led's from a digispark
Post by: Anthony on June 15, 2013, 08:45:41 am
if you are pulling too much from the Digispark or voltage regulator it will get burning hot before you break anything


Thanks for the feedback.  Knowing this give me an indicator to work with.


I don't mind experimenting, even at the risk of parts, but I do better when I have some framework to work within. 


There will be a couple circuits with only a single led, but most will have multiples.  I'm probably going to have 2 digisparks running the effects.  I have some transistors here, but I will need to get some mosfets.  I'll stop by radio shack today, but I'm not hopeful.
Title: Re: How can I drive 12V led's from a digispark
Post by: semicolo on June 15, 2013, 12:42:16 pm
If you like to search bins like I do and have some unused old electronic devices hanging around, you may be able to find what you need in it. I've found pretty powerful mosfets in junk UPSes which batteries were dead and cost more to replace than buy a whole new UPS.
Title: Re: How can I drive 12V led's from a digispark
Post by: dougal on June 17, 2013, 06:20:38 am
Thanks for reminding me -- I've got an old UPS in my basement with a dead battery. I need to dig it out one day and salvage the transformer and other parts!