digitalpin, reading a high from 3V

Is it possible, using pull up or pull down resistors to get a digitalpin to read a high from 3V? Or would I be better off using an analogread to achieve this?

Thanks!

As it happens 3v is the threshold where the chip is supposed to read a HIGH (0.6 x VCC in the data sheet).

So it should be OK but of course is right on the edge so I would suggest an analog input would be better unless you can get a few more 100mV out of the signal.


Rob

Figure 29-11 shows 2.7 V I/O pin input HIGH threshold at Vp = 5 V ,
29-12 -//- 2.2 V -//- LOW

What source is driving the 3V signal - how much current can it sink?

MarkT:
What source is driving the 3V signal - how much current can it sink?

You see, for me, this confuses me. I haven't found a way to fit it into my limited understanding of electronics.

I understood that a circuit DRAWS as much current as it needs. So I thought that it was only voltage I needed to watch out for when connecting things to I/O pins.

....I guess I'm wrong?

What do you mean by how much current can it sink? How would I find out?

Thanks. And sorry.

What do you mean by how much current can it sink?

He means how much current can your source suck into itself when it has zero volts on its output.
How much current your source could supply would be called sourcing.

Sourcing and sinking are very much the same sort of thing only the direction of current flow is reversed.

Grumpy_Mike:
He means how much current can your source suck into itself when it has zero volts on its output.

That sounds worrying. Excuse my ignorance. I didn't know circuits did this.

I don't know and I don't know how to find out.

Eek :fearful:

What's the source of this "3V"?

runaway_pancake:
What's the source of this "3V"?

A wireless doorbell speaker unit

I didn't know circuits did this.

They do.
What he wants to know is if you put a pull up resistor on the input would this upset things at your source. A pull up resistor would give you more voltage for your arduino to sense but it might upset your source. So before recommending it he needs to know if your source can sink the current that would be supplied by the pull up resistor and would the extra voltage on it when it is high to use a technical term bugger it up.
Therefore we need to know in more detail what this source actually is.

A wireless doorbell speaker unit

In which case while you can connect it directly to an arduino input, for extra reliability put it through a transistor.
Bell to 10K resistor -> base of transistor. Collector to arduino input, emitter to ground. Enable the internal pull up resistor.

Grumpy_Mike:

A wireless doorbell speaker unit

In which case while you can connect it directly to an arduino input, for extra reliability put it through a transistor.
Bell to 10K resistor -> base of transistor. Collector to arduino input, emitter to ground. Enable the internal pull up resistor.

Hi Mike (please don't be grumpy, but I want to understand your answer)

Why does the fact that it's a wireless doorbell speaker unit mean I can connect it to my Arduino? What about it means it's safe? Or did you just mean that it'll work?

How does a transistor make it more reliable? By upping the voltage?

And why do I enable the pull up resistor? To steer the input to ground if no 'message' from the speaker?

THANKS

How does a transistor make it more reliable? By upping the voltage?

Yes by making it higher than just over the threshold it is lest susceptible to noise.

And why do I enable the pull up resistor?

So that when no voltage is being supplied to the base and the transistor is off the input is pulled up to +5V. When current is supplied the transistor is on and so connected to ground. In other words the logic level of the signal is inverted, but that doesn't matter as the software can cope with that.

Why does the fact that it's a wireless doorbell speaker unit mean I can connect it to my Arduino

No it's the 3V signal bit means you can connect it directly. The fact that it is a bit of electronic circuitry means it is probably not best to apply a 5V pull signal to it as it could damage the door bell so best go with a transistor.

Dane:
Is it possible, using pull up or pull down resistors to get a digitalpin to read a high from 3V? Or would I be better off using an analogread to achieve this?

The Arduino’s have a built-in analog comparator well suited for a task like this. On the Uno/Duemillanove (AtMega328), comparator positive input is mapped to digital pin 7. A voltage input on this pin is compared against a reference voltage (of your choice) and a change of input that transitions above/below this reference will be captured by the microcontroller. You can read the output of the comparator as a high or low input in much the same way as you read a digital pin. The difference is that you determine the reference point (as opposed to 0.6Vcc for high and 0.3Vcc for low). The reference input can be set to any of the following:

  1. Input voltage on digital pin 6
  2. Input voltage on any of the analog pins
  3. The internal bandgap reference (1.1V for Atmega328)

There is a dedicated interrupt associated with the analog comparator that can be set to trigger on a rising and/or falling transition and the AtMega can optionally be set to keep a count of transitions if so required.
A couple lines of code to initialize the comparator and a single line of code to read comparator state and transition status is all that is required. Using interrupt, counter and the multiplexor is a bit more involved, but also not required for many tasks. Putting in the time to learn how to use this built-in peripheral may be well worth the effort.