PulsIn - Bs2
Archiver
Posts: 46,084
I'm starting to get a little confused on how this all works.
I'm experimenting with a BS2 reading pulses then calculating the duty
cycle by using the example in the Stamp book. For a signal
generator, I'm using a Pic 16F84 to output a pwm signal at a 50% duty
cycle.
The BS2 is reading this PWM Input but the duty cycle is varying all
over the place.
BS2 Code:
Time1 var word
Time2 var word
input 7
output 0
Duty:
pulsin 7,1,time1
if time1 > 6553 then error
pulsin 7,0,time2
time2 = time1 + time2
time2 = time2/10
time1 = time1 * 10
time2 = time1/time2
If time1 = 0 then zero
debug Dec time1," percent",1,1
pause 1000
goto duty
error: debug" out of range",1,1
pause 1000
goto duty
zero: debug"No Pulse",1,1
pause 1000
goto duty
Here is the Pic Code for the PWM Signal:
doit:
pwm 6,127,100
goto doit
Sorry, I'm real rusty since I haven't played with either one for
several years and basically have to relearn most of it. Any help
would be greatly appreciated.
I'm experimenting with a BS2 reading pulses then calculating the duty
cycle by using the example in the Stamp book. For a signal
generator, I'm using a Pic 16F84 to output a pwm signal at a 50% duty
cycle.
The BS2 is reading this PWM Input but the duty cycle is varying all
over the place.
BS2 Code:
Time1 var word
Time2 var word
input 7
output 0
Duty:
pulsin 7,1,time1
if time1 > 6553 then error
pulsin 7,0,time2
time2 = time1 + time2
time2 = time2/10
time1 = time1 * 10
time2 = time1/time2
If time1 = 0 then zero
debug Dec time1," percent",1,1
pause 1000
goto duty
error: debug" out of range",1,1
pause 1000
goto duty
zero: debug"No Pulse",1,1
pause 1000
goto duty
Here is the Pic Code for the PWM Signal:
doit:
pwm 6,127,100
goto doit
Sorry, I'm real rusty since I haven't played with either one for
several years and basically have to relearn most of it. Any help
would be greatly appreciated.
Comments
skinner02001@y... writes:
I'm starting to get a little confused on how this all works.
I'm experimenting with a BS2 reading pulses then calculating the duty
cycle by using the example in the Stamp book. For a signal
generator, I'm using a Pic 16F84 to output a pwm signal at a 50% duty
cycle.
The BS2 is reading this PWM Input but the duty cycle is varying all
over the place.
BS2 Code:
Time1 var word
Time2 var word
input 7
output 0
Duty:
pulsin 7,1,time1
if time1 > 6553 then error
pulsin 7,0,time2
time2 = time1 + time2
time2 = time2/10
time1 = time1 * 10
time2 = time1/time2
If time1 = 0 then zero
debug Dec time1," percent",1,1
pause 1000
goto duty
error: debug" out of range",1,1
pause 1000
goto duty
zero: debug"No Pulse",1,1
pause 1000
goto duty
____________________________________________________________
Your BS2 algorithm looks like it works. If I correctly remember, the
frequency of the duty is 500 hz, and the resolution of the pulsin command is 2
uS.
Assuming the above is correct, the results work on paper.
However, what may be happening is the BS2 is not a "super fast" device and it
is possible that when your PIC output goes from low to high, the stamp takes
too much time (possibly up to 240 uS, almost 1/4 the length of your pulse) to
stop reading the low pulse and start reading the high pulse. And the same
thing might be occuring with a different length of delay when the transition
goes
from high to low. However, if the delay is the same for high to low, and low
to high, then the delay should not matter. See this link for execution times.
BS2 interpreter execution timings
Another thougt is that the stamp and PIC do not share a common ground. If
not, connect the stamp ground and the PIC ground together at some point.
Have you viewed the PIC output on an O-scope? Is the PIC output a stable 50%
duty?
Ken
[noparse][[/noparse]Non-text portions of this message have been removed]
input into BS2. If the level is not high enough or fluctuate, the duty
cycle would fluctuate too. Make sure the peak is TTL level. A Schmitt
trigger like 7414 is a must for analogue signals. If you can confirm
the signal level then you can look into the code. The simplest
measuring instrument would be a resistor and an LED. If you signal can
drive the LED brightly then it's fit enough for your BS2.
- Cheers
--- In basicstamps@yahoogroups.com, "skinner02001" <skinner02001@y...>
wrote:
> I'm starting to get a little confused on how this all works.
> I'm experimenting with a BS2 reading pulses then calculating the duty
> cycle by using the example in the Stamp book. For a signal
> generator, I'm using a Pic 16F84 to output a pwm signal at a 50% duty
> cycle.
>
> The BS2 is reading this PWM Input but the duty cycle is varying all
> over the place.
>
> BS2 Code:
>
> Time1 var word
> Time2 var word
>
> input 7
> output 0
>
> Duty:
> pulsin 7,1,time1
> if time1 > 6553 then error
>
> pulsin 7,0,time2
> time2 = time1 + time2
> time2 = time2/10
> time1 = time1 * 10
> time2 = time1/time2
> If time1 = 0 then zero
> debug Dec time1," percent",1,1
> pause 1000
> goto duty
>
> error: debug" out of range",1,1
> pause 1000
> goto duty
>
> zero: debug"No Pulse",1,1
> pause 1000
> goto duty
>
>
> Here is the Pic Code for the PWM Signal:
>
> doit:
> pwm 6,127,100
> goto doit
>
>
> Sorry, I'm real rusty since I haven't played with either one for
> several years and basically have to relearn most of it. Any help
> would be greatly appreciated.
be pretty accurate. Now for the electronics portion. What is the
best way to tap into engine control system without being messing up
the signal? I have a 500hz frequency with a variable duty cycle with
an amplitude of 12 volts that I need to get down to a TTL level.
Would simply using a Schmidt trigger be able to take a 12volt and
convert it to a TTL signal? Will a voltage divider mess up the
signal to the other computer even if I keep my resistor values high?
I'm looking for the most reliable method. I thought about using a
555 but I'm not sure what the effect would be with the main supply @
5vdc and the trigger signal being @ 12. Sorry, don't know much about
electronics.
skinner02001@y... writes:
Great, I got it working by reading a Pulse from a 555 and it seems to
be pretty accurate. Now for the electronics portion. What is the
best way to tap into engine control system without being messing up
the signal? I have a 500hz frequency with a variable duty cycle with
an amplitude of 12 volts that I need to get down to a TTL level.
Would simply using a Schmidt trigger be able to take a 12volt and
convert it to a TTL signal? Will a voltage divider mess up the
signal to the other computer even if I keep my resistor values high?
I'm looking for the most reliable method. I thought about using a
555 but I'm not sure what the effect would be with the main supply @
5vdc and the trigger signal being @ 12. Sorry, don't know much about
electronics.
_____________________________________________________________
Since 500 hz is relativlely slow, you can feed that signal into an NPN
transistor, like a 2n3904.
Connections
your 12 volt signal into 10k ohms, other end of 10k into base of a 2n3904
68 k from 2n3904 base to ground
2n3904 emitter to ground
2n3904 collector to one end of 10K ohms, other end to +5 volts.
your 5 volt signal into stamp taken from the collector of the 2n3904.
When your duty signal is high, the stamp recieves a low and visa versa, easy
to deal with in your software code.
There are several other methods to do the same, opto-isolator, op-amp
comparitor. You being "new" to electronics, the NPN transistor is probably the
easiest at this point.
email me off list if you want/need more detail or options for another method
(I recently just built a duty cycle meter, but with a different uController).
Ken
[noparse][[/noparse]Non-text portions of this message have been removed]
can get beat to death however Now,Since I've learned how to do this
with a stamp, and also learned how send PWM out of a stamp on convert
it to a voltage which leads me to my next question....
Could this be accomplished without a stamp by using an RC Network and
simply measuring the voltage? If so, how in the heck figure out
which values I would need for the cap and resistor when hooked to the
500Hz signal?
--- In basicstamps@yahoogroups.com, smartdim@a... wrote:
> In a message dated 9/15/2003 3:16:49 AM Pacific Daylight Time,
> skinner02001@y... writes:
> Great, I got it working by reading a Pulse from a 555 and it seems
to
> be pretty accurate. Now for the electronics portion. What is the
> best way to tap into engine control system without being messing up
> the signal? I have a 500hz frequency with a variable duty cycle
with
> an amplitude of 12 volts that I need to get down to a TTL level.
> Would simply using a Schmidt trigger be able to take a 12volt and
> convert it to a TTL signal? Will a voltage divider mess up the
> signal to the other computer even if I keep my resistor values
high?
> I'm looking for the most reliable method. I thought about using a
> 555 but I'm not sure what the effect would be with the main supply
@
> 5vdc and the trigger signal being @ 12. Sorry, don't know much
about
> electronics.
> _____________________________________________________________
>
> Since 500 hz is relativlely slow, you can feed that signal into an
NPN
> transistor, like a 2n3904.
>
> Connections
>
>
> your 12 volt signal into 10k ohms, other end of 10k into base of a
2n3904
> 68 k from 2n3904 base to ground
>
> 2n3904 emitter to ground
>
> 2n3904 collector to one end of 10K ohms, other end to +5 volts.
>
> your 5 volt signal into stamp taken from the collector of the
2n3904.
>
> When your duty signal is high, the stamp recieves a low and visa
versa, easy
> to deal with in your software code.
>
> There are several other methods to do the same, opto-isolator, op-
amp
> comparitor. You being "new" to electronics, the NPN transistor is
probably the
> easiest at this point.
>
> email me off list if you want/need more detail or options for
another method
> (I recently just built a duty cycle meter, but with a different
uController).
>
> Ken
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
skinner02001@y... writes:
Thanks for the recommendation on the transistor. I know this topic
can get beat to death however Now,Since I've learned how to do this
with a stamp, and also learned how send PWM out of a stamp on convert
it to a voltage which leads me to my next question....
Could this be accomplished without a stamp by using an RC Network and
simply measuring the voltage? If so, how in the heck figure out
which values I would need for the cap and resistor when hooked to the
500Hz signal?
++++++++++++++++++++++++++++++++++++++++++++++++++
Question #1...ARE YOUR INITIALS S.R. and do you work for a Korean Car company
in Ann Arbor Michigan?
Q#2....What is your end goal, do you want to measure duty cycle and output an
analog voltage that corresponds to the duty cycle?
Of you want to convert some digital information to analog (DAC) using an RC
network, the only way I know how is to feed the RC with PWM. PWM can be
generated without the stamp.
Is that what you are trying to accomplish?
[noparse][[/noparse]Non-text portions of this message have been removed]
schematics. But there are a number of key factors that I could answer.
1. If you are trying to tap a signal from an engine, it is difficult
to get a fundametal frequency because there are many harmonics
overlapping it. The question is which frequency are you tapping
because harmonics can be close to the fundamental sometime especially
in engines. The best way to tap a signal from engines is physically
using optical devices just like tachomemters. I believe you can have a
lot of infos on the net regarding this.
2. To convert a 12V signal to a TTL level you can use a Voltage Level
Shifter like 40109. It works both ways, 12V to TTL or TTL to 12V. Read
the specs on 40109. You also could use a simple Zener Diode of 5.1V to
clamp the signal down. This is a brute force way and you got to check
how the signal looks like on scope for spikes. Usually you can filter
it out with capacitor.
But if you don't have much experience in electronics, you have to ask
someone experience enough to do it for you. Then you just can focus on
your programming.
--- In basicstamps@yahoogroups.com, "skinner02001" <skinner02001@y...>
wrote:
> Great, I got it working by reading a Pulse from a 555 and it seems to
> be pretty accurate. Now for the electronics portion. What is the
> best way to tap into engine control system without being messing up
> the signal? I have a 500hz frequency with a variable duty cycle with
> an amplitude of 12 volts that I need to get down to a TTL level.
> Would simply using a Schmidt trigger be able to take a 12volt and
> convert it to a TTL signal? Will a voltage divider mess up the
> signal to the other computer even if I keep my resistor values high?
> I'm looking for the most reliable method. I thought about using a
> 555 but I'm not sure what the effect would be with the main supply @
> 5vdc and the trigger signal being @ 12. Sorry, don't know much about
> electronics.
My Project:
I have a 32 channel datalogger that has a 10 volt max input allowed.
I have about 12 sensors hooked to it that output 4-20ma, varoius
voltages, and a few that read resistance and a magnetic pickup that
reads frequency, coverted to 1-10 volts. I built all the simple
interfaces and they work great. Now, I'm face with creating an
interface to to tap into about 6 channels of PWM (15 volt amplitude,
500 hz), read the duty cycle, convert it to a voltage porpotional to
the duty cycle 0-10 vdc equating to 0-100% duty cycle. I only read
these channel anywhere from 5 times per second to only once per
second.
I figured this was a perfect place for a stamp. I have played with
the stamp and pic's allot back several years ago and did some neat
stuff, however I always messed with TTL level stuff so I didn't have
to do much converting. This interface will be in a waterproof
container, however they will be next to an engine (10 feet) so it may
be prone to some RF.
The reason I'm asking these questions is to save a few headaches. If
this was anothe hobby experiment it wouldn't be too bad, however I
have an engine to log next week so I'm kind of in a rush. I brought
home one of the sensors today and put it on a scope. The specs call
for 500hz but it's actually around 400hz. It puts out a real nice
square wave from 0volts to 15 volts.
That is what my project consist of.
Richard
--- In basicstamps@yahoogroups.com, smartdim@a... wrote:
> In a message dated 9/16/2003 4:17:30 AM Pacific Daylight Time,
> skinner02001@y... writes:
> Thanks for the recommendation on the transistor. I know this topic
> can get beat to death however Now,Since I've learned how to do this
> with a stamp, and also learned how send PWM out of a stamp on
convert
> it to a voltage which leads me to my next question....
> Could this be accomplished without a stamp by using an RC Network
and
> simply measuring the voltage? If so, how in the heck figure out
> which values I would need for the cap and resistor when hooked to
the
> 500Hz signal?
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
> Question #1...ARE YOUR INITIALS S.R. and do you work for a Korean
Car company
> in Ann Arbor Michigan?
>
> Q#2....What is your end goal, do you want to measure duty cycle and
output an
> analog voltage that corresponds to the duty cycle?
>
> Of you want to convert some digital information to analog (DAC)
using an RC
> network, the only way I know how is to feed the RC with PWM. PWM
can be
> generated without the stamp.
>
> Is that what you are trying to accomplish?
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
Inverting Hex buffer which has 6 CMOS to TTL drivers, allows VIn to
exceed Vdd which means I can power the chip off 5vdc, and it's okay
to have 15 vdc going into the driver. Am I on the right track? I'm
going to look at the 40109 as well but for some reason I can't find
it in my Motorola books.
Richard
--- In basicstamps@yahoogroups.com, "Johari Aziz" <johaziz@y...>
wrote:
> I couldn't answer each one of your question unless I can see the
whole
> schematics. But there are a number of key factors that I could
answer.
>
> 1. If you are trying to tap a signal from an engine, it is difficult
> to get a fundametal frequency because there are many harmonics
> overlapping it. The question is which frequency are you tapping
> because harmonics can be close to the fundamental sometime
especially
> in engines. The best way to tap a signal from engines is physically
> using optical devices just like tachomemters. I believe you can
have a
> lot of infos on the net regarding this.
>
> 2. To convert a 12V signal to a TTL level you can use a Voltage
Level
> Shifter like 40109. It works both ways, 12V to TTL or TTL to 12V.
Read
> the specs on 40109. You also could use a simple Zener Diode of 5.1V
to
> clamp the signal down. This is a brute force way and you got to
check
> how the signal looks like on scope for spikes. Usually you can
filter
> it out with capacitor.
>
> But if you don't have much experience in electronics, you have to
ask
> someone experience enough to do it for you. Then you just can focus
on
> your programming.
>
> --- In basicstamps@yahoogroups.com, "skinner02001"
<skinner02001@y...>
> wrote:
> > Great, I got it working by reading a Pulse from a 555 and it
seems to
> > be pretty accurate. Now for the electronics portion. What is
the
> > best way to tap into engine control system without being messing
up
> > the signal? I have a 500hz frequency with a variable duty cycle
with
> > an amplitude of 12 volts that I need to get down to a TTL level.
> > Would simply using a Schmidt trigger be able to take a 12volt and
> > convert it to a TTL signal? Will a voltage divider mess up the
> > signal to the other computer even if I keep my resistor values
high?
> > I'm looking for the most reliable method. I thought about using
a
> > 555 but I'm not sure what the effect would be with the main
supply @
> > 5vdc and the trigger signal being @ 12. Sorry, don't know much
about
> > electronics.
It has rail to rail output. It has 3 outputs selected by two lines.
If you run it on 5 volts, you can then easily amplify by two for a 0 to 10v
output, 5 volts = 50% duty, 7.5 volts 75% etc.
Or if you run it on 10 volts you have 0 to 10 volt output. A cheap and dirty
DAC can be made with a thing called and R2R resistor network. It is I/O pin
hungry though (8 pins), but you can use a shift register and get away with only
3 pins.
Ken
though it is known as a Quad Low-to-High Voltage Level Shifter it also
works as High-to-Low if Vcc>Vdd. Vcc and Vdd could be of any voltage
level between 3 to 18V. Yes 4050 also works well for your application.
Generally it is a logic level conversion from CMOS to DTL/TTL.
- Cheers,
- Johari
--- In basicstamps@yahoogroups.com, "skinner02001" <skinner02001@y...>
wrote:
> Great, I appreciate the info. I'm looking at a MC14050B Non
> Inverting Hex buffer which has 6 CMOS to TTL drivers, allows VIn to
> exceed Vdd which means I can power the chip off 5vdc, and it's okay
> to have 15 vdc going into the driver. Am I on the right track? I'm
> going to look at the 40109 as well but for some reason I can't find
> it in my Motorola books.
>
> Richard
>
>
> --- In basicstamps@yahoogroups.com, "Johari Aziz" <johaziz@y...>
> wrote:
> > I couldn't answer each one of your question unless I can see the
> whole
> > schematics. But there are a number of key factors that I could
> answer.
> >
> > 1. If you are trying to tap a signal from an engine, it is difficult
> > to get a fundametal frequency because there are many harmonics
> > overlapping it. The question is which frequency are you tapping
> > because harmonics can be close to the fundamental sometime
> especially
> > in engines. The best way to tap a signal from engines is physically
> > using optical devices just like tachomemters. I believe you can
> have a
> > lot of infos on the net regarding this.
> >
> > 2. To convert a 12V signal to a TTL level you can use a Voltage
> Level
> > Shifter like 40109. It works both ways, 12V to TTL or TTL to 12V.
> Read
> > the specs on 40109. You also could use a simple Zener Diode of 5.1V
> to
> > clamp the signal down. This is a brute force way and you got to
> check
> > how the signal looks like on scope for spikes. Usually you can
> filter
> > it out with capacitor.
> >
> > But if you don't have much experience in electronics, you have to
> ask
> > someone experience enough to do it for you. Then you just can focus
> on
> > your programming.
> >
> > --- In basicstamps@yahoogroups.com, "skinner02001"
> <skinner02001@y...>
> > wrote:
> > > Great, I got it working by reading a Pulse from a 555 and it
> seems to
> > > be pretty accurate. Now for the electronics portion. What is
> the
> > > best way to tap into engine control system without being messing
> up
> > > the signal? I have a 500hz frequency with a variable duty cycle
> with
> > > an amplitude of 12 volts that I need to get down to a TTL level.
> > > Would simply using a Schmidt trigger be able to take a 12volt and
> > > convert it to a TTL signal? Will a voltage divider mess up the
> > > signal to the other computer even if I keep my resistor values
> high?
> > > I'm looking for the most reliable method. I thought about using
> a
> > > 555 but I'm not sure what the effect would be with the main
> supply @
> > > 5vdc and the trigger signal being @ 12. Sorry, don't know much
> about
> > > electronics.
>
> Since 500 hz is relativlely slow, you can feed that signal into an
NPN
> transistor, like a 2n3904.
>
> Connections
>
>
> your 12 volt signal into 10k ohms, other end of 10k into base of a
2n3904
> 68 k from 2n3904 base to ground
>
> 2n3904 emitter to ground
>
> 2n3904 collector to one end of 10K ohms, other end to +5 volts.
>
> your 5 volt signal into stamp taken from the collector of the
2n3904.
>
> When your duty signal is high, the stamp recieves a low and visa
versa, easy
> to deal with in your software code.
>
Ken, I built the circuit like you stated but it did not work, however
I remove the 68K resistor that ties base to groun and It works, I get
an inverted 5 volt signal like you stated.
Maybe I messed up reading your instructions as I did this:
Emitter to ground
Base to 10k to Signal In
Base to 68k to ground
Collector to 10K to 5vdc
Collector to scope / stamp
It did not work, but again, if I remove the Base to 68K to ground it
works.
Thanks,
Richard
rwskinner@w... writes:
Ken, I built the circuit like you stated but it did not work, however
I remove the 68K resistor that ties base to groun and It works, I get
an inverted 5 volt signal like you stated.
Maybe I messed up reading your instructions as I did this:
Emitter to ground
Base to 10k to Signal In
Base to 68k to ground
Collector to 10K to 5vdc
Collector to scope / stamp
It did not work, but again, if I remove the Base to 68K to ground it
works.
___________________________________________
hmmmmmmmmm,,,
From what you wrote in the email above, it appears you have it correctly
configured. But to be redundant let me word one portion slightly different.
68k directly from the base lead to the emitter lead (which of course is same
as you stated).
/
---/\/\/\/\/
|
| \
| |emitter
/ |
68k \ gnd
/
gnd
Anyway, the purpose of the 68k resistor to ground is to improve (speed up)
the turn off time of the transistor when the input goes low. The 68k resistor
is an additional path to ground to discharge base emitter junction capacitance,
as this junction capacitance is charged when the transistor is on (input is
high).
500 hz is not considered "high frequency" by any means, so if the circuit
operates fine without the 68k, go for it without the resistor. And since you
have
an o-scope and viewed a "good" waveform, run without the 68k.
Looking back at some "older" circuits, I have used the configuration many
times without the 68k ohms, and did not have trouble with those circuits. So I
guess you can run without the 68k. Again, the main purpose of the 68k is to
improve the turnoff time of the transistor, and that is not all that important
at
500 hz. I generally use a "base discharge resistor" out of habit.
Ken
[noparse][[/noparse]Non-text portions of this message have been removed]
The signal must not be able to supply much current at all because I noticed
that the input signals amplitude, measured before the transistor, dropped
from 15 volts to 9volts when it was hooked to the 10K resistor. I tried to
read up some on the transistor and "if" I understand it correctly, the 10K
resistor between the stamp pin and base is simply there to limit the current
going to the stamp, and the base when the transistor is off and sinking to
the emitter, right?
If I assumed correctly, does that mean if I increase the size of the 10K
resistor, then it will reduced the draw down on the input signal? will that
affect the operation of the transistor any ? For grins, I tried a 33k there
and the input signal only dropped from 15volts down to 13 volts.
Richard
Original Message
From: <smartdim@a...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, September 17, 2003 11:28 PM
Subject: Re: [noparse][[/noparse]basicstamps] Re: PulsIn - Bs2
> In a message dated 9/17/2003 5:58:11 PM Pacific Daylight Time,
> rwskinner@w... writes:
> Ken, I built the circuit like you stated but it did not work, however
> I remove the 68K resistor that ties base to groun and It works, I get
> an inverted 5 volt signal like you stated.
>
> Maybe I messed up reading your instructions as I did this:
>
> Emitter to ground
> Base to 10k to Signal In
> Base to 68k to ground
> Collector to 10K to 5vdc
> Collector to scope / stamp
>
> It did not work, but again, if I remove the Base to 68K to ground it
> works.
> ___________________________________________
>
> hmmmmmmmmm,,,
>
> From what you wrote in the email above, it appears you have it correctly
> configured. But to be redundant let me word one portion slightly
different.
>
> 68k directly from the base lead to the emitter lead (which of course is
same
> as you stated).
>
> /
> ---/\/\/\/\/
|
> | \
> | |emitter
> / |
> 68k \ gnd
> /
> gnd
>
>
> Anyway, the purpose of the 68k resistor to ground is to improve (speed up)
> the turn off time of the transistor when the input goes low. The 68k
resistor
> is an additional path to ground to discharge base emitter junction
capacitance,
> as this junction capacitance is charged when the transistor is on (input
is
> high).
>
> 500 hz is not considered "high frequency" by any means, so if the circuit
> operates fine without the 68k, go for it without the resistor. And since
you have
> an o-scope and viewed a "good" waveform, run without the 68k.
>
> Looking back at some "older" circuits, I have used the configuration many
> times without the 68k ohms, and did not have trouble with those circuits.
So I
> guess you can run without the 68k. Again, the main purpose of the 68k is
to
> improve the turnoff time of the transistor, and that is not all that
important at
> 500 hz. I generally use a "base discharge resistor" out of habit.
>
> Ken
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> 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/
>
>
rwskinner@w... writes:
Ken, Thanks for your help. It's very much appreciated.
The signal must not be able to supply much current at all because I noticed
that the input signals amplitude, measured before the transistor, dropped
from 15 volts to 9volts when it was hooked to the 10K resistor. I tried to
read up some on the transistor and "if" I understand it correctly, the 10K
resistor between the stamp pin and base is simply there to limit the current
going to the stamp, and the base when the transistor is off and sinking to
the emitter, right?
If I assumed correctly, does that mean if I increase the size of the 10K
resistor, then it will reduced the draw down on the input signal? will that
affect the operation of the transistor any ? For grins, I tried a 33k there
and the input signal only dropped from 15volts down to 13 volts.
Richard
_________________________________________________________________
Richard,
Your transistor explanation is good....and I would agree with your assesment
that the supply circuit does not have much current capability.
What were you using to supply the 15 volts? The original configuration should
not cause the voltage of Vin to drop, unless VIN is really "weak" with
regards to current output, as you mentioned.
Or, your collector resistor is not 10k, a much smaller value..
Transistors 101
In this config, you are using the transistor as a switch.
The transistor has a parameter called Beta, for a 2n3904, Beta is usually
well over 100, but let's assume a value of 100 (A WORST CASE SCENARIO).
The maximum current through the transistor collector will be equal to the
voltage applied to the collector resistor (5v in your case) divided by the
collector resistance (10k in your case)
5v/10k = 0.0005 amps, 0.5 mA.
To determine what value base resistor is needed, you need to know how much
base current is needed for the transistor to "suck" .5mA through the collector
resistor.
This is done by dividing the collector current (0.5 mA) by Beta (100)....
0.5mA / 100 = 5 uA.
To "push" 5 uA through the base emitter junction you need to select and
approprite base resistor, and know how much voltage will be put into the base
resistor (15 volts in your case).
To select the base resistor, use ohms law......15v/5uA = 3 Meg ohms.
So in theory, for a 2n3904 to suck .5 mA through the 10k collector resistor
with 5 volts on it, the base resistor could be 3 meg, with 15 volts applied.
However, since switching speed is not an issue in this case, "we" will many
times go overkill on base current, hence the original 10k ohm value.
I suspect that the circuit you are currently using to test this circuit does
not have much capacity to supply current, and that is why the voltage drops so
low (9v) with our original config.
You could use 100k base and 10k collector resistors, and still have it work.
When the base resistor becomes too large, the effect will be the collector
voltage will not go as low when the transistor is on. In reality, you will only
be able to make the collector voltage go as low as about .6 volts, which is
good enough.
There are several other factors to consider to bias your transistor, but this
is a quick and dirty "transistors 101" and gives enough information to use it
as a switch.
I will be out of town the next two days and will not have acess to email [noparse]:([/noparse]
Lastly you wrote:
"if" I understand it correctly, the 10K
resistor between the stamp pin and base is simply there to limit the current
going to the stamp, and the base when the transistor is off and sinking to
the emitter, right?
CHANGES
"if" I understand it correctly, the 10K
resistor between the stamp pin and base is simply there to limit the current
going out OUT OF the stamp, and the base when the transistor is ON and
sinking COLLECTOR CURRENT to
the emitter, right?
right!!!
Ken
PS, it is very early in the morning here (CA) and I am late leaving for work
(no biggie) and in my rush I might have made some typo or calculation mistakes
[noparse][[/noparse]Non-text portions of this message have been removed]