Thanks for pointing this out, didn't see this fault when I draw this little circuit. Thanks again!If you are driving the port pin as an output to drive the LED, put the Rled and Led series pair across the pullup resistor. Then drive the port pin low to turn the LED on.
Switch the LED off by changing the port pin to an input. That way the port never tries to drive the switch high when it is operated to Gnd.
When the LED is on, momentarilly switch the port to input to read the switch status then back to output low to keep the LED lit. The few microseconds the LED may be off when reading the switch will not be seen.
The pullup resistor is still needed across the LED and its resistor as the LED drops a couple of volts so the port would not pull up to high without it.
I should have mentioned that the remote buttons could be up to 40m away (most likely 20m).You could do it that way but as I mentioned above is a lot easier.
View attachment 138370
I properly didn't explain well enough in my OP.If you want a button read why use an ADC channel? As drawn using Q1 as an NPN I think your LED will always be On. For a simple button read maybe something like this:
View attachment 138372
Using a Digital input the logic will be low when the LED is On (button pushed). When the button is held the LED is ON and there is a Logic Low to your DIO. Button released is a Logic High to the DIO.
Ron
Detect pushbutton by releasing smoke?
OK, makes sense now and the ADC will make for easier. Years ago I did a little work with an alarm tamper system. They used a diode across a switch at the remote location. Another thing used was called EOLR (End of Line Resistor) where a switch has a resistor across it at the end of a line. Sometimes two resistors are used. I want to say circuits like this are popular in Fire Alarm circuits and security circuits making it known if a line is cut or damaged or if a valid alarm condition exist. See what a Google of "End of Line Resistors Circuits" gets you. Your ADC can become a window comparator of sorts.I properly didn't explain well enough in my OP.
The buttons are in a remote location, up to 40m away.
What I mean by monitoring is have the ability to detect:
That's why I use an ADC, make sense?
- the wire is open
- the wire is shorted out
- the remote buttons are attached
In my drawing, the IO will be driven low most of the time, only change to ADC for a short time to read the inputs. It also have the ability to flash the LED if needed.
Where did I screw it up? Little help here Joey.Detect pushbutton by releasing smoke?
Upon button press, base current is going to be exceedingly high.Where did I screw it up? Little help here Joey.
Ron
I thought my circuit already can detect open? I am using a normally closed sw here, or am I missing something?Using your circuit, add a resistor across the pushbutton. Then you can read if the line to it is open.
Can you explain a bit more how you use a diode across a switch at the remote location?OK, makes sense now and the ADC will make for easier. Years ago I did a little work with an alarm tamper system. They used a diode across a switch at the remote location. Another thing used was called EOLR (End of Line Resistor) where a switch has a resistor across it at the end of a line. Sometimes two resistors are used. I want to say circuits like this are popular in Fire Alarm circuits and security circuits making it known if a line is cut or damaged or if a valid alarm condition exist. See what a Google of "End of Line Resistors Circuits" gets you. Your ADC can become a window comparator of sorts.
Ron
With the added resistor, you can detect the difference between the switch open and the wire broken.I thought my circuit already can detect open? I am using a normally closed sw here, or am I missing something?
Can you explain why my circuit doesn't detect open? Here is how I think it can detect it:With the added resistor, you can detect the difference between the switch open and the wire broken.
With the appropriate resistor valued (or the diode and resistors) you can tell if the line is open, shorted or switch operated.
Uh Oh, someone left out a base resistor.Detect pushbutton by releasing smoke?
I have forgotten how it worked but I think the idea was at the location of the switch the idea was the diode dropped about 0.7 volt. When switch closed the drop went to zero across the switch. Similar to the use of end of line resistor(s). The idea was if the line were cut or open the operator would know. Same thing you are after.Can you explain a bit more how you use a diode across a switch at the remote location?
Now you mentioned "End of line Resistors", I remember it, will google it, thanks