I am thinking of using an Arduino for controlling several signals. I have a question I hope someone can help with. I want to use the output from my NCE DB20 occupancy detectors as input to the Arduino. Can I connect the DB20 output directly to the Arduino without risking damage to it? What about the output from a Tortoise Switch SDPT? Can it also be connected directly? I've searched the web for an answer to this with no luck.
D-manbut it is necessary to configure the input pin as pull-up enabled.
in general, an open-collector output is convenient to provide a signal from one device to another. The problem is each device may be operating at different voltages. Even if they both operate at 5V, they may be slightly different.
with an open-collector output, the receiving device provides the desired voltage thru a pull-up resistor (e.g. 10k) and the device providing the signal simply grounds the voltage provided by the pull-up or it doesn't ground it allowing the signal to be at the pulled up voltage. It doesn't need to know what the receiving device voltage is and the two devices can operate at significanty different voltages.
The partial schematic below shows an open-collector output, a single transistor with its collector connected thru "1" to a pulled-up input of a 2nd device.
Figure-2 of the NCE BD-20 manual shows an open-collector output with a capacitor across it. It sounds like the Arduino inputs can be optionally configured with an internal pull-up resistor.
A mechanical switch can also be used in place of an open-collector output, since both can ground the input.
greg - Philadelphia & Reading / Reading
Yes, the digital pins on the Arduino have optional internal pullups you can utilize, OR use the traditional external pullup resistors.
Note that if you hook the Tortoise contacts up to switch an input to ground, you'll almost certainly want to add some debounce logic to your code (plenty of examples on the Arduino site) so that it doesn't flip back and forth between ground and not while the wipers are still moving inside the Tortoise.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
SHould not be a problem with the BD-20, there is debouncing in the design of the circuit because otherwise it would flip back and forth between occupied and not occupied if the track was even a little dirty.
If you've looked at any of the Arduino tutorials it's mentioned in the first one that uses a button to turn the LED on and off. Those cheap tactile switches that come in the parts kits usually have some serious contact bounce problems and as that tutorial explains, when you have a simple program that turns the LED on or off each time you press the button, sometimes you will press the button and the LED will stay off. Or stay on, if it was on - that's not because it missed your press of the button, but because it saw 2 or more pressees even though you think you only pressed once. Code is given to get around that, but if there will be multiple inputs (one Arduino can certainly handle more than one block detector and one turnout) there is a library called Bounce you can use that handles the debouce for whatever inputs you want.