News:

SMF for DIYStompboxes.com!

Main Menu

PWM LED driver

Started by egasimus, December 08, 2011, 03:19:07 PM

Previous topic - Next topic

egasimus

I'll be building a piece of RGB LED jewelry for my beloved one for the holidays. It's basically a pair of earphones with one or two RGB LEDs on each, with a small ATtiny25-based PWM driver in a small enclosure. It's gonna be a pretty gift for a pretty girl, for those nights where she's pissed off at me and goes clubbing :icon_lol:

I'll probably be able to devise the firmware myself, however, since I'm going to have a good few inches of wire, I think I should use some sort of LED drivers, and that's where I'm not sure how to proceed.

The basic idea is for all the LEDs to be displaying the same color at a given point. The MCU will fade through all colors in sequence using software PWM. However, I would also like to implement a control for the overall brightness of the LEDs (once ambient noise goes above a certain level, it starts pulsating along with it, kinda like a VU meter). I'm thinking about one PWM-driven 'brightness' MOSFET to control the, um, source voltage (?) to the other three 'color' MOSFETs. Is this the way to go?

I have a lot of BS170s and not much else in the way of FETs (BF245, 2N5457 JFETs), so that's probably what I'm gonna be using. I'm thinking of going all-out SMD on this... I only have the tiny25 in SOIC, anyway.

rustypinto

#1
I hope she's okay with large pieces of jewelry!  :icon_lol:

In all seriousness, we need more info:

- LED datasheet
- How do you plan on measuring sound level (this is non-trivial)?
- With controlling the LED brightness (current), you may have an easier time finding a JFET that does this better, but i'm not sure what supply you're using...
- How do you plan on powering the whole thing? I will (of course) assume battery power, but you need to pick voltage, form factor, regulation (if any), etc. This will be largely driven by the LED's forward voltage(s) and your MCU's minimum supply voltage.
- How do you plan on programming the MCU?
- Does the "jewelry" have an outline that you can translate to a PCB outline? Note that you may be running into odd shapes, which can increase board cost and fab time.
  • SUPPORTER

Gurner

In my humble opinion - certainly wrt controlling the LEDS - his direction is the right one.......one mosfet to 'chop' the power supply to the leds (controlling the average current through them) .....conrolling the ground side allows the use of a cheap N chan mosfet directly driven from the MCU pin (whereas a P-Chan inline with the supply doesn't) , with a mosfet per colour to control their own level.

I'm more interested in the power supply arrangments...a blue led need 3.4V....also if you don't regulate the supply the LEDS dim with the sagging power supply.

egasimus

#3
The phones will connect to a small box which she will wear behind her neck; a PCB necklace could also work - she already has one, and we've made those for people (the one we gave to a bassist friend even doubled as a battery tester)

I was considering two AA or AAA cells, but that's not gonna cut it for a blue LED, so there's got to be a DC/DC converter in there. I'm certainly not gonna risk using a cell phone battery! What about several 2032s in series, stepped down with high efficiency to, say, 4V? I have no idea how long they're gonna last, though.

I probably won't be able to find a datasheet for the generic RGB LEDs I'm gonna be using. Sound level is gonna be measured with an electret capsule and the chip's ADC. I'm gonna etch the board at home - I don't care much for fabrication. But if it's gonna be all-SMT (and it probably is), I gotta order the parts quick, before the holidays arrive... Would any of these or these work?

Gurner

#4
Quote from: egasimus on December 09, 2011, 03:08:01 AM
I was considering two AA or AAA cells, but that's not gonna cut it for a blue LED, so there's got to be a DC/DC converter in there. I'm certainly not gonna risk using a cell phone battery! What about several 2032s in series, stepped down with high efficiency to, say, 4V? I have no idea how long they're gonna last, though.

That'll get you sufficient voltage... but IMHO there's no such thing as 'highly efficient' step down (well there sorta is ...drive the LEDS with a higher voltage than their forward voltage, but PWM their supply ...then monitor the averaged current through the led itself via a series resistor, filter out the PWM frequency with a cap, feeding the voltage drop across the resistor back into the MCU to then alter the LED supply voltage PWM duty cycle to suit - but it's a bit of a faff & shifts the onus onto your MCU, which bearing in mind you're gonna go with somethig very small is probably not the way forward!).

A step up converter is far more efficient & easier to implement. Also the current delivery ability of a CR2032 sucks....so three leds (RGB) per left & right  = 6 leds ...that gonna be a struggle for a CR2032 for any reasonable length of time.

egasimus

But, if I want to use a single 1.5V cell, I'm gonna need a separate IC for the converter, since the MCU won't work at such a low voltage. Oh well, it's SMD after all.

I've found that a local supplier carries 2N7002 SMD enhancement mode n-MOSFETs. Will those work?

Gurner

#6
Quote from: egasimus on December 09, 2011, 09:02:03 AM
But, if I want to use a single 1.5V cell, I'm gonna need a separate IC for the converter, since the MCU won't work at such a low voltage. Oh well, it's SMD after all.

It's a quandry...whether to step down, get clever with the coding...or lose the extra voltage as inefficient heat, or step up & use extra components ...only your design & the associated requirements & limititations can answer that.

If you go the step up route, these are good...

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en548193


Quote from: egasimus on December 09, 2011, 09:02:03 AM
I've found that a local supplier carries 2N7002 SMD enhancement mode n-MOSFETs. Will those work?

Yes it will, but the typical gate threshold is 2.1V...just bear that in mind with your design.

egasimus

Step-up it's gonna be. I've got enough things for my firmware to do as it is.

I found the datasheet for the LEDs. Not too helpful, though.

egasimus

Hey, I've decided to use a DC/DC converter driven by the MCU; but even the low voltage ATtiny25 can't power up from 1.5V. Can you recommend me a circuit to start up the DC/DC converter in order to boost the voltage to 3V or so, and then turns off and lets the MCU control the converter?

Galego

How about using one of these?


You could hack it up for your power supply. It has 2 or three small rechargeable batteries inside, and if they run out of juice, she can just wind it up back to life. It keeps the size of the power supply down and it's environmentally friendly. :)

egasimus

#10
http://spritesmods.com/?art=ucboost&page=3

I found this - looks just like what I need. However, it doesn't have component values :( So I'm experimenting in Falstad's sim, and, with this setup, a couple milliseconds of holding the button give me up to 44 volts, depending on the battery's internal resistance. This is, of course, unrealistic and inaccurate modelling. Still, how do I pick adequate values for the components?