Go Down

Topic: What happens if I put a sensor in a digital input instead of an analog (Read 473 times) previous topic - next topic

Destined

I have an IR proximity sensor and I realise I am meant to use the analog input and that works fine.

I only have a uno so I have 5 analog outputs. It is possible to use the digital ones at reduced resolution?

emdee

Yeah that will work,but your reduced resolution is ON or OFF. At whatever voltage the Arduino's logic threshhold is set to, your digital input will invert it's digitalRead() value. You won't be able to measure distance per say, but you will know when something is within a particular radius. Just trim your analog value to set this to the desired distance.

cr0sh

The best ways around this issue (lack of analog inputs):

1) Use one or more SPI or I2C ADC chips (they come with varying number of inputs, and sometimes a higher resolution than the Arduino's built in ADC).
2) Use an analog multiplexer IC (bascially allows you to "fan out" a single analog input into multiple input which can be programmatically selected via digital addressing using digital I/O pins).

You might be able to implement something like #2 using transistors or mosfets, but it won't be as compact (and you would lose the addressibility, unless you implemented logic for that as well).
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Destined

Thanks. Just checking what would happen.

I think I will try and get a mega. That is probably the easiest solution.

Go Up