Maker Pro
Maker Pro

Need a little design help on my latest project

J

Joerg

Jan 1, 1970
0
Charlie said:
Hi Guys,
Ok, going to put myself in harms way, and ask for a little design
advice. I have been working on this project for a while now, and it
has gone through several iterations, and I keep having the same
problem!

First, the project: I am designing a small color reader for the
visually impaired.
[snip]

When you figure it out, let me know...

I need to recognize the presence of large yellow objects (*) about 60'
from the front of the house, and sound a buzzer.
(*) aka School Bus ;-)

...Jim Thompson
Hi Jim,
Differrent problem. Suggestion: Get a cheap wi-fi camera aimed at
the spot. Take a netbook or other small PC, and get some of the PD
visual processing software that should be out there for security. Set
up a zone of interest, and trigger off yellow!

I knew some guys back in my toll road days that did this kind of
stuff. By now, it should be pretty generic...

Next step: Train it to recognize black&white cars with "illumination" on
top :))
 
J

Joerg

Jan 1, 1970
0
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.

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.
 
J

Joerg

Jan 1, 1970
0
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 :)

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.
 
J

Joerg

Jan 1, 1970
0
I actually /was/ going to suggest modulating the LEDs deliberating,
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.

But, Charlie doesn't seem to need that level of precision (or
nuisance) just now.

(P.S. D1 = 1n914, as a gift for Tim 'The Timinator' Williams :)

Probably more like "The Intimidator", after I saw a video of him holding
a glowing pipe upwards (!) into an induction heater coil, sans gloves.
 
C

Charlie E.

Jan 1, 1970
0
But it can cost some time to obtain models for the logic-level FETs.
Sometimes that takes as much time as just whipping it up.



I think Jim needs to order some more global warming before people will
come, or everyone has to bring jackets :)

Actually, the FETs you suggested have spice models on their sites that
worked like a charm. Order some complementary pairs this afternoon,
some in DIP8 and some in SOT23 form factors. I will crank them up on
friday and see how things perform!

Naw, by April the weather will be perfect here and in Phoenix. I
actually went swimming a week ago, and should be able to again next
week! Just need a few days in a row of 76+ highs...

Charlie
 
C

Charlie E.

Jan 1, 1970
0
[snip]
I really need to play with this analog stuff more. I know the basics,
but don't have enough practice to know what works, and why. Ya'll
have really pulled my bacon from the fire this time. Maybe if Jim has
his BBQ next month, I will buy a round (or two... )

Thanks,
Charlie

With the economy like it's been I may need to "host" a BYOB party ;-)

With all the help you've given me with understanding obscure PSpice
functions, I owe you! If there's something I can help you with just
ask... off-group if you prefer.

...Jim Thompson
Thanks Jim, alway glad to help. But as they say, what goes around,
comes around, and sometimes that is a good thing!

If you host it, they will come... ;-)

Charlie
 
C

Charlie E.

Jan 1, 1970
0
Hi Guys,
Ok, going to put myself in harms way, and ask for a little design
advice. I have been working on this project for a while now, and it
has gone through several iterations, and I keep having the same
problem!

First, the project: I am designing a small color reader for the
visually impaired.
[snip]

When you figure it out, let me know...

I need to recognize the presence of large yellow objects (*) about 60'
from the front of the house, and sound a buzzer.

(*) aka School Bus ;-)

...Jim Thompson
Hi Jim,
Differrent problem. Suggestion: Get a cheap wi-fi camera aimed at
the spot. Take a netbook or other small PC, and get some of the PD
visual processing software that should be out there for security. Set
up a zone of interest, and trigger off yellow!

I knew some guys back in my toll road days that did this kind of
stuff. By now, it should be pretty generic...

Charlie

Hi,

I would like to add something from my own experience I had several years
ago.

I was experimenting with a phototransistor and used a voice modulated LED
to build a photonic intercom. It worked fine in daylight, then at night I
was getting a hum.

By using an oscilloscope I discovered that when I switched off the LED
transmitter, there was a 50Hz waveform superimposed on the phototransistor
amplifier. I connected the oscilloscope to my power supply, but there was
no 50Hz leaking through.

After a few hours of fruitless head scratching, I thought I'd turn in, get
a good night's sleep and make a fresh start the next day. When I switched
off the incandescent light, I noticed I forgot to switch off both the
oscilloscope and the phototransistor amplifier circuit, as I went to switch
the light back on, I happened to notice the oscilloscope trace was flat; no
50 Hz leakage. I then switched the light back on and the 50Hz waveform
returned, I then realised that the phototransistor was picking up the 50Hz
as interference from the incandescent light.

I never got the chance to try out the circuit with a fluorescent lamp.

Looking at your schematic, I cannot see any filter topology around the
MCP6024A Op Amp? Perhaps a low pass filter designed for fc <= 40Hz, with a
flat passband response may be a good option, such as a Butterworth?

Neil
In my case, the object is held about 1cm from the LED and PT, with the
LED at about a 45 degree angle, inside a small case with a small
window. The sample is held against the window. and except in very
thin fabrics, blocks about just about all the ambient light. If there
is a lot of light with no LED shining, the system just says "LIGHT" so
a blind person can tell if they left the lights on... ;-)

