Pages: [1]   Go Down
Author Topic: 2.5V input using pull-up?  (Read 1088 times)
0 Members and 1 Guest are viewing this topic.
East Coast USA
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Hands in the air!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey everybody,
I have a sensor that outputs a 2.5v-true and 0v-false signal. I want to read this signal with a digital Input on my Arduino.
Can I use a the internal pull-up resistor on the digital I/O pin, to make the 2.5v read HIGH, and the 0v read LOW?
Cheers,
~Bob
Logged

Build your own sentry gun! http://psg.rudolphlabs.com

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Definitely maybe.

Tell us more about your sensor. Do you have a part number?

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2600
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No.
you have to push up voltage, basic rules 1/3 of 5 V is LOW,
2/3 is HIGH. That give 3.3V and higher  to be considered as high.
2.5 in undefined area.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 543
Posts: 27348
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

basic rules are just that tho.
Reading section 28 of the datasheet (Atmega328) shows that the Vin recognized as high varies from 0.6V to 0.9v depending on the input pin and VCC voltage being used.
Thus 2.5v will be read as high with no further manipulation needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Reading section 28 of the datasheet (Atmega328) shows that the Vin recognized as high varies from 0.6V to 0.9v depending on the input pin and VCC voltage being used.

I think you are misinterpreting this section. The relevant parameter is Vih, input high voltage (except XTAL1 and RESET). The range for Vih is 0.6*Vcc to Vcc+0.5. On an Arduino system Vcc=5V so the range is 3.0V to 5.5V. The sensor has to output at least 3.0V to *guarantee* that it is recognized as logic high (it might be anyways at 2.5V, but it won't be guaranteed).

The real question is whether the sensor output is "stiff" and can hold its own at 2.5V in the face of a weak pullup resistor or whether its output resistance is high enough that the internal pullup resistor is enough to bring it over the 3.0V threshold.

We'll know more once the OP tells us what sensor is in use smiley-wink

--
The Quick Shield: breakout all 28 pins to quick-connect terminals
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2600
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

VIH Input High-voltage 0.7 VCC VCC + 0.5 V
(from the docs)
it means 5*0.7 = 3.5V

there is a basic for CMOS logic 1/3 low and 2/3 high. Dosn't mean what kind of chip
do you have deal with, if it's CMOS it always the same.
It's all depend of technology, CMOS or TTL, .
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 209
Posts: 13012
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In my testing...

- 16 MHz clock
- 328 processor
- USB power (5.12 V)

...2.5 volts is close to the threshold.  Somewhere between 2.4 V and 2.5 V the readings became flaky and unreliable.  The threshold is likely to vary from processor-to-processor.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 543
Posts: 27348
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Huh. Ok, I can accept that re-looking at the datasheet.
Learned something new today.
Thanks to all.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12390
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Add a  diode between the sensor and pull-up (cathode to the sensor) and you'll probably get it working (assuming its then not too high at logic low).
Logged

[ I won't respond to messages, use the forum please ]

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2600
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would not recommend last advice,
if sensor was design to operate  in low voltage ,
applying high level to its output using diod or resistor could destroy it, and if not instantly
it would definitely degrade reliability on long term .
solution only to use a "buffer" - one stage transistor will help, may be optocouple.
Logged

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12390
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Depends on the characteristics of the input protection diodes.  4000 series CMOS chips can run with Vdd disconnected so long as at least one input is logic high - suggests the protection diodes can take a weak pull-up as a load OK - but check the datasheets.
Logged

[ I won't respond to messages, use the forum please ]

East Coast USA
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Hands in the air!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the advice. The sensor was a an old fiber-optic sensor I scrounged up, I don't have any part number for it though.
I tried it on a digital pin with no pull-up, and it skipped around between low and high, like some of you predicted. I tried with the internal pull-up and it stayed high.
In the end, I just used an analog input pin, but thanks again!
Cheers,
~Bob
Logged

Build your own sentry gun! http://psg.rudolphlabs.com

Pages: [1]   Go Up
Jump to: