reading voltage w/o RCTIME?
tahlorn
Posts: 18
Greetings again.
Working with the BS2. I plan to have a program start when a device gives an input pin a voltage (will be 0.6V). Just needs to know that there is or isn't voltage appliked, not how much.
Everything I have found says to use RCTIME and an A/D converter. The signal is not analog, but digital. I am just looking for a simple solution to go in an IF THEN statement, and the RCTIME seems it needs too much setup for my single simple application.
Can anyone help me, or point me to some sample code?
Thanks in advance!
Working with the BS2. I plan to have a program start when a device gives an input pin a voltage (will be 0.6V). Just needs to know that there is or isn't voltage appliked, not how much.
Everything I have found says to use RCTIME and an A/D converter. The signal is not analog, but digital. I am just looking for a simple solution to go in an IF THEN statement, and the RCTIME seems it needs too much setup for my single simple application.
Can anyone help me, or point me to some sample code?
Thanks in advance!
Comments
if INPUT1 = 1
then
OUTPUT2 = 1
else
OUTPUT2 = 0
and I have to use an op amp or transistor to boost the 0.6V to 1.4V at the INPUT1, as that is the threshold voltage. Ja?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Input is coming from a distance sensor, that will output 0V with no obstruction and 0.6Vdc when there is an obstruction.
Franklin,
from what I saw, it is 1.4V. Though would be safe to boost it further.
My only issue is finding a transistor with a base-emitter voltage low enough for 0.6V to do anything, and I prefer a transistor over a OpAmp as it is simpler to wire up.
alphy,
Danke! I know basic logic and such, but the actual names is what gets me. And now I know (and knowing is half the battle).
The 0.6 volt threshold is a rule-of-thumb value that applies for collector currents on the order of 1 milliamp. But the controlling voltage from base to emitter is really governed by the exponential Ebers-Moll model, and for the 2N3904, the ON voltage at 25 degC is typically (from the Fairchild data sheet)
Vbe = 0.66 + 0.06 * log (Ic) with Ic in mA and Vbe in volts.
When Ic=1 microamp (0.001 mA), it comes out to 0.48 volts.
You could also find a germanium transistor, which would intrinsically have a lower threshold voltage. Or, an Op amp with a voltage divider is not really hard to wire up. Same number of components really, and better control over the threshold.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
-Phil
Ir Sensor, with a 31" trigger distance, digital signal, 0V or 0.6V dependent upon obstructed or unobstructed.
Wanting the output voltage of 0.6V to be a trigger to the BS, somehow. I don't care how, as long as it happens.
I am having a dickens of a time finding a transistor with a base-emitter voltage of 0.6V or less, otherwise I would be using that.
Any information on what you think would work is always welcome! Be as detailed as you would like.
Thanks!
I used one of these a while ago with a different MC, different application. I just seemed to have forgotten everything from then.
-still a newbie
www.acroname.com/robotics/parts/SharpGP2Y0D02YK.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Grrrrrr... the output pin needs to be pulled to Vdd/+5V, like Uncle Phil told you.
So, Grrrrrr...
EDIT: It works! Yeah, needed to put a 10k resistor in line there like was stated above. I don;t get the full 5V as I am using a lot of the power on other things as well, but it is enough to read as a high. Thanks again!
Post Edited (tahlorn) : 4/16/2008 12:02:08 AM GMT