Pages: [1]   Go Down
Author Topic: recognize if a led is connected on a digital out  (Read 708 times)
0 Members and 1 Guest are viewing this topic.
Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

is there a simple way in the setup to recognize if a led is connected on a digital out?

Thanks for any hints,
Rudi
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

do you mean for the Arduino to electrically see if an LED is connected or not, rather than checking to see if it lights?
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 145
Posts: 5453
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

is there a simple way in the setup to recognize if a led is connected on a digital out?

Thanks for any hints,
Rudi
No, there is no easy or indeed difficult way to do this.

Can't you measure the Arduino current usage with something? Now turn the resistor on/off and see if it changes.

A vision system looking for a flashing LED...?
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What are you trying to do  Rudi ?
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What are you trying to do  Rudi ?

After reset i need to initialize if some sensors are connectet or not. this is important for the code in the loop.
A Connector in this case is a small box, one type is an LDR with an Control LED, other is a hall sensor with a Controll led.
In the loop i wait for input of one of this sensor boxes, selected by random.
In the selected box the led is on, for the user to see whats the next box

All is a game for R/C

So, before i initialize my "Random Machine" i need to know how much of this Sensors/LEDs are connected to the Arduino.

Thanks!
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Heres a plan that might work to see if your sensor box is plugged in :-

If you run the LED from an Analog pin  , which is set to input,  and high ( so as to set its pullup resistor )  you could then AnalogRead the voltage on the pin.

If there is no LED to ground you will get 5v,  but if the LED ( red?) is connected you will see 2v.

The LED will probably glow from the current of the pull-up resistor, but once you have established the LED is there, you can switch the pin back to output to turn on the LED when you want.

Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Heres a plan that might work to see if your sensor box is plugged in :-

If you run the LED from an Analog pin  , which is set to input,  and high ( so as to set its pullup resistor )  you could then AnalogRead the voltage on the pin.

If there is no LED to ground you will get 5v,  but if the LED ( red?) is connected you will see 2v.

The LED will probably glow from the current of the pull-up resistor, but once you have established the LED is there, you can switch the pin back to output to turn on the LED when you want.


Great! thank you!
Logged

0
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3480
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could change a pin from (output, high) to (input, low) and see how it behaves while floating. A loaded pin will behave differently than an unloaded pin. But this is neither very easy nor very reliable.
Logged

Check out my experiments http://blog.blinkenlight.net

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the led has it's cathode lead wired to ground then you could just run a wire from the anode lead of the led to a analog input pin. It will read the Vf voltage value of the led when it's on and 0 when it's off.

Lefty

Lefty
Logged

Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thx all, i will give a try to this solutions!

Nice day, Rudi
Logged

Pages: [1]   Go Up
Jump to: