pull-up or pull-down resistor for switch?

I am in the process of designing an Arduino-powered device that will interface between two other devices. The logic is pretty simple: it will need to wait for the first device to 'short' a connection (similar to pressing a momentary-release push switch), and then it will output two signals to the second device (via optocouplers). I know the second device will be protected by using optocouplers and no direct voltage will flow to it, however the only way to 'read' the first device will be to sense when it completes a circuit (which as far as I know requires sending voltage to it as if it were a switch).

My desire is to protect this device as much as possible. I will be using the 3.3V Arduino Pro Mini (unless someone suggests another device). I am familiar with programming logic (including C), though am not very familiar with the electrical engineering aspect of micro-controller programming. I have read about pull-up and pull-down resistors being used with switches to ensure the proper reading is obtained when there is no input at the switch.

I am curious as to which is a safer means to connect to the first device (that in essence is an automatic switch), and should I be using a diode or other form of protection to prevent any excess voltage from entering the device? I am guessing pull-up as it seems the 3.3V is connected to the device only when the 'switch' is being pressed, but do recall something about electricity actually flowing backwards so want to get the opinions of others with experience and knowledge. (if there is another way to 'read' the device such as how an optocoupler 'writes' to a device, please let me know)

Below are two images of both pull-down and pull-up connections from the Arduino to the device being read (the output device optocouplers/resistors are not drawn). I apologize for the lack of standard schematic symbols - I have not had a chance to learn Eagle or another program yet. To see standard conventions illustrating what I am questioning, please look at Fig 5.5 and Fig 5.6 at ladyada.net/learn/arduino/lesson5.html

this software is not letting me post the image directly : the drawing is at i977.photobucket.com/albums/ae259/travel5239/arduinoswitchpulldownvsup.png

Another question is can the Arduino Pro Mini provide +3.3V power or does this need to be wired directly to the battery with this board? Speaking of battery, what will be an effective (preferably lightweight and long-lasting) battery solution to power the 3.3V Arduino (plus resistors you see in the drawings and 2 optocouplers/resistors not in the drawings)? It will most likely be powered on for around two hours at a time, and I'll attach an on/off switch to the battery to power down when not in use. I have to study the capabilities/functions of the chipset - if supported, I'll be using interrupts or other routines to save power consumption while waiting for the first device to 'send' its signal. (Does the Arduino Pro Mini board consume more power than something like an ATtiny25V chip with the basic necessary components?)

Thanks in advance for your suggestions!

now it let me post the image:

From the perspective of the ‘switching device’, while both examples are ‘safe’, I would propose that between the choices that the pull-up example is. Why? because it only supplies current to the switch via a current limiting resistor (the pull-up) and therefore less chance of some internal short-to-ground inside the ‘switching device’ drawing excessive current and damaging it. The pull-down examples has direct connection to the voltage source, so less ‘fault current’ protection.

Again both examples are very safe and common, this is mostly an exercise in worst case protections.

Most of us are more concerned or interested on what protection methods and components offer the best protection of the Arduino board and it’s on-board components.


Thanks for your quick response!

Would you recommend a TVS diode between the other device and the arduino ground (in the diagram on the right for the pull-up scenario) for additional protection? While I do care about the Arduino, I’m much more concerned more about the other device as it costs many times more (and the overall project still works without the Arduino component, though the Arduino addition will add extra functionality).

Do you have any suggestions on how to power the 3.3V Arduino Pro Mini, and an enclosure that will hold it with the battery/batteries, resistors/optocouplers, two headphone jacks, and an on/off switch?

Thanks again!

See no real benefit of adding a TVS device in the pull-up version.

As far as powering the system with a battery, it really depends on the run time requirement you have (battery life Vs total power requirement of the system). The nano seems to have several powering options but I would think using the internal 3.3vdc on-board regulator would add a little safety as the regulator will just shutdown if overloaded by the loads. Then you have to decide if you want to utilize rechargeable or single use batteries. I'm not a real fan of the standard single use 9vdc battery, they are really expensive for the actual capacity they supply, series AAA or AA are a better value I think but do take up more room for the same voltage (no free lunch I guess).

Cases are very subjective and can be quite expensive if metal is desired. One trick I learned was to look out for all Hayes type modems in thrift stores or possibly E-bay. I've found them for a couple of dollars and they are very high quality extruded aluminum cases with many savable components. Here is one new case that SparkFun carries:


Good luck; Lefty