I have an Uno connected to some external equipment (robot). The equivalent diagram is as following:
(1) The Uno and the robot electronics have the common ground.
(2) Uno is powered by either the external power supply or by the computer USB port
(3) The robot is powered by 6V battery
(4) Both the Uno and the robot may have power on or off randomly, and the power-up procedure can't be implemented (e.g. user unplugs USB at will).
(5) The idea is to use an LED in series with the 1K resistor to supply slightly less than 5V into the digital ports of Arduino (only D12 is shown on the diagram). This would provide both the signal conditioning (less than 5V on the port) and the visual indication of the Uno-to-robot link.
(6) With all the components but without Arduino, the voltage reading at the test point is 4.85 V, as shown. If the test point is shorted to the ground, the current does not exceed 4.5 mA (LED lit, naturally).
Could anybody advise what happens if:
Case A -- Pin D12 configured as an input with no pull up.
(A1) S1 is off (UNO has no power), S2 is on -- ?.
(A2) S1 on, S2 off -- obviously "floating input pin"
(A3) S1 and S2 on -- ?
Case B -- Pin D12 configured as an input with an internal pull up resistor.
(B1) S1 is off, S2 is on -- Same as A1?.
(B2) S1 on, S2 off -- obviously "logical one" on the input
(B3) S1 and S2 on -- ?
Case C -- Pin D12 configured as an output.
(C1) S1 is off, S2 is on -- Same as A1?.
(C2) S1 on, S2 off -- obviously nothing happens
(C3) S1 and S2 on, D12 Low -- ?
(C4) S1 and S2 on, D12 High -- ?
I suspect I know some answers, but I only have one board and don't want to experiment with it. Any insight would be greatly appreciated.
Is there any standard simple way of achieving communication between Arduino and several external devices without pulling a common 5V wire to each and every device (pls. do not advise serial ports, analogue pins and such)? Perhaps, an opto-coupler?
E.g. if I stick a CMOS output on the robot side, obviously it would try to power up a switched-off Uno through the diode and fry something (likely the CMOS chip). But, I do have the current limiter, do I?
In a large-scale project (or even a breadboard powering both Arduino and the other electronics), what happens if the Arduino's Vin is suddenly disconnected whilst the rest of the project is powered?
I still don't see what you want to do.
Status, data, ?
It's more like status, or rather "presence". The external device tells Arduino: "I am still attached to this wire and my power is on". Arduino checks the port every so often, or reacts on the port status change via an interrupt.