computer log when external switch is flipped?

  • Thread starter Thread starter David Deley
  • Start date Start date
D

David Deley

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.)
 
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.)

Back in the DOS days the parallel port was quite useful for the odd digital
IO line. I presume someone makes USB digital IO cards nowadays -
presumably someone must make one that to the PC appears like a serial port.
 
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
 
Peter said:
Back in the DOS days the parallel port was quite useful for the
odd digital IO line. I presume someone makes USB digital IO
cards nowadays - presumably someone must make one that to the
PC appears like a serial port.

See the discussion of older computers in the "Memory chip question"
thread. Those things have everything you need.
 
Good idea protecting the computer input. I hadn't thought that far yet.

I'm using "The MailMinder Wireless Mail Alert" device I purchased for
only $12. A little transmitter box attaches to the mailbox door inside,
detects when the door is tilted open and sends a signal. I was surprised
the receiver actually worked in the house--I thought that would be too
far away with too many walls blocking the signal.

However, problems with the inexpensive receiver are:

.. There's no way to turn the receiver off
.. There's no way to stop it from sounding an alert when you open the
mailbox to insert outgoing mail, or to retrieve your mail.

But for $12 it's a nice start.

Thank you for all the suggestions.

http://members.cox.net/deleyd/
 
David said:
Good idea protecting the computer input. I hadn't thought that far yet.

I'm using "The MailMinder Wireless Mail Alert" device I purchased for
only $12. A little transmitter box attaches to the mailbox door inside,
detects when the door is tilted open and sends a signal. I was surprised
the receiver actually worked in the house--I thought that would be too
far away with too many walls blocking the signal.

However, problems with the inexpensive receiver are:

. There's no way to turn the receiver off
. There's no way to stop it from sounding an alert when you open the
mailbox to insert outgoing mail, or to retrieve your mail.

But for $12 it's a nice start.

Thank you for all the suggestions.

http://members.cox.net/deleyd/

OK, I see there is some kind of receiver here, with a LED on it.
Now, all you need, is a way to connect that to the computer.

http://ecx.images-amazon.com/images/I/516WTBD1M4L._AA280_.jpg

The easiest thing to do, would be to use your computer as a
source of power for the receiver. The Molex disk drive connector
has +5V and +12V on it. If you need some other voltage, you can use
a three terminal regulator. For example, this one might make 3.3V
from a 5V input for you.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LM1086CSX-3.3-ND

If the receiver used a 9V battery, you could use the 12V on the
Molex, plus a three terminal (linear) regulator, to create 9V.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LM2940T-9.0-ND

There are various ways to get the signal from the LED on the receiver,
into your computer. A photodarlington would be a relatively simple solution,
but you'd need a light tight box around the photodarlington and the receiver
LED, so only the LED could trigger it. This converts light, into an
electrical signal. The Darlington pair is two transistors cascaded, so
that the gain is higher. There might be sufficient gain, to drive
a logic signal (like on a game paddle switch) directly. Darlingtons are
not fast, but would be suited to the low speed detection, of a light or
LED going on. The ones I have in my junk bin, don't have part numbers,
and I fiddle with them until they work :-)

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=BPW38-ND

You could also connect directly to the receiver circuit (open up the
receiver, and add circuitry to it), but that is getting pretty complicated.
If there is sufficient swing on the signal driving the LED, you might
buffer a logic signal from that with a single transistor. Radio Shack
still carries stuff like that.

http://www.radioshack.com/product/index.jsp?productId=2062586

But at least your $12 purchase, has solved most of the important
problems for you. No lightning to worry about.

Paul
 
David said:
Good idea protecting the computer input. I hadn't thought that
far yet. I'm using "The MailMinder Wireless Mail Alert" device I
purchased for only $12. A little transmitter box attaches to the
mailbox door inside, detects when the door is tilted open and
sends a signal. I was surprised the receiver actually worked in
the house--I thought that would be too far away with too many
walls blocking the signal.

