gerdesj
Posts: 24
Joined: Sun Nov 29, 2015 1:52 pm

1wire door open/shut detector

Sun Nov 29, 2015 10:51 pm

I have a RPi2 with an interface card plugged over the GPIO pins with several 1wire buses on it (http://www.sheepwalkelectronics.co.uk/p ... ucts_id=67). I've used one for temperature sensors.

I would like to be able to be able to detect when the door to the computer room this thing is in is opened and shut. I have 15 years of Linux sysadmining but rather limited electronics experience so am a bit out of my depth here.

A good old Googling shows lots of temp and environmental sensors for 1wire but I can't find something for door sensors. All howtos I've found for door sensors involve GPIO fiddling and breadboards (mainly for garages and rather a lot of them appear to be copies of an original, probably for the ad views *sigh*.)

If I'm out of luck for some reason trying to use 1wire for this then if I ran about 7 metres of Cat5e (I've got lots of it but could probably find some lighter or heavier gauge cable with various cores if needed) between the Pi and the door what do I put at each end? I just need some hints here at what technology to use.

Cheers
Jon

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 1wire door open/shut detector

Sun Nov 29, 2015 11:25 pm

1-wire may be irrelevant to what you are trying to do.

How will you tell if the door is open or closed?

If it's just a switch then look up circuits for connecting a switch to the Pi.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: 1wire door open/shut detector

Sun Nov 29, 2015 11:29 pm

You need a DS2406 or DS2413. They have programmable/readable GPIO pins. Hang one off your one-wire bus and connect your door switch to it. Use the OWFS drivers on the Pi to query the state of the GPIO on the chip.

gerdesj
Posts: 24
Joined: Sun Nov 29, 2015 1:52 pm

Re: 1wire door open/shut detector

Mon Nov 30, 2015 9:56 am

ame wrote:You need a DS2406 or DS2413. They have programmable/readable GPIO pins. Hang one off your one-wire bus and connect your door switch to it. Use the OWFS drivers on the Pi to query the state of the GPIO on the chip.
I've just had a quick look at those devices and they look like what I need. There is no way on earth I'd have spotted that they would fit my use case without a pointer - thank you.

Cheers
Jon

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: 1wire door open/shut detector

Mon Nov 30, 2015 10:03 am

gerdesj wrote:
ame wrote:You need a DS2406 or DS2413. They have programmable/readable GPIO pins. Hang one off your one-wire bus and connect your door switch to it. Use the OWFS drivers on the Pi to query the state of the GPIO on the chip.
I've just had a quick look at those devices and they look like what I need. There is no way on earth I'd have spotted that they would fit my use case without a pointer - thank you.

Cheers
Jon
You're welcome. Adafruit sell one of them on a breakout board (I don't have one). I have used the DS2406 in a TO92 package (only one I/O!) to detect if a hot-water cylinder was on. I used OWFS to read the I/O input state.

There is also a chip with 8 I/Os if you need it.

Have fun!

Return to “Interfacing (DSI, CSI, I2C, etc.)”