This is my first project, and actually first real experience with electronics.
My goal is to make a module that can accept 32 inputs that will trigger TCP commands.
in the attached diagram, i have under the "Inputs" both a "COM" and a "GND"
the MAX306 is a 16 channel multiplexer.
as for now if i input dry contact closures, i must connect them between the "COM" and the inputs.
That way the input passes the COM's voltage to the analog inputs.
If i want the inputs to supply external 20V i must connect the -(negative) to the "GND" and the +(positive) to the inputs.
Since i am using a resistor voltage divider the input stays under 5V.
As for now that works great.
My questions are,
1. how can i have it have a single "COM" that will accept both dry contacts or external 20V
2. If i can do the above, is there a way to have the external voltage wired both ways (either + to COM and - to the inputs or the opposite)?
3. What type of protections should i add?
4. Any feedback for improving the circuit?
5. I have noticed that printing Serial data delays the whole code(Every loop lasts about 1.5 millisecond when sending one string a loop) , is there a way to avoid this?
Later on i will add a voltage regulator to power the Arduino with the external power supply.
* At least i am able to make a nice diagram