It works, but why?
Archiver
Posts: 46,084
Hi All,
I just took a project off the breadboard and on to a PCB that I made. While
I have got it all working, there is an odd thing that I don't understand.
The board is to control a hydrogen fuel cell powered robot. Part of it's job
is to start up on battery power, get the fuel cell up to proper voltage,
then switch the system over to fuel cell power. It uses a DPDT relay to do
this. The battery goes to a normally closed contact. The fuel cell goes to a
normally open contact. The common terminal goes to the LM2940s and the VIN
of the 2p40. The relay is activated via a ULN2003A.
A TLC2543 is used to monitor the fuel cell voltage, and determine when it is
ok to switch the power. Using Tracy's code for the ADC, it worked fine,
after Sid reminded me to connect the -ref pin to ground. Here is where it
gets weird.
While testing the board, I was using a simple program to switch the power
back and forth. The ADC was in it's socket, but not really being used,
meaning that I was just switching the power arbitrarily, not depending on
the ADC inputs. It was powered up, but just sitting there. I was using code
like:
main:
high 5 - Activates relay
debug "On FC power/ "
pause 1000
low 5
debug "On batt. power"
goto main
When I ran this code, the relay would chatter, and the Stamp was resetting.
I went around and around trying to find the problem. Eventually I noticed
that the TLC2543 was warm, so I took it out of the socket. The code now
worked perfectly. Insert the TLC2543, and chatter.
Earlier, I had a problem when I had the circuit on a breadboard. At the
time, I was using a LTC1298 for an ADC. I noticed that the Stamp would try
to remain powered up from the fuel cell after I had shut the system off. If
I removed the wire from the fuel cell to the ADC input, the system would
shut down properly. I put a 100K resistor in line with the fuel cell to ADC
input, and I no longer had to disconnect it.
Remembering this, I cut the traces on the board, and put 100K resistors in
place. Bingo! The system works properly now. I can merrily switch power back
and forth, using the ADC at the same time. Am I supposed to have resistors
on all the inputs?
I want to thank Sid for all his help off-list. Thanks Sid!
Jonathan
www.madlabs.info
I just took a project off the breadboard and on to a PCB that I made. While
I have got it all working, there is an odd thing that I don't understand.
The board is to control a hydrogen fuel cell powered robot. Part of it's job
is to start up on battery power, get the fuel cell up to proper voltage,
then switch the system over to fuel cell power. It uses a DPDT relay to do
this. The battery goes to a normally closed contact. The fuel cell goes to a
normally open contact. The common terminal goes to the LM2940s and the VIN
of the 2p40. The relay is activated via a ULN2003A.
A TLC2543 is used to monitor the fuel cell voltage, and determine when it is
ok to switch the power. Using Tracy's code for the ADC, it worked fine,
after Sid reminded me to connect the -ref pin to ground. Here is where it
gets weird.
While testing the board, I was using a simple program to switch the power
back and forth. The ADC was in it's socket, but not really being used,
meaning that I was just switching the power arbitrarily, not depending on
the ADC inputs. It was powered up, but just sitting there. I was using code
like:
main:
high 5 - Activates relay
debug "On FC power/ "
pause 1000
low 5
debug "On batt. power"
goto main
When I ran this code, the relay would chatter, and the Stamp was resetting.
I went around and around trying to find the problem. Eventually I noticed
that the TLC2543 was warm, so I took it out of the socket. The code now
worked perfectly. Insert the TLC2543, and chatter.
Earlier, I had a problem when I had the circuit on a breadboard. At the
time, I was using a LTC1298 for an ADC. I noticed that the Stamp would try
to remain powered up from the fuel cell after I had shut the system off. If
I removed the wire from the fuel cell to the ADC input, the system would
shut down properly. I put a 100K resistor in line with the fuel cell to ADC
input, and I no longer had to disconnect it.
Remembering this, I cut the traces on the board, and put 100K resistors in
place. Bingo! The system works properly now. I can merrily switch power back
and forth, using the ADC at the same time. Am I supposed to have resistors
on all the inputs?
I want to thank Sid for all his help off-list. Thanks Sid!
Jonathan
www.madlabs.info
Comments
it was getting warm. If you measure the voltage I bet is was about .7
volt lower than the fuel cell voltage. I have seen this happen in the
past with other digital parts. Adding the 100 k shouldn't affect the
circuit much. Look at the leakage current of the ADC on the input
pins. If you use too high of a resistance you can get a false offset
if you leakage current is high. Also diode clamp all inputs to the
ADC to VCC and GND or VEE if using a negative supply. 1N4148 or 1N914
will work.
Jason
--- In basicstamps@yahoogroups.com, "Jonathan Peakall"
<jpeakall@m...> wrote:
> Hi All,
>
> I just took a project off the breadboard and on to a PCB that I
made. While
> I have got it all working, there is an odd thing that I don't
understand.
>
> The board is to control a hydrogen fuel cell powered robot. Part of
it's job
> is to start up on battery power, get the fuel cell up to proper
voltage,
> then switch the system over to fuel cell power. It uses a DPDT
relay to do
> this. The battery goes to a normally closed contact. The fuel cell
goes to a
> normally open contact. The common terminal goes to the LM2940s and
the VIN
> of the 2p40. The relay is activated via a ULN2003A.
>
> A TLC2543 is used to monitor the fuel cell voltage, and determine
when it is
> ok to switch the power. Using Tracy's code for the ADC, it worked
fine,
> after Sid reminded me to connect the -ref pin to ground. Here is
where it
> gets weird.
>
> While testing the board, I was using a simple program to switch the
power
> back and forth. The ADC was in it's socket, but not really being
used,
> meaning that I was just switching the power arbitrarily, not
depending on
> the ADC inputs. It was powered up, but just sitting there. I was
using code
> like:
>
> main:
> high 5 - Activates relay
> debug "On FC power/ "
> pause 1000
> low 5
> debug "On batt. power"
> goto main
>
> When I ran this code, the relay would chatter, and the Stamp was
resetting.
> I went around and around trying to find the problem. Eventually I
noticed
> that the TLC2543 was warm, so I took it out of the socket. The code
now
> worked perfectly. Insert the TLC2543, and chatter.
>
> Earlier, I had a problem when I had the circuit on a breadboard. At
the
> time, I was using a LTC1298 for an ADC. I noticed that the Stamp
would try
> to remain powered up from the fuel cell after I had shut the system
off. If
> I removed the wire from the fuel cell to the ADC input, the system
would
> shut down properly. I put a 100K resistor in line with the fuel
cell to ADC
> input, and I no longer had to disconnect it.
>
> Remembering this, I cut the traces on the board, and put 100K
resistors in
> place. Bingo! The system works properly now. I can merrily switch
power back
> and forth, using the ADC at the same time. Am I supposed to have
resistors
> on all the inputs?
>
> I want to thank Sid for all his help off-list. Thanks Sid!
>
> Jonathan
>
> www.madlabs.info
I bet that if you check your power supply voltage at the relay and/or Stamp
when you plug in the ADC, you'll see it drop out of spec. (Before you added
the resistors, that is.)
The ACD getting hot seems to be the clue. I've never seen an ADC need/use
enough power to get hot, and can't imagine that it's normal. When it's
drawing that much current, your power supply voltage is apparently dropping,
and resulting in the relay chatter and Stamp resetting.
It sure sounds like the wiring to the ADC is somehow not correct. I know
that you're apparently getting data from it, but the symptoms sure seem to
suggest that it's drawing way too much current for some reason. Got an
ammeter? It would be interesting to read the difference in current
consumption when you insert/remove the ADC (without the "band-aid"
resistors). I expect it will be a huge amount more than the data sheet
spec.
Also, the 100k resistors in series with your analog signal inputs may be
resulting in A/D conversion error... I don't know the conversion method of
that particular ADC, but it's common to briefly charge a capacitor (inside
the ADC) with the input signal, and then read the voltage from that
capacitor. If the impedance of the signal source is above the ADC's
requirement, the capacitor may not be fully charged during the sample time.
PIC microcontrollers, for example, typically have a max impedance of 10k for
their A/D inputs.
Randy
www.glitchbuster.com
> I just took a project off the breadboard and on to a PCB that I made.
While
> I have got it all working, there is an odd thing that I don't understand.
>
> The board is to control a hydrogen fuel cell powered robot. Part of it's
job
> is to start up on battery power, get the fuel cell up to proper voltage,
> then switch the system over to fuel cell power. It uses a DPDT relay to do
> this. The battery goes to a normally closed contact. The fuel cell goes to
a
> normally open contact. The common terminal goes to the LM2940s and the VIN
> of the 2p40. The relay is activated via a ULN2003A.
>
> A TLC2543 is used to monitor the fuel cell voltage, and determine when it
is
> ok to switch the power. Using Tracy's code for the ADC, it worked fine,
> after Sid reminded me to connect the -ref pin to ground. Here is where it
> gets weird.
>
> While testing the board, I was using a simple program to switch the power
> back and forth. The ADC was in it's socket, but not really being used,
> meaning that I was just switching the power arbitrarily, not depending on
> the ADC inputs. It was powered up, but just sitting there. I was using
code
> like:
>
> main:
> high 5 - Activates relay
> debug "On FC power/ "
> pause 1000
> low 5
> debug "On batt. power"
> goto main
>
> When I ran this code, the relay would chatter, and the Stamp was
resetting.
> I went around and around trying to find the problem. Eventually I noticed
> that the TLC2543 was warm, so I took it out of the socket. The code now
> worked perfectly. Insert the TLC2543, and chatter.
>
> Earlier, I had a problem when I had the circuit on a breadboard. At the
> time, I was using a LTC1298 for an ADC. I noticed that the Stamp would try
> to remain powered up from the fuel cell after I had shut the system off.
If
> I removed the wire from the fuel cell to the ADC input, the system would
> shut down properly. I put a 100K resistor in line with the fuel cell to
ADC
> input, and I no longer had to disconnect it.
>
> Remembering this, I cut the traces on the board, and put 100K resistors in
> place. Bingo! The system works properly now. I can merrily switch power
back
> and forth, using the ADC at the same time. Am I supposed to have resistors
> on all the inputs?
>
> I want to thank Sid for all his help off-list. Thanks Sid!
>
> Jonathan
>
> www.madlabs.info
>
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Yes, I'd say always use the resistors on the ADC inputs. Especially
when the signals come from off-board and might, either by design,
accident or ESD, be outside the 5 volt range of the power supply.
Your circuit without the resistors had a "sneak" power path through
the ADC substrate diodes, and the external resistor simply limits the
current:
;---->|---Vdd ---> sneak power path
| internal diode conducts
R | when Va>Vdd+.7
Va-/\/\---|-o
ADC input channel
| internal diode conducts
| when Va<Vss-.7
`----|<---Vss
|-> inside the TLC2543
The resistor limits current through the sneak power path. This
limiting is fine so long as the leakage current is greater than the
operating power being drawn from Vdd. (See below about micropower
design).
The substrate diodes can typically handle up to about 20 milliamps,
but at some point they can go into an insidious condition called "SCR
latchup", where you have to remove the power completely in order to
restore proper operation.
The value of the resistor depends on a number of factors, but for an
ADC operated at fairly slow sampling rates on a Stamp, a value up to
~10k would be okay.
The TLC2543 does not have the following problem, but many analog
multiplexers do, that when a substrate diode is made to conduct on
one input channel, it affects the readings on all the other channels.
(crosstalk). That is one nice thing about the '2543, you can use the
substrate diodes as clamps without worrying about crosstalk.
For additional protection from esd and accidents and crosstalk, it is
possible to add other diodes outside the ADC chip that will shunt the
current before it gets to the substrate diodes. I use the Harris
SP720 chip (16 pins) for that purpose, which 14 clamp networks inside.
Micropower operation (SLEEP on the stamp) brings in another
consideration. It is not a good idea to clamp to the Vdd power
supply, because error currents can exceed the current required by the
micropower operation, and that leads to a rise of Vdd to strange
levels. For micropower operation, the high level clamp has to be
referenced to Vdd, but actually shunt the error current to Vss
(ground).
-- best regards,
Tracy Allen
http://www.emesystems.com
>Hi All,
>
>I just took a project off the breadboard and on to a PCB that I made. While
>I have got it all working, there is an odd thing that I don't understand.
>
>The board is to control a hydrogen fuel cell powered robot. Part of it's job
>is to start up on battery power, get the fuel cell up to proper voltage,
>then switch the system over to fuel cell power. It uses a DPDT relay to do
>this. The battery goes to a normally closed contact. The fuel cell goes to a
>normally open contact. The common terminal goes to the LM2940s and the VIN
>of the 2p40. The relay is activated via a ULN2003A.
>
>A TLC2543 is used to monitor the fuel cell voltage, and determine when it is
>ok to switch the power. Using Tracy's code for the ADC, it worked fine,
>after Sid reminded me to connect the -ref pin to ground. Here is where it
>gets weird.
>
>While testing the board, I was using a simple program to switch the power
>back and forth. The ADC was in it's socket, but not really being used,
>meaning that I was just switching the power arbitrarily, not depending on
>the ADC inputs. It was powered up, but just sitting there. I was using code
>like:
>
>main:
>high 5 - Activates relay
>debug "On FC power/ "
>pause 1000
>low 5
>debug "On batt. power"
>goto main
>
>When I ran this code, the relay would chatter, and the Stamp was resetting.
>I went around and around trying to find the problem. Eventually I noticed
>that the TLC2543 was warm, so I took it out of the socket. The code now
>worked perfectly. Insert the TLC2543, and chatter.
>
>Earlier, I had a problem when I had the circuit on a breadboard. At the
>time, I was using a LTC1298 for an ADC. I noticed that the Stamp would try
>to remain powered up from the fuel cell after I had shut the system off. If
>I removed the wire from the fuel cell to the ADC input, the system would
>shut down properly. I put a 100K resistor in line with the fuel cell to ADC
>input, and I no longer had to disconnect it.
>
>Remembering this, I cut the traces on the board, and put 100K resistors in
>place. Bingo! The system works properly now. I can merrily switch power back
>and forth, using the ADC at the same time. Am I supposed to have resistors
>on all the inputs?
>
>I want to thank Sid for all his help off-list. Thanks Sid!
>
>Jonathan
>
>www.madlabs.info
>
>
>
>
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the
>Subject and Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Thanks for all of the replies. My fondest hope is that someday I really
understand all these issues. However, at this point, working will do ;-)
The 100k resistors seem to be dropping the readings by about 30mV. No big
deal at all for what I am doing.
BUT...
One other odd thing. If a jump a wire from either the battery input or the
fuel cell input, no resistor, to any unused input on the TLC2543, it works
fine. I can even jump between the supplies and the inputs that need the
resistors. No relay chatter. But the traces on the board cause chatter. No
wonder real EEs get paid so much! Remember, I'm not an EE, I just play one
in the classroom ;-) . I do have .1 and .01uF caps across the power to the
ADC, up close to the chip, and there are no noisy devices close by on the
board.
Thanks again for your time,
Jonathan
www.madlabs.info