I need to read the state of an electronic device, alas when the output is 5v and when 0.
I'd like to know if it's safe to plug in the 5v in a gpio Arduino + gnd common bridge.
Also, as it's paramount that I protect my source device, would you advice a diode on the 5v?
Just to clarify- you have a device which has an output that is either high or low, depending on the state of the machine? And you want to monitor this output with an Arduino?
The inputs of the Arduino are high impedance so you should be fine doing that.
joerack:
Also, as it's paramount that I protect my source device, would you advice a diode on the 5v?
If it is so important then you may as well use a diode for protection. It won't cause any harm if the output from the device is a simple high/low.
joerack:
I will use a Stepdown for 3.3v
Are you using a 3.3V Arduino? If not, there is no need to reduce the voltage. 5V on the input is fine for Arduino which run at 5V.
If the output of the device will provide a few milliamps an opto isolator is a way to monitor the devices state and have isolation between the device and the Arduino. Connect the output of the transistor (collector) of the optoisolator to an Arduino input with the internal pullup enabled. No need for a stepdown, then.
Thank for your answers. I've found an easier way to monitor the state of my burglar alarm rather than soldering cables on some microcontroller pins.
I've installed a current sensor ACS712 which monitors the transformer 12vdc. When the alarm is off, I get less than 0.10 A, when it's on, I get >0.15A, and when the siren goes off, I get over 0.5A. connected these three states to a variable, and now I have a way to monitor my old alarm online
While I see that OP has his answer, for the benefit of others who might find this thread, there's one other important thing that wasn't mentioned - if the arduino is not powered, and you connect a pin to 5v (with a common ground to whatever that 5v is coming from), the arduino will be "back powered" through the protection diodes on every pin; these are not intended to handle the amount of current that would flow, so doing this will damage the arduino (most often manifesting as a "blown pin" that is stuck at Vcc or Gnd - chips exhibiting blown pins should be discarded as there is often other damage to the chip that is not immediately apparent). Arduino must be powered whenever an external voltage is applied directly to it.
One more question: unfortunately the current draw with alarm on and off doesn't change as much as I hoped for. The difference within off/on is 6 red led turning on. I'd like to find a way to make my alarm consume more current and have a better measurement window. Any ideas?
joerack:
I'd like to find a way to make my alarm consume more current and have a better measurement window.
That is a silly suggestion.
If this is a burglar alarm, the electronics is always functional, so there would be no essential difference between being "armed" and not.
You say that there are a set of LEDs which indicate that it is armed. Go back to groundFungus' reply. You find the voltage source which feeds one or more LEDs and there will be a resistor limiting the LED current - as there always must be. So across the resistor and LED combination (or if there are more than one LED in series) you will have a logic voltage. Just connect an optocoupler and 1k or 2k2 resistor across that voltage to get an indication in parallel with those LEDs. As groundFungus pointed out, with the optocoupler output connected between an Arduino pin and ground using INPUT_PULLUP it will accurately indicate the optocoupler status.