David said:
How would I go about interfacing my computer to the outside world? I'm
wondering if there's a way I can log the date/time when my USPS mailbox
gets opened. Which eventually translates to I have a wire with a hi/low
voltage for the mailbox is open/closed -- how do I connect that wire to
the computer? What sort of input port is suitable for such a thing?
And of course I'll need some software. (I hope I don't have to write
another device driver. It's been many years since I did that kind of
programming. Someone else must have already written something. Someone
else is probably already logging when their mailbox door is open/closed.)
A parallel port is one interface. Another would be a hacked game controller
(game port interface). Game controllers have switches on them, for firing,
or selecting game options and so on. Both the old game port (15 pin) and
newer USB game paddles might be candidates.
The software interface would be a challenge. Companies in the business
of making devices like that, probably bundle software to make it easier
to use. Otherwise, you could need to do some programming of your own.
(For example, with the game controller, you'd find the game controller
API and program using it.)
http://www.eagledaq.com/display_product_2620.htm
Some other issues
1) Protecting your computer. Stringing a long wire and connecting it
directly to a computer port, is asking for trouble. Even an adjacent
lightning strike, could induce enough potential in the wire, to
destroy the computer. Optical isolators are one way, of handling
differences between subsystems, and affording some protection
(if, say, AC from the wall came in contact with the secondary circuit).
But this may not be enough to protect against lightning. The optoisolator
needs its own power supply, but at least that power supply can be
destroyed, without the computer being harmed. You would not extend power
from a Molex on the computer, because that would be a path for lightning
as well.
http://en.wikipedia.org/wiki/Opto-isolator
It can take a bit of imagination, to come up with sufficient isolation
to satisfy this requirement. For example, if the post box had an AC
switch, and switched an incandescent light on and off, which was
mounted inside the house, you could use an optical detector tied to
the computer, to detect the light. That would allow you to
construct an enclosure for the light and detector, with some physical
separation between the light, and the computer. That would achieve a
much higher isolation voltage limit, than the 2KV to 5KV of a single
optical isolator integrated circuit.
2) Scaring the Postman. Seeing wires, batteries, switches, in or around
the postbox, is going to get you "no service" pretty rapidly. Your
post office probably has a pretty extensive set of rules, for when
to-your-door delivery will be denied. Even hinting that you're a
"crazy person", is likely enough to get them to stay away.
In terms of "not scaring the postman", you'd want a mechanism for the
post box door, which provides no mechanical resistance. Again, that
suggests an optical method. As long as there are wires stretching back
from the post box circuit, there is still a need for isolation. So it
will cost you one separate power supply, an optical interruptor detector
type device, and the optoisolator at the computer end, to afford
some protection. You can see some different kinds of optical devices
here.
http://dkc3.digikey.com/PDF/T091/P2466.pdf
If the optical detection method could be done with fiber optics,
that would allow a direct connection from the computer to the
electronics (since a fiber optic cable by itself, would have no
lightning safety issue). But that would likely be a nightmare to
work out optically. (Dental plastic fiber might carry more light, than
a telecommunications glass fiber, as the aperture and cross
section might be wider. While the plastic fiber might be cheap to make,
don't expect it to be cheap to buy.)
If you need a source of inspiration, this Wikipedia article may
help. I'd never heard of this person, until one day I was caught
rigging up something out of bailing wire and binder twine, and
someone mentioned the guy's name
http://en.wikipedia.org/wiki/Rube_Goldberg_machine
HTH,
Paul