However, problems with the inexpensive receiver are:

. There's no way to turn the receiver off
. There's no way to stop it from sounding an alert when you open
the mailbox to insert outgoing mail, or to retrieve your mail.

But for $12 it's a nice start.

You must be able to acknowledge the alert. Simply do so when you
return to the house.

Please do not top-post. Your answer belongs after (or intermixed
with) the quoted material to which you reply, after snipping all
irrelevant material. Your failure has lost the entire previous
quotations. See the following links:

<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/> (taming google)
<http://members.fortunecity.com/nnqweb/> (newusers)
 
CBFalconer said:
You must be able to acknowledge the alert. Simply do so when you
return to the house.

Please do not top-post. Your answer belongs after (or intermixed
with) the quoted material to which you reply, after snipping all
irrelevant material. Your failure has lost the entire previous
quotations. See the following links:

<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/> (taming google)
<http://members.fortunecity.com/nnqweb/> (newusers)
I hate bottom-posters. I have to scroll through everything I've already
read before just to get to the new reply. (But for you I'll be nice and
post this on the bottom.)
 
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.)

There are three or four products on the market which do the mailbox part of
the job for you. One example is:

http://www.heartlandamerica.com/browse/item.asp?PIN=79348&SC=WIY20001&

but if your mailbox is further away there are some more expensive units
which have more range.

As for getting the data into the computer, things are more difficult than
they used to be in DOS days where a program could do anything it wanted
with the hardware. The simplest thing might be to adapt some item which
already knows how to talk to the computer. I'd probably start my
experimentation with a cheap USB mouse. Converting the level from the
notification device might be simple or difficult but since there is a LED
driver in the device getting that to simulate a mouse click might involve
nothing more sophisticated than a optical coupler.
 
John said:
There are three or four products on the market which do the mailbox part
of the job for you. One example is:

http://www.heartlandamerica.com/browse/item.asp?PIN=79348&SC=WIY20001&

but if your mailbox is further away there are some more expensive units
which have more range.

As for getting the data into the computer, things are more difficult
than they used to be in DOS days where a program could do anything it
wanted with the hardware. The simplest thing might be to adapt some item
which already knows how to talk to the computer. I'd probably start my
experimentation with a cheap USB mouse. Converting the level from the
notification device might be simple or difficult but since there is a
LED driver in the device getting that to simulate a mouse click might
involve nothing more sophisticated than a optical coupler.
point your webcam at a clock.
Hook your mailbox to the "take a snapshot" button on the webcam.
If you're worried about theft, point the webcam at the mailbox
and use a capture program that timestamps the pictures.
 
CBFalconer wrote:

See the discussion of older computers in the "Memory chip question"
thread. Those things have everything you need.

Not necessarily, I think you were referring to having a parallel port
available, that was not the point I was making - I was not clear. In DOS
days direct access to the hardware was easy. NT onwards cut you off from
that for good reasons, but not useful if you have your own reasons for
directly accessing the hardware. I think linux had a special driver, I
played with it a long time back, to allow you to do direct IO.
 
Peter said:
Not necessarily, I think you were referring to having a parallel
port available, that was not the point I was making - I was not
clear. In DOS days direct access to the hardware was easy. NT
onwards cut you off from that for good reasons, but not useful
if you have your own reasons for directly accessing the hardware.
I think linux had a special driver, I played with it a long time
back, to allow you to do direct IO.

I run W98 on this machine. No problem. Pick the OS for the job
you want it to do.
 
CBFalconer wrote:

I run W98 on this machine. No problem. Pick the OS for the job
you want it to do.

Well, in that case either dos or if you want it networked an embedded linux
system. Really can't see what an antique version of windows gives you.
However, in this case I'd say none at all. In the UK we tend not to have
US style mail boxes when mail is delivered but I could see that it might be
handy with the US system. Why not just an indicator light somewhere in the
house and a set / reset latch?
 
Back
Top