Hi!
I'm working on a project were I want as many sensors as possible that reacts on pressure (i ex. lifting a glass of water from a surface). How many of those can I connect to the Arduino?
You'll need to define your sensors better.... and also what you mean by "the Arduino". There is no such thing as THE Arduino. Have a look here to compare the number of pins.
If the sensor is just a simple on/off switch, then you could have a switch on every digital pin (and use the analog pins as extra digitals too.). If the sensor is some kind of analog device, then you would be limited to one per analog pin.
Having said that you could probably get clever with multiplexing and increase the numbers, but that's the simple answer.
PS..... you might like to leave some pins over for some kind of output. Presumably you need to do something with the knowledge gleaned from the sensors? Light up some LEDs, message on an LCD, whatever.
Hi,
If you have a ladder of resistors from 5v to ground say 11 x 10k and put a switch between each to a common analogue input, then you would have 10 switches on one analogue input, each returning a different value... I've used this before you just need to calculate or measure the analogue values and test for it!!
Hope it helps, Regards
Mel.
Cactusface:
Hi,
If you have a ladder of resistors from 5v to ground say 11 x 10k and put a switch between each to a common analogue input, then you would have 10 switches on one analogue input, each returning a different value
Yeah that's a good idea too: that's how the 5 buttons on this LCD work.
Cactusface:
Hi,
If you have a ladder of resistors from 5v to ground say 11 x 10k and put a switch between each to a common analogue input, then you would have 10 switches on one analogue input, each returning a different value... I've used this before you just need to calculate or measure the analogue values and test for it!!Hope it helps, Regards
Mel.
THANK YOU! 8)
With 6 analog inputs and 11 resistors in each voltage divider you can have 6 x 10 = 60 separate values.
The difference between output #4 and output # 5 is 2.72V vs 3.18 V. (46 mV separation)
If you use 21 resistors in each voltage divider you can have 21 x 6 = 126 separate values..
The difference between output #4 and output # 5 is 4.04 V vs 3.81 V.. (23 mV separation)
You can pick a number in between like 16 resistors per divider which would give you a separtion of about 30 mV.
Urgh. I hate that kind of input.
The Arduino's analogRead is rather noisy. You'll need to add a 0.1uF from Aref to ground, do some averaging of the signal in software, and don't use too many resistors on one input. That 10 bits is really more like 8.5 ENOB (Effective Number of Bits), and the numbers are also affected by changes in the 5V line.
I don't know where you get "bits" . There are no "bits" . The voltage divider scheme has no binary weighting. There are simply considered discrete inputs with a YES/NO status .(pass or fail CASE statement for that voltage range.=> 'if ( (x > y) && (x < z) )'
With a bit of creativity and external logic you could potentially go up to millions.
What do you mean, "no bits"? You are using the ADC. Hence, bits.
That 10 bits is really more like 8.5 ENOB (Effective Number of Bits)
As long as the voltage measured is consistent (Meaning Vcc = 5V and doesn't too much so the measured voltage is predicable within
a specific range) the resolution of the ADC is not an issue. The REPEATABILITY depends strongly on the fluctuation of Vcc since the
value reported is based on Vcc. This is a perfect reason to use a precision external 5V reference so the value reported is not one level above or below the actual tap on the voltage divider. Personally , I would use a 16-bit ADC (ADS1115)
ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier [STEMMA QT / Qwiic] : ID 1085 : Adafruit Industries, Unique & fun DIY electronics and kits with a precision 5 volt reference.
You can add flexibility or complexity to the scheme using analog switches.
but since you hate that kind of input I guess it doesn't make any difference as far as you're concerned.
Frankly I would think there would be some kind of I2C switch strip that has like 50 to 100 tiny pressure sensitive switches ....