Re: door opening sensor HW for OpenBSD?

2018-03-27 Thread Hess THR
Hello. 

I was thinking of a cheap USB mouse after I sent my original mail, but your 
list is.. wow :) long. 

So it sends a mail when door is moved even a little bit and it plays an MP3. 
The mouse costed $3. 

it just works. 

pic: 
https://i.imgur.com/7X6N059.jpg
https://i.imgur.com/eROpANf.jpg

Thanks :)

> Sent: Saturday, March 24, 2018 at 11:50 PM
> From: Robert <info...@die-optimisten.net>
> To: misc@openbsd.org
> Subject: Re: door opening sensor HW for OpenBSD?
>
> On Sat, 24 Mar 2018 22:32:02 +0100
> "Hess THR" <hessnovth...@mail.com> wrote:
> > Can you please recommend any hardware, that I could plug in to the notebook 
> > and though I could send a warning mail when the door was moved 
> > (open/closed). 
> 
> I can think of so many ways to do this, from boring to insane :)
> 
> * Mount a switch on top of the door that gets unpressed when the door
>   opens, and connect to the serial port. Then read the pin status.
> * The same, but mount the switch behind the door so that it gets
>   pressed when the door opens.
> * Use a magnetic switch instead, and read it through the serial port.
> * Put a keyboard behind the door, so that the door presses against a
>   key when it opens. Map the key to a script.
> * Attach a mouse to the door and react on the mouse movement.
> * Attach a GPS sensor to the door and measure movements.
> * Attach a USB barometer and detect the air pressure diff when the door
>   opens.
> * Attach a USB gyroscope to the door. Detect movement.
> * Attach a USB light sensor (Arduino?) and detect movement.
> * Put an RFID tag on the door, and attach an RFID reader, to detect
>   when the tag approaches the reader.
> * Attach the laptop to the door and use the built-in gyroscope (if
>   available).
> * Same, but use the gyroscope from the HD. Might require firmware
>   hacking.
> * Don't oil the door and evaluate the microphone input.
> * Attach any USB device, but route the 5V line through a switch
>   attached to the door. Detect when the device attaches.
> * Mount the laptop behind the door so that the door opens/closes the
>   laptop lid. Detect wake/sleep state.
> * Fix your credit card to the door and have it move through a card
>   reader when the door opens. Check account balance through script.
> 
> Send pix!
> 
> regards,
> Robert
> 
> 



Re: door opening sensor HW for OpenBSD?

2018-03-25 Thread Pierre Emeriaud
2018-03-24 23:22 GMT+01:00 Lyndon Nerenberg :
> By far the easiest way to do this is to connect a switch to the door that 
> opens/closes as the door opens/closes.  This assumes that when you say "the 
> door moves" you really meant "is opened or closed".
>
> Whether the switch is normally open or normally closed doesn't matter.  Wire 
> the switch to a serial port; connect one side to DTR, the other to CD.

Serial ports are long gone on todays laptops sadly.

> Now you can write a program that runs a loop that (1) opens the blocking tty 
> device, then (2) reads the descriptor, which will block until CD drops 
> returning an error from read(2), at which point you close the descriptor and 
> repeat the loop.

A method I implemented in the past at our hackerspace was to use an
ethernet nic, and some kind of modified loopback cable. Wire 1(tx+) to
3(rx+) and a switch or a photoresistor between 2(tx-) and 6(rx-). When
the switch closes the loopback is completed and the link goes up.
ifstated(8) detects it and runs whatever you want. Send a mail,
logger(1) to a remote syslog, snmp trap...

You can even use a cheap managed switch and very cheaply add plenty of
ports for on/off sensors. The switch sends a trap when a link goes
up/down and there you go.

Kudos to the project that gave me this idea:
http://www.newtonnet.co.uk/catfeeder/ :)



Re: door opening sensor HW for OpenBSD?

2018-03-25 Thread Daniel Gracia
Hack an Amazon Dash: just register the thing, don't attach it to any
product, wire it anywhere and listen to the ARP probes thatwill pop
everytime the thing is pushed and connects to your WiFi network. It's a
nice, clean, small, wireless, silly battery-powered no-nonsense
overengineered solution.

2018-03-24 22:32 GMT+01:00 Hess THR :

> Hello,
>
> I have an OpenBSD amd64 notebook running 24h next to a door, ~50cm.
>
> Can you please recommend any hardware, that I could plug in to the
> notebook and though I could send a warning mail when the door was moved
> (open/closed).
>
> I can do the scripting part, but I just don't know where to start for
> hardwares that sense that the door was moved.
>
> Many, many thanks.
>
>