Charlie
 
J

JosephKK

Jan 1, 1970
0
Object is to have this as light and small as possible. Using AAs
instead of AAAs only because Serpak has their little M-6 enclosure
that fits right. Would weight too much with 3 or 4 AAs...

Charlie

If your weight budget is that bad: why not Li batteries? how about
per led boost (cuk?) current output drive?
 
J

JosephKK

Jan 1, 1970
0
Consider using a photodiode instead of a phototransistor -- it _should_
be more linear and predictable.

Also consider putting a photoreceptor in the forward light path, to
monitor the light level out of the LED. Even with constant current
sources I suspect that you're going to see drift with temperature and
aging. A photoreceptor in the forward path will let you read the
illumination intensity and make your readings ratiometric.

You may find that with the extra photoreceptor you don't need a 'real'
constant current source -- just something that sorta kinda works (but
_not_ something with 0V headroom!).

Hmmm. I like ratiometric designs. How do you get matched photodiodes?
 
J

JosephKK

Jan 1, 1970
0
Yep. Phototransistors are horrible for this sort of application.
Linearity, unit-to-unit repeatability, temperature drift will all ruin
your measurement.
A photodiode with transimpedance amplifier should do what you want. If
you have a large dynamic range to cover, consider an integrating amp -
this allows you to control the overall gain by varying the integration
time, which should save a few parts.

HTH

R.

Kind of like typical autoranging DMMs.
 
J

JosephKK

Jan 1, 1970
0
Hmmmm... interesting idea.

So, I just feed the emitter of the phototransistor directly to a cap,
and use a comparator input to determine when it has reached a
reference voltage. I probably need to hit it before and after with a
ground to clear the cap for the next sample...

Charlie

Integrating the collector current should have better properties.
 
J

JosephKK

Jan 1, 1970
0
Excellent! And I'll vote for feedback... (as if a vote matters)

George H.

Alas, i believe that Charlie mentioned the RGB led is common cathode.
 
F

Fred Bartoli

Jan 1, 1970
0
JosephKK a écrit :
Integrating the collector current should have better properties.

That's base current that's really interesting, since it doesn't depends
on the transistor's current gain (temperature, operating point,...)

Something like a miller integrator will do.



|
.-.
| |
| |
'-'
|
+-----+--> ADC
| |
| ---
| ---
| |
\| |
|---+
<| |
| +-||
=== ->||
GND +-||---> Reset
|
===
GND
 
J

JosephKK

Jan 1, 1970
0
Hi Guys,
Ok, going to put myself in harms way, and ask for a little design
advice. I have been working on this project for a while now, and it
has gone through several iterations, and I keep having the same
problem!

First, the project: I am designing a small color reader for the
visually impaired. Really simple operation - put it against the
object you want to tell the color of, and it will say "RED" or
whatever the color is. Sensor is simply an RGB LED and a
phototransistor, buffered by some amps, and then digitized by a PIC24.
So, what's the problem? I can't get a stable reading. In normal
operation, this thing will run for about two seconds, and then be
turned off. To test, however, I run it in debug mode for hours. When
I first turn it on, and calibrate it to a white sample, I will get one
set of calibrations. Let it sit for about two minutes, and it starts
to drift. In about half an hour, I will have readings totally off the
scale.

So, why am I baring my soul to ya'll? I need your help identifying
where the gain drift is coming from, and some ideas on how to control
them. I have the schematic here:

http://edmondsonengineering.com/Documents/Rainbow color Reader Schematic.pdf

Basic description - MCU turns on an LED. The phototransistor is first
buffered by a non-inverting opamp with a gain of 2, and the signal is
split. Part goes directly to a PGA where it is first attenuated, and
then the PGA boosts it up. This gives me a calibration control to
deal with difference in output of the LEDs. The original and PGA
signal are added, and this is then applied to another non-inverting
opamp with a gain of 2. I also have one feed before this opamp to an
ADC input on the PIC.

Problems I have already solved:
First, each LED has a different output level. Red needs a gain of
around 2, BLUE a gain of around 5, and GREEN a gain of about 7. The
PGA was added to give me an adjustable gain from around 2 to 14, with
the two different taps into the separate input channels of the PGA.
This gives me 16 different gain levels to play with. Using the tap to
the second ADC channel, it actually gives me 32 different levels.

Right now, RED uses this lower gain channel, and is steady as a rock.
Part of this may be that my VCC is 3.3 volts, and only RED has a
forward voltage below this. Both GREEN and BLUE have forward voltages
of 3.4 volts.

So, potential problems? could it be that repeated use warms up the
GREEN and BLUE LEDs so that they become more efficient? Could the
power supply drift higher as it warms up? Could the opamps drift with
slight changes in temperature? Any advice ya'll can give will be most
appreciated.

Thanks,
Charlie

Charlie, i would never have tried this with just an RGB LED. I would use
several spaced at about 50 nm apart. LEDs are pretty nearly monochromatic
(having spectral widths not more than 10 nm). It would be real handy to
have enough lines to estimate the spectral response with, so as to not end
up calling orange brown or black.

