Author Topic: Universal Input: Can it be done?  (Read 2457 times)

0 Members and 1 Guest are viewing this topic.

Offline TalibTopic starter

  • Newbie
  • Posts: 2
Universal Input: Can it be done?
« on: November 18, 2011, 09:07:32 am »
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).
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 835
  • Country: au
Re: Universal Input: Can it be done?
« Reply #1 on: November 18, 2011, 09:34:18 am »
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
Testing one two three...
 

Offline Balaur

  • Supporter
  • ****
  • Posts: 525
  • Country: fr
Re: Universal Input: Can it be done?
« Reply #2 on: November 18, 2011, 09:58:24 am »
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 +5V

Some 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


 

Offline TalibTopic starter

  • Newbie
  • Posts: 2
Re: Universal Input: Can it be done?
« Reply #3 on: November 18, 2011, 12:06:43 pm »
Hi

Let 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.jpg

PS So far I have been able to do simulate it using a bridge rectifier and 2 transistors
« Last Edit: November 18, 2011, 12:14:27 pm by Talib »
 

Offline sub

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: Universal Input: Can it be done?
« Reply #4 on: November 18, 2011, 01:52:11 pm »
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.
« Last Edit: November 18, 2011, 01:59:59 pm by sub »
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Universal Input: Can it be done?
« Reply #5 on: November 20, 2011, 01:04:34 pm »
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.

 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4235
  • Country: us
Re: Universal Input: Can it be done?
« Reply #6 on: November 21, 2011, 03:45:38 am »
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.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf