2.5V input using pull-up?

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

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

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.

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.

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 ;)

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

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

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.

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

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

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.

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.

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