Now as to drive, how about something like this:

$----------+ +--||-------+--\/\/\/\---> +V
| | )
P/O | G L1 )
PIC | ) LED
| |-----+---->|----+
+---------------||<-+ |
| |--+ G
| |
| G
~

One led drive shown
Use chopped drive and steady high from uC for off.
The chopper freq (also 2x and 4x for different properties) is used to demodulate
(synchronously) the desired signal from photo device output.
You can adjust F or PW or both to compensate for battery voltage changes.
L1 may work better in modified discontinuous current mode.
If battery life is problematic insert a nfet driving a pfet switch between the
resistor and +V. Perhaps all LED channels at the same time.
 
J

Jon Kirwan

Jan 1, 1970
0
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
 
J

Joerg

Jan 1, 1970
0
Charlie said:
Actually, the FETs you suggested have spice models on their sites that
worked like a charm. Order some complementary pairs this afternoon,
some in DIP8 and some in SOT23 form factors. I will crank them up on
friday and see how things perform!

Naw, by April the weather will be perfect here and in Phoenix. I
actually went swimming a week ago, and should be able to again next
week! Just need a few days in a row of 76+ highs...

Are you in Florida? A client near Palm Beach told me that they regularly
dive into the pool now. Wish I lived there ...
 
J

Joerg

Jan 1, 1970
0
Arrgh. "deliberately"

Yeah, I was wondering whether LEDs can get into heated political
discourses :)

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.

But I'd check. I only know laser diodes and VCSELs well enough and they
can be spectrum-steered by current changes within nanoseconds.

[...]
 
C

Charlie E.

Jan 1, 1970
0
Are you in Florida? A client near Palm Beach told me that they regularly
dive into the pool now. Wish I lived there ...

No, I am down in Desert Hot Springs, just across the valley from Palm
Springs. I only have a solar heater on my above ground pool, so I
need temps to be in the upper 70's to low 80s to reall be able to
swim comfortably. By July, the pool temps will be in the 90s, even
with 'cooling!'

Charlie
 
C

Charlie E.

Jan 1, 1970
0
Charlie said:
[snip]

I think Jim needs to order some more global warming before people will
come, or everyone has to bring jackets :)

Actually, the FETs you suggested have spice models on their sites that
worked like a charm. Order some complementary pairs this afternoon,
some in DIP8 and some in SOT23 form factors. I will crank them up on
friday and see how things perform!

Naw, by April the weather will be perfect here and in Phoenix. I
actually went swimming a week ago, and should be able to again next
week! Just need a few days in a row of 76+ highs...

Are you in Florida? A client near Palm Beach told me that they regularly
dive into the pool now. Wish I lived there ...

Charlie is near Palm Springs, Californica.

Virtually the same kind of climate as around here... hot enough to
keep the riff-raff away ;-)

...Jim Thompson

Yeah, there is still a pretty big distinction between 'locals' and
'snowbirds.' We do have a lot of residents that are here only for
part of the year, say from October to April. During that part of the
year, traffic is worse, the crowds are worse, but it is also when
business thrives. And now that Palm Springs is once again encouraging
tourism, after all the spring break madness of the past has calmed
down, means we are getting more visitors.

Our own town has lots of little spas, some fancy, some basic, that all
boast our hot mineral water. We are also getting into the 'vortex'
business, as we have high winds (Air), the San Andreas (earth), our
mineral water (Water) and of course, high temperatures (both in the
air, and in our water for Fire!) So, Welcome to Desert Hot Springs!
Now go home!
;-)

Charlie
 
J

Jon Kirwan

Jan 1, 1970
0
Thanks Jon, I got it. The voltage 'gain' happens after the switch is
turned off.

I suppose, but I probably wouldn't ever use the word "gain"
here. It's really not what is happening. It's the sudden
removal of an energizing EMF, which was used to transfer
energy into a magnetic field at a geometric rate (linear rate
of change in current that is then squared, suggusting that
the total energy stored is proportional to time^2) and the
removal of that EMF and the consequent and necessary collapse
of the magnetic field, whose energy _must_ then go somewhere.

Electronics uses different names for the exact same effect,
depending on when and where and why it happens. Still just
the same thing. But I can't recall "gain" being used here.
Maybe I'm wrong about that, though. I certainly don't have a
comprehensive view of their use of terms.

You often find capacitors nearby where this is happening.
There's a good reason why. And not only because one might
which to convert the magnetic energy into charge storage.

While the inductor's equation of dI/dt = V/L is true enough,
there is still an "I" that must initially continue. Without
a C nearby, with its equation of C*dV/dt = I, there is no
really good place to get that "I" flowing once the EMF is
switched away. With a C there, all that is needed is some
dV/dt to meet the need and you can choose a C that provides
for a reasonable dV/dt for that initial "I" value. And the
inductor is quite able to cause that kind of changing V. In
contrast, with an R it may need a very high and instantaneous
V, but it always takes time to do that and that can be a
problem (which means some other small trace C somewhere will
have to do the job to give it that time.) A C is nice near
switched L's.

Jon
 
Top