newbie: use digital i/o pin as input for this situation?

I want to "monitor" a circuit that is simply the + and gnd of an LED terminal. Basically, when the LED is on (or is flashed - same thing), I want to detect that.

Question is: What do I need to measure on that circuit to make it safe to plug into one of the Arduino [Uno] digital I/O pins?

For example, do I need to check the voltage coming thru those connectors and make sure it's within some tolerance? Should I use a resistor of some kind so I "pull down" the circuit when it's not (supposed to be) lighting the LED?

Basically, I'm pretty good with programming (including C/C++), and know a good bit about electricity -- but electronics I am a newbie.

Thanks in advance,
AJ

Basically, I'm pretty good with programming (including C/C++), and know a good bit about electricity -- but electronics I am a newbie.

As you understand programming why would you need to read the value of a output pin when it's only your software commands that turn the led on in the first place. Just use a flag variable and set it true anytime you set the output pin true and set the flag false anytime you set output pin false. Then in you code anytime you need to know the state of the output pin just read the flag variable.

Don't make the task more complicated then it needs to be.

Lefty

No, I want to monitor an external, pre-existing circuit on another device. There is a "+LED" and a "GND" terminal on this device.

I want to know how to safely use two wires to connect this "LED Output" to an Arduino Input (do I need a resistor or other device to protect the Uno, if so what variables do I need to know about this LED output like voltage, etc.). I have no control over this circuit -- when the LED circuit is energized or not.

I know how to monitor my own code and variables, that's not an issue (and, in fact, when I get to monitoring this external device's LED, I will be storing such values).

I don't want to simply connect a wire from this device's "+LED" to one of my Uno's digital inputs if I jeopardize frying the board or that I/O's particular capability on my Uno.

Is that more clear?

Just like when doing the button tutorial. The digitalwrite accounts for current by turning on a 20k resistor built into the arduino to limit the incoming current while reading the button press, though in your case its the LED that its reading a signal from, but its kinda the same principle. Make sure the LED is running on 5V though.

Actually looking now, the digital read tutorial doesn't do a digitalwrite, it uses an external 10K resistor. Thatd work too though requires you to have another part in your system.

Note crosscheck this with someone else before going and trying it. I'm still a scrub with electronics.

Yeah, I have tested-out the button-press/LED tutorial, and that includes a 1k resistor, because you have to pull the non-completed circuit to zero -- if you use the onboard pull-up, it'll just keep the LED lit the whole time.

Bottom-line what are those parameters I need to know about the external device's LED output (i.e. voltage, and others) before I connect the LED+ on the device to one of my Uno's digital I/O ports? And do I connect my Uno's GND to the external device's GND? Not clear on that either.

Thanks for the reply.

Id figure, Just make sure you've got 5V going to the LED. Then connect the LED+ to the digital pin with a resistor in your line somewhere. And then the LEDs gnd should also go to your arduino's gnd.

Whats the LED in anyways that your trying to monitor, theres probably a better signal you could get somewhere else with less uncertainty.

Nikarus:
Whats the LED in anyways that your trying to monitor, theres probably a better signal you could get somewhere else with less uncertainty.

Believe it or not, I want to monitor the number of flashes of the LED over a period of time. It "cycles" as a rudimentary way of identifying faults in that system. So "three flashes, break, three flashes, break..." will mean something different than "nine flashes, break, nine flashes, break..."

As that device is a "closed system" and I can't define additional outputs from it to me, I have to work with what I can get. :wink:

Aha well as long as you know that no more then 5V is going through the LED, and in a line from the LED, through a resistor (10k s are your friends), itll be just fine through the arduino. Then just ground everything.

Certainly a lot safer then trying to get a useable signal from the motor of an airsoft gun, to try and tell how many shots have been fired by the thing.

Nikarus:
Certainly a lot safer then trying to get a useable signal from the motor of an airsoft gun, to try and tell how many shots have been fired by the thing.

Cool. I'll give it a go. Your project sounds kinda cool though!

Appreciate your time.