Creating a constant current for powering LEDs  - Page 1
Forum section: electronics / beginners

author: sean87
author_rank: Regular Contributor
timestamp: September 23, 2017, 03:34:02 pm
content: I want to create a 3 luminance step light using a mosfet and output of a DAC of a micro (DAC can output 0 to 5V). I am thinking about a jelly bean N-FET (2N7002) but the simulation plays a game on me. Any ideas what can be wrong? I get the same output current after I pass the Vgsth (LTSpice file is also attached).

author: BenKenobi
author_rank: Regular Contributor
timestamp: September 23, 2017, 03:57:27 pm
content: I'm not sure I understand your thinking.Generally with LED you let the LED draw up to its maximum current (you actually current limit it) at an appropriate forward voltage and then the intensity is modified by turning it on and off rapidly via PWM - at least that's how I do it.The only thing you need is a PWM and some sort of voltage / current regulator. I've used these regulators in a lot of places >https://www.banggood.com/DC-DC-8A-300W-Buck-Adjustable-Solar-Charging-LED-Driver-Vehicle-Power-Supply-Module-p-1166654.html?rmmds=search, the price of these things makes building one pointless - and more expensive.And here is everything that I think you're looking for in one packagehttps://www.banggood.com/4V-40V-8A-DC-DC-Buck-Converter-Step-Down-Voltage-Power-Module-PWM-Modulation-p-1117406.html?rmmds=search

author: TheUnnamedNewbie
author_rank: Super Contributor
timestamp: September 23, 2017, 04:34:22 pm
content: Quote from: BenKenobi on September 23, 2017, 03:57:27 pmThis depends really. In many applications, a form of constant-current driving might be desired.If this is the case, usually using a feedback loop with an OTA or opamp can be better. Your DAC can just provide the reference levels.If you really just desire 3 levels, it might be easier to just give the entire thing a fixed reference voltage and change the shunt resistor (essentially, making your own DAC) by adding parallel resistance. These circuits are generally quite simple.

author: Beamin
author_rank: Super Contributor
timestamp: September 23, 2017, 06:53:44 pm
content: Quote from: BenKenobi on September 23, 2017, 03:57:27 pmI clicked those links and now I am out 47.83 for like 19 things. Damn you. I hate buying stuff from china. BUT an Arduino mini for 4.87? I could go down to micro center and pay 35.00 for the same Chinese piece of shit. I had to stop. I honestly don't even remember what I bought but it was cheap so I got 2 of each. Now I'm going to have the great wall of china post on my door step next week. BangGood: "Shopping with fun!" I shopped with fun alright. What ever that means. Maybe I'll just go to that site one more time. Just to look...

author: BenKenobi
author_rank: Regular Contributor
timestamp: September 23, 2017, 07:14:57 pm
content: QuoteI do it all the time - I've got two drawers full of toys, I couldn't build some of the things for the price, OK some of it is junk but a lot of it isn't, but at the prices who cares.When you order from there make sure to split your orders into sub £25 incl post then you avoid all the duty

author: Beamin
author_rank: Super Contributor
timestamp: September 23, 2017, 08:05:17 pm
content: Quote from: BenKenobi on September 23, 2017, 07:14:57 pmDuty? Like tax? America just lets the Chinese rob us blind. I noticed the prices changed around but it seems like it went from some currency like UKlbs into USD. There was just the price and a small shipping charge. I didn't notice anything as my order I usually watch it like a hawk; for instance Amazon rounds up to the nearest cent at $0.0038 instead of 0.005 like per law in many US states. Amazon cheats on all kinds of stuff like including tax on handling by calling it shipping AND handling and charges tax on service plans and will only take the tax off if you call and bitch. They also sent me a tax ID for my state that I can't find any record of and it took them two days to tell me the number. Bullshit they pay that to the government. They also have some weird round up scheme for the tax that I figured out but couldn't call to have $0.008 cents taken off my bill.

author: BenKenobi
author_rank: Regular Contributor
timestamp: September 23, 2017, 08:19:12 pm
content: You're in the US ? they charge US dollars but in the UK Her Majesty's revenue people will ignore anything less than £25, sometimes they will ignore if it is more but generally not then the one told to collect the money will charge a fee too.It still works out cheaper than buying here but why put money in their pockets if you don't need to.

author: IanMacdonald
author_rank: Frequent Contributor
timestamp: September 24, 2017, 08:14:34 am
content: Ditch the FET and put an NPN in series with D3 ground side. Drive this with a selected base resistor to give the required LED current. All that's really needed for a one-off circuit.Reason for not using a FET is that the conductance is too nonlinear. It also has a large and variable turn-on threshold. The BJT starts to conduct at about 0.6v on the base, and this is fairly repeatable between samples. Using FETs for current control requires a current sensing resistor and feedback control. Which would probably be the approach adopted in a commercial design because it better allows for component tolerances. For a one-off though, just select the required base resistor for each brightness level. 10k would be a ballpark starting point.