Prev: Magnetism is really -- WHAT?
Next: low-end scope
From: dagmargoodboat on 3 Mar 2010 18:36 On Mar 3, 9:28 am, MooseFET <kensm...(a)rahul.net> wrote: > On Mar 2, 8:54 pm, dagmargoodb...(a)yahoo.com wrote: > > > > > On Mar 2, 10:29 pm, Joerg <inva...(a)invalid.invalid> wrote: > > > > dagmargoodb...(a)yahoo.com wrote: > > > > On Mar 2, 9:45 pm, Joerg wrote: > > > >> dagmargoodb...(a)yahoo.com wrote: > > > >>> On Mar 2, 9:15 pm, Joerg wrote: > > > >>>> dagmargoodb...(a)yahoo.com wrote: > > > > >>>>> The RGB LED is common-cathode? Oh. Then this would work: > > > >>>>> +3.3v > > > >>>>> -+- > > > >>>>> | > > > >>>>> .--------+--------+--------. > > > >>>>> | | | | > > > >>>>> |<' |<' |<' |<' > > > >>>>> -| Q1 -| Q2 -| Q3 -| Q4 > > > >>>>> |\ |\ |\ |\ > > > >>>>> | | | | > > > >>>>> | | | | > > > >>>>> | | LED-R |LED-G | LED-B > > > >>>>> | V ~> V ~> V ~> > > > >>>>> | --- --- --- > > > >>>>> | | | | > > > >>>>> | D1 | | | > > > >>>>> +---|<---+--------+--------' > > > >>>>> | | > > > >>>>> |_ L1 --- C1 > > > >>>>> )|| --- > > > >>>>> )|| | > > > >>>>> _)|| === > > > >>>>> | > > > >>>>> +--->Vsense (to switching current regulator, > > > >>>>> | e.g. ZXSC310) > > > >>>>> .-. > > > >>>>> | | > > > >>>>> | | Rsense > > > >>>>> '-' > > > >>>>> | > > > >>>>> === > > > >>>>> GND > > > >>>>> This approach is efficient, stable, inexpensive, small, and provides a > > > >>>>> wide-compliance range. It needs no level-translation, which saves six > > > >>>>> parts or so. A resistor-DAC to the Vsense node could modify the > > > >>>>> individual LED currents, if desired. > > > >>>> A negative voltage can work and if you use FETs instead of the BJTs you > > > >>>> save three more parts, the base resistors. > > > >>> I personally like FETs; I put in the PNPs for you. They're cheaper. > > > >>> <grin> > > > >> But only in mass production where SMT placement is cheap :-) > > > > >>>> However, make sure the 3.3V hangs on, is strong enough. Also the > > > >>>> switcher frequency must be high so load changes are handled fast enough. > > > >>>> C1 can't be too large. > > > >>> Or omit it altogether. C1's optional, really. > > > >> Careful, then you modulate the LED current with tons of switcher ripple. > > > >> That could lead to weird color shifts. > > > > > I actually /was/ going to suggest modulating the LEDs deliberating, > > > Arrgh. "deliberately" > > > > > then using a.c. amplification and synchronous demodulation on the > > > > detector side. That rejects ambient light and eliminates drift. > > > > I don't know enough about Charlie's LED but modulating might result in > > > it sweeping through a narrow swath of spectrum all the time. And if > > > Murphy strike this will modulate or beat with some other stuff from > > > fluorescents in the room and the poor uC doesn't know what to do with > > > all that. > > > I doubt the spectral sweep's a disadvantage here, but you do have to > > choose intelligent chopping frequencies to avoid beats. That's easy-- > > just integrate over a line cycle. Half a line cycle, to reject > > fluorescents. > > 0.1 seconds is a very nice time. It is 6 cycles of 60Hz and 5 cycles > of > 50Hz. You don't need to adapt to the local mains. Yep. I did that in a 16-bit integrating converter ages ago, when 16 bits was a lot. The line cancellation was surprisingly good. Kewl, ain't it? All this integrating stuff really works! If I were Charlie, I'd be rolling an integrating A/D here too--a photodiode as current source makes it easy and it saves the a/d. But, Charlie has to ship, so no go for now. We've all been there. -- Cheers, James Arthur
From: dagmargoodboat on 3 Mar 2010 19:09 On Mar 3, 9:49 am, MooseFET <kensm...(a)rahul.net> wrote: > On Mar 2, 9:06 am, dagmargoodb...(a)yahoo.com wrote: > > On Mar 1, 10:03 pm, MooseFET <kensm...(a)rahul.net> wrote: > > > > How about: > > > > Schottky LED > > > Vcc ---->!--------+-----/\/\---->!----GND > > > ! > > > ===C > > > ! > > > PIC port > > > > When you pull the port pin low, the capacitor gets > > > charged. When you take it high again you get a pulse > > > of light from the LED. > > > Absolutely. Instead of using a PIC port, he could tie the cap to his > > DC-DC converter's switch node. That makes a common Vled supply, ... > > > Vcc > > -+- > > | > > V D1 > > ._. --- > > _| |_ C1 | D2 Vled > > >------||---o-->|--o-----. > > | | > > --- C2 | > > --- | > > | | > > === | > > | > > .--------+--------+ > > | | | > > R1 R2 R3 > > | | | > > | LED-R |LED-G | LED-B > > V ~> V ~> V ~> > > --- --- --- > > ----. | | | > > | Q1 | | | > > |-|>-' Q2 | | > > PIC |------|>-----' Q3 | > > |---------------|>-----' > > | > > ----' I posted that --^ before realizing Charlie's LED is common anode. So, the above should be re-jiggered to make a negative supply for the LEDs' anode, and the switches should be moved to the cathodes. Oh, let's just ASCII it... +3.3v -+- | .--------+--------+ Q1 | Q2 | Q3 | ---. ||<-' ||<-' ||<-' |__||--. _||--. _||--. | | | | | | PIC |---------' | | | | | | | | |------------------' | ---' | | | R1 R2 R3 | | | | LED-R |LED-G | LED-B V ~> V ~> V ~> --- --- --- | | | | | | '--------+--------' | ._. | _| |_ C1 D2 | Vled >----||---o--|<--+ | | --- --- C2 D1 ^ --- | | === === This is the simplest, cheapest, smallest yet--no LED switcher IC needed. > > The phototransistor Hfe drifts a lot with temperature, but that's > > common to all channels; software can remove it. > > > Seconded: Tim's suggestion for optical feedback on the LEDs' output. > > If this is just about "color", the ratio of the photocurrents will be > used so the gain drift won't matter. Agreed: the gain drift doesn't matter at the detector. I'm not sure if that's true for the LEDs' outputs over temp., i.e., whether they track one another well enough. > I suggest something like: > > repeat many times averaging answers: > All LEDs off > measure BackGround > R LED on > Measure Red > G LED on > Measure Green > B LED on > Measure Blue > All LEDs off > > Red -= BackGround > Green -= BackGround > Blue -= BackGround That should cancel background light nicely. Sample times would be chosen and integrated to reject 100 and 120 Hz. Charlie doesn't seem to need ambient light rejection in this application, but if he ever did, this would do it. -- Cheers, James Arthur
From: dagmargoodboat on 3 Mar 2010 19:16 On Mar 3, 7:09 pm, dagmargoodb...(a)yahoo.com wrote: > On Mar 3, 9:49 am, MooseFET <kensm...(a)rahul.net> wrote: > > > > > On Mar 2, 9:06 am, dagmargoodb...(a)yahoo.com wrote: > > > On Mar 1, 10:03 pm, MooseFET <kensm...(a)rahul.net> wrote: > > > > > How about: > > > > > Schottky LED > > > > Vcc ---->!--------+-----/\/\---->!----GND > > > > ! > > > > ===C > > > > ! > > > > PIC port > > > > > When you pull the port pin low, the capacitor gets > > > > charged. When you take it high again you get a pulse > > > > of light from the LED. > > > > Absolutely. Instead of using a PIC port, he could tie the cap to his > > > DC-DC converter's switch node. That makes a common Vled supply, .... > > > > Vcc > > > -+- > > > | > > > V D1 > > > ._. --- > > > _| |_ C1 | D2 Vled > > > >------||---o-->|--o-----. > > > | | > > > --- C2 | > > > --- | > > > | | > > > === | > > > | > > > .--------+--------+ > > > | | | > > > R1 R2 R3 > > > | | | > > > | LED-R |LED-G | LED-B > > > V ~> V ~> V ~> > > > --- --- --- > > > ----. | | | > > > | Q1 | | | > > > |-|>-' Q2 | | > > > PIC |------|>-----' Q3 | > > > |---------------|>-----' > > > | > > > ----' > > I posted that --^ before realizing Charlie's LED is common anode. > So, the above should be re-jiggered to make a negative supply for the > LEDs' anode, and the switches should be moved to the cathodes. > > Oh, let's just ASCII it... > > +3.3v > -+- > | > .--------+--------+ > Q1 | Q2 | Q3 | > ---. ||<-' ||<-' ||<-' > |__||--. _||--. _||--. > | | | | | | > PIC |---------' | | | > | | | | | > |------------------' | > ---' | | | > R1 R2 R3 > | | | > | LED-R |LED-G | LED-B > V ~> V ~> V ~> > --- --- --- > | | | > | | | > '--------+--------' > | > ._. | > _| |_ C1 D2 | Vled > >----||---o--|<--+ > | | > V --- C2 > D1 --- --- > | | > === === > > This is the simplest, cheapest, smallest yet--no LED switcher IC > needed. Ooops, I drew D1 backwards (corrected above). That charge pump's only a supply inverter; the multiplier chain's easily extended to make an inverting doubler if needed. -- Cheers, James Arthur
From: George Herold on 4 Mar 2010 21:25 On Mar 3, 12:38 pm, Jon Kirwan <j...(a)infinitefactors.org> wrote: > On Tue, 2 Mar 2010 19:11:30 -0800 (PST), George Herold > > > > > > <ggher...(a)gmail.com> wrote: > >> +3.3v > >> -+- > >> | > >> .--------+--------+--------. > >> | | | | > >> |<' |<' |<' |<' > >> -| Q1 -| Q2 -| Q3 -| Q4 > >> |\ |\ |\ |\ > >> | | | | > >> | | | | > >> | | LED-R |LED-G | LED-B > >> | V ~> V ~> V ~> > >> | --- --- --- > >> | | | | > >> | D1 | | | > >> +---|<---+--------+--------' > >> | | > >> |_ L1 --- C1 > >> )|| --- > >> )|| | > >> _)|| === > >> | > >> +--->Vsense (to switching current regulator, > >> | e.g. ZXSC310) > >> .-. > >> | | > >> | | Rsense > >> '-' > >> | > >> === > >> GND > >><snip> > >Dang, Sorry I don't get this. I turn on one of the transistors and > >nothing happens right away because of the inductor. But current > >starts to flow with an L/R time constant... now what? > > It might be 'easier' to see this way: > > B > | > | > v > Vin Rsense L1 |\ | > (+) ---/\/\---UUUU-----+----| >|----+---> Vout > ==== | |/ | | > ^ | D1 | > | O | > | Q1 / --- > A / --- C1 > O | > | | > | gnd > gnd > > I've reversed D1 and the voltage polarity and replaced Q1 > with a switch. But it is very basic switcher topology for > cases where Vout > Vin (if Vout < Vin by much, then D1 is > always active and the whole idea doesn't work "well.") > > Q1 goes on. This places a near-constant voltage across L1. > Since V=L*dI/dt and you know V and L, you can see that dI/dt > is a constant value. In other words, 'I' ramps upward, > linearly, from some starting point often assumed to be zero. > > At some later time, when 'I' reaches some desired value that > might be called Ipeak [which can be measured as a drop across > Rsense as (Rsense*Ipeak)] Q1 is turned off. > > L1 cannot permit the sudden demise of 'Ipeak' (a change in I > requires, by definition, some time t to do that), so L1's > voltage polarity flips and sends the current via D1 to drop > it's energy onto C1. Joules is 1/2*L*I^2 (use Ipeak for I) > and on the cap is 1/2*C*V^2. So Ipeak energy is translated > to a change in V on C1, such that 1/2*C*(Vnew^2-Vold^2) is > equal to the energy on L1. > > If you don't see why L1's polarity changes, it might be > easier to simply assign a direction to Ipeak, first. Imagine > that the direction arrow of Ipeak points from point A to > point B. Now, when Q1 opens and prevents further current > down through it to ground, L1 "needs" to maintain that arrow > direction somehow. Since point A is "nailed" to Vin, that > side remains at the same Vin value. However, point B is now > floating, in effect. L1 "wants" to maintain Ipeak and its > direction, until enough time t can take place to allow Ipeak > to return to zero. To do that, I must flow via D1. To do > that, the V at point B must rise up to some "more positive" > value such that D1 is forward biased and can permit this. If > C1 has some arbitrary Vc on it, then point B must be at least > one diode drop above that. > > The math way to see it is, again, that V=L*dI/dt. Assume > dI/dt is positive when Q1 is closed at t=0, for convention's > sake, and that I=0 at t=0. Then Ipeak will be positive when > Q1 opens at t=t1. At that point, I will decline from Ipeak. > But this means that dI/dt is now negative, not positive. > Which means that the V across L1 must reverse to the opposite > of what it was beforehand. Before, the voltage moving from A > to B declined. So now the voltage moving from A to B must > increase. Which also confirms the point made, which is that > point B will rise to a value higher than Vin and sufficiently > higher than the voltage across C1 that D1 can forward conduct > and permit L1 to lose energy in such a way that C1 can accept > it (energy is neither created nor destroyed.) > > It really doesn't matter where the other end of C1 is tied, > so long as it is a low impedance voltage rail. So I hope you > don't mind that I kept it at ground. I might as well have > placed it at Vin (which would mirror the circuit better, but > wouldn't change the time-domain considerations above.) > > Jon- Hide quoted text - > > - Show quoted text - Thanks Jon, I got it. The voltage 'gain' happens after the switch is turned off. (I'm a little slow at times.) George H.
From: George Herold on 4 Mar 2010 21:34
On Mar 3, 6:21 pm, dagmargoodb...(a)yahoo.com wrote: > On Mar 2, 10:11 pm, George Herold <ggher...(a)gmail.com> wrote: > > > > > > > On Mar 2, 9:10 pm, dagmargoodb...(a)yahoo.com wrote: > > > > On Mar 2, 1:48 pm, Joerg <inva...(a)invalid.invalid> wrote: > > > > > Charlie E. wrote: > > > > > On Mon, 01 Mar 2010 17:35:29 -0800, Joerg <inva...(a)invalid.invalid> > > > > > wrote: > > > > > >> Charlie E. wrote: > > > > >>> On Mon, 01 Mar 2010 14:30:26 -0800, Joerg <inva...(a)invalid.invalid> > > > > >>> wrote: > > > > > >>>> langw...(a)fonz.dk wrote: > > > > >>>>> On 1 Mar., 20:12, Joerg <inva...(a)invalid.invalid> wrote: > > > > >>>>>> Charlie E. wrote: > > > > >>>>>>> On Mon, 01 Mar 2010 10:38:45 -0800, Joerg <inva...(a)invalid.invalid> > > > > >>>>>>> wrote: > > > > >>>>>>>> Charlie E. wrote: > > > > >>>>>>> <snip original problem...> > > > > >>>>>>>>> Joerg, > > > > >>>>>>>>> Thanks for the advice. Yes, I had been concentrating so hard on the > > > > >>>>>>>>> amplifiers I never really considered the LEDs. In my mind, they would > > > > >>>>>>>>> just 'work' and I could then adjust accordingly. Didn't realize that > > > > >>>>>>>>> they would vary that much. Will have to look at maybe adding a higher > > > > >>>>>>>>> voltage, and go with the constant current drives for them.. This does > > > > >>>>>>>>> need to be pretty accurate! > > > > >>>>>>>> Where is your VCC coming from? Regulator? If so, what's the minimum > > > > >>>>>>>> voltage going into that regulator? If it is a battery that won't drop > > > > >>>>>>>> below about 4.5V and has low load ripple (low source resistance, added > > > > >>>>>>>> capacitors) fixing this part of the circuit would become fairly simple. > > > > >>>>>>> Hi Joerge, > > > > >>>>>>> I only have two AA batteries, so voltage is only about 2.5-3.1 volts. > > > > >>>>>>> That was why I added in the power supply, to try and stabilize that > > > > >>>>>>> voltage. Most of the parts were pretty power tolerant, but I figured > > > > >>>>>>> (somewhat correctly) that the LEDs would be pretty voltage sensitive. > > > > >>>>>> That will require switch mode conversion, no other choice. > > > > > >>>>>>> What do you think of this idea? Take an LED driver chip, like an > > > > >>>>>>> LM3519 to do the voltage step up and current control, and then three > > > > >>>>>>> fets to switch that current to each of the LEDs. Means a chip, a > > > > >>>>>>> small inductor and schottkey, a couple of caps, and three fets. > > > > >>>>>>> Shouldn't take up too much board space or budget... > > > > >>>>>> Nope, it ain't quite that easy. It doesn't have an external sense > > > > >>>>>> resistor and, consequently, the "accuracy" to which it holds the current > > > > >>>>>> is really horrid. Look at the Iout versus Vin, that's just not good > > > > >>>>>> enough. If you want to use a chip (or three) you need to find one with > > > > >>>>>> at least and external Rsense. > > > > > >>>>>> It is usually easier and less expensive to boost that voltage from the > > > > >>>>>> two AA cells to 5V and add the analog current source circuits I > > > > >>>>>> mentioned in my other post (one per LED section). The PIC could be > > > > >>>>>> supplied directly from the AA cell if it's happy with 2.5V. > > > > > >>>>> something like:http://www.national.com/ds/LM/LM2705.pdf > > > > >>>>> could be used either as constant current or as high voltage supply > > > > > >>>> AFAIK those become iffy unde 2.5V. Something like this could work, and > > > > >>>> it's cheap: > > > > > >>>>http://www.diodes.com/datasheets/AP6714.pdf > > > > > >>>> If Charlie would prefer a nicely regulated 3.3V as well which would be > > > > >>>> nice to keep the detector side in check he could use the same chip for > > > > >>>> that rail. > > > > > >>>>> I think you could have three npns floating on top of a shared sense > > > > >>>>> resistor > > > > >>>>> to do the switching between leds. > > > > > >>>> That's a good option. Just make sure any load change reactions have > > > > >>>> petered out when the measurement window cometh. > > > > >>> Joerg, et.al. > > > > > >>> Ok, I think I like the idea of using the 1253adj in the current > > > > >>> feedback mode, with three transistors to switch the anodes of the > > > > >>> LEDS. Now, for a really controversial subject - transistor selection! > > > > >>> I could just throw 2N2222s in there, but are there any better options > > > > >>> available, like logic-level FETs that I should use? Looking through > > > > >>> the Digikey selections, I found AO9926B, dual FETS that look pretty > > > > >>> good, while still being big enough to solder by hand! > > > > > >>> Any good, cheap through hole logic level FETs for prototyping? > > > > > >> Don't you need P-channel? These look good but there won't be much in > > > > >> through-hole, that era is over: > > > > > >>http://www.diodes.com/datasheets/ds30933.pdf > > > > > >> But make sure the source doesn't get much above 3.3V or it won't turn > > > > >> off and your current regulator could hang. IIRC on of your LEDs may > > > > >> require more than 3.3V. So you could, for example, hang a BAV99 up front > > > > >> to drop 1.2V and a resistor from gate to source. > > > > > >>> Thanks again for all the great advice! > > > > > >> As one SW guy put it, we are here to serve :-) > > > > > >>> Charlie > > > > > >>> (at least, this has been on on-topic discussion... ;-) ) > > > > > >> Yeah, amazing, not even the slightest rant. > > > > > > Ok, this has been bothering me all night. The circuit is now looking > > > > > like > > > > > > Vout from regulator > > > > > | point A > > > > > FET switch > > > > > | point B > > > > > LED > > > > > | point C > > > > > FB resistor > > > > > | > > > > > GND > > > > > > (Ok, it isn't ASCII art, but hopefully gets the point across...) > > > > > > So, working from the bottom, point C is at 1.21 volts. The green LED > > > > > has a Vforward of 3.4V, so B is at 4.6V. I have 3.1VDC (typically) > > > > > from the PIC pin to switch the FET. Not an easy problem. > > > > > It is easy: Spring for two logic level FETs that are guaranteed to have > > > > low Rdson at 3V drive. One P and one N. The P-channel goes where your > > > > FET switch ist between points A and B, source to point A. It's gate has > > > > a resistor of 10k or whatever to "Vout from regulator". Now place a > > > > N-channel, source to GND, drain to gate of the P-channel and it's gate > > > > is directly driven by the PIC. > > > > > > Unfortunately, the RGB LED is common cathode, so needs to be switched > > > > > above, not below, so need to somehow raise the level of the turn on > > > > > signal to be able to control the FET, and still be able to turn it > > > > > off. Of course, this is just one of three circuits, so I need to be > > > > > sure the others don't turn on at the same time... ;-) > > > > The RGB LED is common-cathode? Oh. Then this would work: > > > > +3.3v > > > -+- > > > | > > > .--------+--------+--------. > > > | | | | > > > |<' |<' |<' |<' > > > -| Q1 -| Q2 -| Q3 -| Q4 > > > |\ |\ |\ |\ > > > | | | | > > > | | | | > > > | | LED-R |LED-G | LED-B > > > | V ~> V ~> V ~> > > > | --- --- --- > > > | | | | > > > | D1 | | | > > > +---|<---+--------+--------' > > > | | > > > |_ L1 --- C1 > > > )|| --- > > > )|| | > > > _)|| === > > > | > > > +--->Vsense (to switching current regulator, > > > | e.g. ZXSC310) > > > .-. > > > | | > > > | | Rsense > > > '-' > > > | > > > === > > > GND > > > > This approach is efficient, stable, inexpensive, small, and provides a > > > wide-compliance range. It needs no level-translation, which saves six > > > parts or so. A resistor-DAC to the Vsense node could modify the > > > individual LED currents, if desired. > > > > -- > > > Cheers, > > > James Arthur > > > Dang, Sorry I don't get this. I turn on one of the transistors and > > nothing happens right away because of the inductor. But current > > starts to flow with an L/R time constant... now what? > > > George H. > > Summary: Q1 is the switch for a switching regulator IC. Bang Q1, and > it produces a negative current source at the LEDs' common anode. Q2-4 > control the individual LEDs. > > The switcher I suggested--the ZXSC310--is neat because it's cheap and > has a very low sense voltage (25mV), reducing losses, but just about > any IC would do. > > -- > Cheers! > James Arthur- Hide quoted text - > > - Show quoted text - Thanks James, George H. |