Universal Input: Can it be done? - Page 1
Forum section: electronics / projects

author: Talib
author_rank: Newbie
timestamp: November 18, 2011, 09:07:32 am
content: Can it be done?: You have 2 terminals connected to a circuit (let's say a microcontroller with additional electronics). These two terminals are used as an input.The trick is these two terminals must be able to use either a contact switch or 5V pulse as an input. The idea here is to have a circuit that requires the user to have no electronic knowledge and not need to connect any additional electronics to the terminal on the user's side (Bonus if the circuit is polarity independent and integrates a opto-isolator).

author: PeterG
author_rank: Frequent Contributor
timestamp: November 18, 2011, 09:34:18 am
content: Most pins on a Microcontroller can be used as an input.What do you mean by '5V pulse as an input'? A simple Pulse or some sort of communication signal?A lot depends on how flexible you need the the input to be.Regards

author: Balaur
author_rank: Unknown
timestamp: November 18, 2011, 09:58:24 am
content: Assuming that the polarity of the pulse is positive (i.e. the 5V you mentioned), you can use a weak pull-down on the MCU inputs.The input will be activated by either:- A 5V pulse- A momentary switch connected to +5VSome kind of an input protection is also recommended. See attached scheme.However, this proposal is not exactly what you specified, since the switch is not connected to the two terminals.If you are able to invert the polarity of the pulse, then you can use a weak pull-up and you can then connect the switch or the pulse source to terminals.It's all I could think of in a few minutes.Cheers,Dan

author: Talib
author_rank: Newbie
timestamp: November 18, 2011, 12:06:43 pm
content: HiLet me clarify: Image a PC Board with a micro and a terminal block (2 terminal). The user must be able to wire a push-button on the terminal block or 5V and GND wires (an if possible not worry about polarity). Consider the user electronics illiterate and cannot add any other components.I've added a sketch (sorry, had to use gimp as I have no other software on this PC)https://lh5.googleusercontent.com/-PUlufDdSUkU/TsZJIVnBoRI/AAAAAAAAASY/YZ1PAI0eyBc/s640/image.jpgPS So far I have been able to do simulate it using a bridge rectifier and 2 transistors

author: sub
author_rank: Regular Contributor
timestamp: November 18, 2011, 01:52:11 pm
content: Try a high-impedence pull-up resistor on the signal line. The switch will pull it to ground, while if you attach a driver it will be forced to 0V. One will still have to deal with polarity, however.

author: codeboy2k
author_rank: Super Contributor
timestamp: November 20, 2011, 01:04:34 pm
content: If you really want only a black box circuit as you've drawn, then use a single PIC10F200. Take two GPIO pins, and put a 4.7K resistor in series with the pin.These are your inputs, can be +5 or GND, or switched. Use another GPIO pin as your signal output.The 4.7k input resistors will limit the current and provide some input protection. You can also add clamping diodes for further input protection if you want.The firmware in the PIC10F200 can use the timer to alternately set both pins to inputs, read the values, and look for binary 10 or binary 01 inputs.If you don't get either of those two, then set one pin as input, the other as output and read for a switch closure. If you read a switch closure,do a debounce delay and read again.Rinse. Repeat.The PIC10F200 is really, really cheap, and perfect for this job. You can also do the same with any two available GPIO pins of your existing microcontroller,if you have the spare pins.

author: westfw
author_rank: Super Contributor
timestamp: November 21, 2011, 03:45:38 am
content: I did a paper design for a universal LED. Bridge rectifier, 317 CC regulator. It should have worked for input voltages from about 7 to 35V of either polarity (or even AC.) It was sort-of aimed at kids' electronics construction sets things "You can connect this up to batteries pretty much however you want and it will light up." Bleh. I decided that learning to connect an LED the correct way around was something well within the capabilities of the average 5y old, and indeed that that was the sort of thing that I WANTED them to have to learn.But something like that might make sense for robust behavior in the face of less than knowledgeable adult customers.How about a 555? They're pretty robust and can be triggered by a wide variety of signals (usually negative-true, though.)