Re: door opening sensor HW for OpenBSD?

2018-03-24 Thread Lyndon Nerenberg
By far the easiest way to do this is to connect a switch to the door that 
opens/closes as the door opens/closes.  This assumes that when you say "the 
door moves" you really meant "is opened or closed".

Whether the switch is normally open or normally closed doesn't matter.  Wire 
the switch to a serial port; connect one side to DTR, the other to CD.

Now you can write a program that runs a loop that (1) opens the blocking tty 
device, then (2) reads the descriptor, which will block until CD drops 
returning an error from read(2), at which point you close the descriptor and 
repeat the loop.

(1) will complete when the switch closes.  (2) will complete when the switch 
opens.  After each event, you can perform whatever actions you want.




Re: door opening sensor HW for OpenBSD?

2018-03-24 Thread Base Pr1me
Robert, I'm a huge fan of over engineering. Thanks for the chuckle!!

On Sat, Mar 24, 2018, 15:52 Robert  wrote:

> On Sat, 24 Mar 2018 22:32:02 +0100
> "Hess THR"  wrote:
> > Can you please recommend any hardware, that I could plug in to the
> notebook and though I could send a warning mail when the door was moved
> (open/closed).
>
> I can think of so many ways to do this, from boring to insane :)
>
> * Mount a switch on top of the door that gets unpressed when the door
>   opens, and connect to the serial port. Then read the pin status.
> * The same, but mount the switch behind the door so that it gets
>   pressed when the door opens.
> * Use a magnetic switch instead, and read it through the serial port.
> * Put a keyboard behind the door, so that the door presses against a
>   key when it opens. Map the key to a script.
> * Attach a mouse to the door and react on the mouse movement.
> * Attach a GPS sensor to the door and measure movements.
> * Attach a USB barometer and detect the air pressure diff when the door
>   opens.
> * Attach a USB gyroscope to the door. Detect movement.
> * Attach a USB light sensor (Arduino?) and detect movement.
> * Put an RFID tag on the door, and attach an RFID reader, to detect
>   when the tag approaches the reader.
> * Attach the laptop to the door and use the built-in gyroscope (if
>   available).
> * Same, but use the gyroscope from the HD. Might require firmware
>   hacking.
> * Don't oil the door and evaluate the microphone input.
> * Attach any USB device, but route the 5V line through a switch
>   attached to the door. Detect when the device attaches.
> * Mount the laptop behind the door so that the door opens/closes the
>   laptop lid. Detect wake/sleep state.
> * Fix your credit card to the door and have it move through a card
>   reader when the door opens. Check account balance through script.
>
> Send pix!
>
> regards,
> Robert
>
>


Re: door opening sensor HW for OpenBSD?

2018-03-24 Thread Robert
On Sat, 24 Mar 2018 22:32:02 +0100
"Hess THR"  wrote:
> Can you please recommend any hardware, that I could plug in to the notebook 
> and though I could send a warning mail when the door was moved (open/closed). 

I can think of so many ways to do this, from boring to insane :)

* Mount a switch on top of the door that gets unpressed when the door
  opens, and connect to the serial port. Then read the pin status.
* The same, but mount the switch behind the door so that it gets
  pressed when the door opens.
* Use a magnetic switch instead, and read it through the serial port.
* Put a keyboard behind the door, so that the door presses against a
  key when it opens. Map the key to a script.
* Attach a mouse to the door and react on the mouse movement.
* Attach a GPS sensor to the door and measure movements.
* Attach a USB barometer and detect the air pressure diff when the door
  opens.
* Attach a USB gyroscope to the door. Detect movement.
* Attach a USB light sensor (Arduino?) and detect movement.
* Put an RFID tag on the door, and attach an RFID reader, to detect
  when the tag approaches the reader.
* Attach the laptop to the door and use the built-in gyroscope (if
  available).
* Same, but use the gyroscope from the HD. Might require firmware
  hacking.
* Don't oil the door and evaluate the microphone input.
* Attach any USB device, but route the 5V line through a switch
  attached to the door. Detect when the device attaches.
* Mount the laptop behind the door so that the door opens/closes the
  laptop lid. Detect wake/sleep state.
* Fix your credit card to the door and have it move through a card
  reader when the door opens. Check account balance through script.

Send pix!

regards,
Robert