Reading two inputs with one analog pin

Hello everybody,

For a project I'm working on I need to read more inputs than I have analog pins on my Arduino Nano, and all my digital pins are already spoken for. In a nutshell, my Nano needs to communicate with 5 Raspberry Pi Zeros.

After reading up on several options (R2R network, shift register, etc...) I came up with the following.

Each analog input (5x) will need to read either the press of a button, or a pulse coming from one of the Zeros. Because of the resistors, I'll read 4.47V for the pushbutton, and 2.25V for the pulse from the Zero. When both are active at the same time, I'll get 4.48V, which is OK, as the button has precendence over a pulse anyway (for my project).

I added the diodes to prevent current flowing from the Nano to the Zero and vice versa, but since all devices are powerd by the same source, I don't expect huge differences between both 5V lines from the Nano or the Zero.

In my opinion, this should work, but I'd like to know the opinion of others before I start building this project. Is this a good way? Is there a better, easier way to achieve the same goal?

Thanks in advance!

Marlon

Circuit can be simplified to one (~25k) resistor between Pi and analogue pin.

Enable the internal pull up resistor in pinMode.
Connect Arduino button between pin and ground.

A HIGH on the pin > Arduino button not pressed and Pi pin HIGH.
A LOW on the pin > Arduino button pressed.
Medium voltage on the pin > Pi pin LOW (internal pull up resistor and external resistor make a voltage divider).

Did you already use A6 and A7 of the Nano (analogue pins only).
Leo..

The Pi is strictly 3.3V only. you can just use the diodes and pull-down resistor.

Wawa:
(... solution - thanks! ...)
Did you already use A6 and A7 of the Nano (analogue pins only).
Leo..

No, but I'd rather not use them, otherwise I would end up with two different ways of handling the buttons and Pis. By using 5 pins, each for one couple of button/Pi, they all act/work the same.

I noticed you left out the diodes - should I not use them?

MarkT:
The Pi is strictly 3.3V only. you can just use the diodes and pull-down resistor.

I forgot about the 3.3V!!! I guess the diodes are necessary instead of optional.

Thanks,

Marlon