Difference between revisions of "Door control system"

From London Hackspace Wiki
Jump to navigation Jump to search
(24 intermediate revisions by 7 users not shown)
Line 4: Line 4:
 
<blockquote>The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.</blockquote> ''- Douglas Adams, 'Mostly Harmless'''
 
<blockquote>The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.</blockquote> ''- Douglas Adams, 'Mostly Harmless'''
  
== Doorbot listener scripts ==
+
== Hardware ==
  
on babbage /usr/local/bin/Doorbot/listeners
+
=== Front doorbot ===
  
sudo service doorbot-listeners restart
+
[[File:New-doorbot.jpg|400px|thumb|right|The new front doorbot.]]
 +
The new front doorbot is based on the ACNode infrastructure, specifically a [http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c1294xl.html#tabs TI Connected Launchpad], a [http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2242 PN532 NFC shield] with a generic Arduino relay board. The bell is a 24VAC-powered generic doorbell, and currently bell presses are not detected by the doorbot.
  
== Status ==
+
The front doorbot sends out notifications about starting up and scanned cards via UDP to the global broadcast address 255.255.255.255 on port 50002. Any network device can listen in to these messages and set up their own bot/reporting infrastructure, etc.
  
<span style="color:red">'''Below is quite out of date, we have 2 doorbots, one on the backdoor: [[Perlman]], and <s>[[Bell]]</s> ''bell died, now using [[Hamming]]'' which will go on the red lobby interior door into the main space (NOT the roller shutter or the glass door inside the lobby). '''</span>  perlman broadcasts on 50000, and hamming uses 50002, so we can tell the difference between them in the various listeners.  This is a stop-gap until we add the door ID to the messages.
+
=== Back Doorbot ===
  
** Note: The sockets in the hallway which power the door release, have an inline fuse located just under the exterior light switch in the adjacent room.  
+
The back doorbot is the same as the front - with two differences: there's no bell, and the relay is activated by setting the pin state to HIGH. This instance sends notifications to port 50000.
  
=== Sol's Big button ===
+
=== Biohackspace Doorbot ===
  
* white - common ground?
+
This is the same as above - sends notifications to port 50001. You need to be a member of the [[Biohacking|Biohackers]] to get in.
* brown (dark) - button contact
 
* yellow and black - not connected
 
* red and blue: speaker
 
* green and orange: either side of the bi colour led, maybe even to the green and orange sides!
 
  
=== Arduino pinouts ===
+
==Software==
 +
The source code for the software is on [https://github.com/londonhackspace/acnode-cl Github].
  
* 13 - relay trigger?
+
All the logs go over the network to /var/log/network/ on [[boole]].
* 12 - led soldered on header
 
  
* 0
+
The access list is JSON [http://github.com/londonhackspace/hackspace-foundation-sites/blob/master/london.hackspace.org.uk/carddb.php file]. The acserver downloads a new version of the carddb file every 5 minutes from [[Turing]] (the machine that runs the website).
* 1
 
* 2
 
* 3
 
  
green & blue = wires from doorbell
+
The door opener broadcasts on the network whenever the door is opened by a member using their card <s>, or if the front doorbell is pushed</s>. The back door broadcasts on 50000, and the front uses 50002, so we can tell the difference between them in the various listeners.  This is a stop-gap until we add the door ID to the messages.
  
button green wire A0
+
=== Doorbot listener scripts ===
  
redLED yellow wire A2
+
There are [http://github.com/londonhackspace/Doorbot/tree/master/listeners listeners] on [[hamming]] that connect to '''robonaut''' to announce on IRC, and <s>flash the lights using '''Lighted'''</s>. By default, this will include your full real name. If you wish to change this behaviour, you can set up a nickname [https://london.hackspace.org.uk/members/cards.php in the cards section] of the member area.
  
greenLED red wire A1
+
<s>[[hamming]] also runs listeners for the scrolling led board and the audio announcements.</s>
 
 
=== Short length of phone cable from the parallel connector ===
 
 
 
* orange -> orange
 
* white with orange -> brown
 
* green -> green
 
* green with white -> white
 
 
 
* blue - not used, speaker?
 
* white with blue - not used, speaker?
 
 
 
 
 
Parallel Connector:
 
 
 
* purple - back to door?
 
 
 
==Overview==
 
 
 
=== Front Doorbot ===
 
 
 
We have a [http://www.touchatag.com/ Tikitag] RFID reader, embedded in the panel by the door, which we use to read member cards and then trigger the Asec something-or-other electric strike plate that opens the lock. Control of the strike plate and reading the state of the doorbell is done by an arduino
 
 
 
<graphviz border='frame' format='png' >
 
digraph rfboard{
 
  rankdir=LR;
 
  size="12,5!";
 
  node [style=rounded];
 
 
 
  x86 [label="hamming",shape=box];
 
  usb_hub [label="USB hub - 7 port",shape=box];
 
  rfid [label="RFID reader",shape=box];
 
  x86_psu [label="12V DC PSU",shape=box];
 
  door_control_uc [label="Arduino",shape=box];
 
  transistor [label="Darlington transistor",shape=box];
 
  relay [label="Relay",shape=box];
 
  dc_dc [label="12V to 5V",shape=box];
 
  door_battery [label="12V Battery",shape=box];
 
  release [label="Release",shape=box];
 
  door_psu [label="14V DC PSU",shape=box];
 
 
 
  subgraph cluster_0 {
 
          door_control_uc -> transistor;
 
                transistor -> relay;
 
                relay -> release;
 
                dc_dc -> door_control_uc;
 
                door_battery -> relay;
 
label = "Door control";
 
}
 
 
 
  door_battery -> dc_dc;
 
  door_psu -> door_battery;
 
  x86_psu -> x86;
 
  x86 -> usb_hub;
 
  usb_hub -> door_control_uc;
 
  rfid -> usb_hub;
 
 
 
 
 
}
 
 
 
</graphviz>
 
 
 
=== Back Doorbot ===
 
 
 
We use a [http://www.touchatag.com/ Tikitag] RFID reader, in a black project box mounted on the wall outside the space by the backdoor. The reader is connected to a rPi which uses a KMtronic usb relay board to trigger the Cisa 11610 lock to open the door when authenticated.
 
 
 
The backdoor has no speaker(s) or buzzers, doorbell, or indicator led's.
 
 
 
==Details==
 
The software runs on [[hamming]] and [[perlman]], and its code is on [http://github.com/londonhackspace/doorbot Github].  hamming is a VIA EPIA something with  2 x 2.5in ata drives in a raid mirrir, perlman is a Rpi.
 
 
 
on hamming doorbot logs to /var/log/daemon.log, on perlman all the logs go over the network to /var/log/network/perlman on [[boole]].
 
 
 
The access list is JSON [http://github.com/londonhackspace/hackspace-foundation-sites/blob/master/london.hackspace.org.uk/carddb.php file], downloaded from [[Turing]].
 
 
 
The door opener broadcasts on the network whenever the door is opened by a member using there card, or if the front doorbell is pushed.
 
 
 
There are [http://github.com/londonhackspace/Doorbot/tree/master/listeners listeners] on [[System naming|Babbage]] that connect to '''robonaut''' to announce on IRC, and <s>flash the lights using '''Lighted'''</s>. By default, this will include your full real name. If you wish to change this behaviour, you can set up a nickname [https://london.hackspace.org.uk/members/cards.php in the cards section] of the member area.
 
 
 
[[hamming]] also runs listeners for the scrolling led board and the audio announcements.
 
  
 
The announcement listener uses the [http://en.wikipedia.org/wiki/GLaDOS GLaDOS] voice. You can generate and use your own file as a greeting.
 
The announcement listener uses the [http://en.wikipedia.org/wiki/GLaDOS GLaDOS] voice. You can generate and use your own file as a greeting.
Line 125: Line 40:
 
The code that runs the [[Project:BandwidthMeter|bandwidth meter]] on [[tesla]] also listens for doorbell and member entry messages.
 
The code that runs the [[Project:BandwidthMeter|bandwidth meter]] on [[tesla]] also listens for doorbell and member entry messages.
  
== Card database ==
+
== Adding a card==
[[perlman]] and [[hamming]] download the card database every minute from Turing (the machine that runs the website).
 
 
 
=== Adding a card===
 
 
Access is based on the RFID UID - it is not the number written on the back of your Oyster card. There are three ways to add a card:
 
Access is based on the RFID UID - it is not the number written on the back of your Oyster card. There are three ways to add a card:
  
# Run the "Add card to Doorbot" script on [[Tesla]] and follow the instructions (basically, swipe your card and then enter your hackspace website login details).
+
# Use the [[Membership_Kiosk]] which is next to the book shelves.
 +
# Run the "Add card to Doorbot" script on [[Tesla]] (hint: it's on desktop) and follow the instructions (basically, swipe your card and then enter your hackspace website login details).
 
# If you have a card reader get the code at [https://github.com/londonhackspace/Doorbot Github] and run <code>addcard.sh</code>.  If you have another reader that can give you the UID, log in to the website and add it at the [https://london.hackspace.org.uk/members/addcard.php secret page]. Note that doorbot is case sensitive; enter the (hex encoded) ID using upper case letters only.
 
# If you have a card reader get the code at [https://github.com/londonhackspace/Doorbot Github] and run <code>addcard.sh</code>.  If you have another reader that can give you the UID, log in to the website and add it at the [https://london.hackspace.org.uk/members/addcard.php secret page]. Note that doorbot is case sensitive; enter the (hex encoded) ID using upper case letters only.
 +
# <s>If you have an Android phone that supports NFC [http://en.wikipedia.org/wiki/List_of_NFC-enabled_mobile_devices List of NFC-enabled mobile devices] you can use this [http://pointless.net/~jasper/LHSSelfEnrole.apk App] ([http://pointless.net/blog/2012/01/03/doorbot-app/ More details]). Do remember to activate NFC connections on Config>wireless and network connections. Also, remember the app works with LHS membership Usernames and Passwords, not TFL's. and not the logins to this wiki...</s> - Broken by new website changes, will differ fixing it until we get an API (and i get a new laptop) -- Jasper
  
# <s>If you have an Android phone that supports NFC [http://en.wikipedia.org/wiki/List_of_NFC-enabled_mobile_devices List of NFC-enabled mobile devices] you can use this [http://pointless.net/~jasper/LHSSelfEnrole.apk App] ([http://pointless.net/blog/2012/01/03/doorbot-app/ More details]). Do remember to activate NFC connections on Config>wireless and network connections. Also, remember the app works with LHS membership Usernames and Passwords, not TFL's. and not the logins to this wiki...</s> - Broken by new website changes, will differ fixing it until we get an API (and i get a new laptop) -- Jasper
+
===Doorbot sounds===
  
===Glados Voice===
+
Doorbot audio files are stored in /mnt/doorbot-sounds/wavefiles/members. (Mounted on systems from colin:/doorbot-sounds) Set your wave file (in wav or mp3 format) on the [http://london.hackspace.org.uk/members/cards members site].  You may copy the files into the directory via [[Lamarr#chomsky|chomsky]].
  
Glados audio files are stored on Babbage at /home/glados/wavefiles/members.  Set your wave file (in wav or mp3 format) on the [http://london.hackspace.org.uk/members/cards members site]. <strike> Generate your own from text using Tom's script at http://niceface.dyndns.org/glados/ </strike> (down temporarily)
+
Many early members enjoyed doorbot audio greetings in the style of [https://en.wikipedia.org/wiki/GLaDOS GLaDOS] - an artificial-intelligence sounding voice used in the Portal series of video games and in the movie Pacific Rim. Want to fit in with the 'classical' spirit of the Hackspace? Generate your own GLaDOS voice file on [http://glados.biringa.com/ this site here].
  
==== Old guide ====
+
==== Old GLaDOS Voice Generation Guide ====
There is a guide on Youtube that I've made to show the process as its hard to describe in text: [http://www.youtube.com/watch?v=OE8S9knXcW0 http://www.youtube.com/watch?v=OE8S9knXcW0]
+
There is a guide on Youtube made to show the process as its hard to describe simply in text: [http://www.youtube.com/watch?v=OE8S9knXcW0 http://www.youtube.com/watch?v=OE8S9knXcW0]
  
The Glados voices were generated by [[User:oni|oni]] following the method found by Tom Wyatt. To create a glados voice one must do the following:
+
The original GLaDOS voices were generated by [[User:oni|oni]] following the method found by Tom Wyatt. To create a GLaDOS voice one must do the following:
  
*Go to [http://www2.research.att.com/~ttsweb/tts/demo.php ATandT's Text to Speech page]. Type in your name and download the file
+
*Go to ATandT's Text to Speech Website (now offline). Type in your name and download the file. ''Alternately, use Cepstral or another online text-to-speech site allowing downloads.''
 
*Load up the program Melodyne
 
*Load up the program Melodyne
 
*Select the entire Waveform
 
*Select the entire Waveform
Line 152: Line 66:
 
*Up the pitch by dragging upwards by 160 or so.
 
*Up the pitch by dragging upwards by 160 or so.
 
*Save
 
*Save
 
Tom and I have looked for a vocoder or similar in Audacity that will do this for you. I'll make a video of this and stick it on YouTube at some point. Believe it or not, it is faster than the website as this is exactly what that website in the links is doing.
 
 
I'll see about implementing the processing algorithm in ChucK so it can be a command-line operation the next time I'm prototyping some FFT analysis stuff with it. -- [[User:Anthony|Anthony]]
 
  
 
== Managing Doorbots ==
 
== Managing Doorbots ==
Line 162: Line 72:
 
If you make changes or discover a problem with doorbot, please add it to '''[[Door control system/Logbook|the logbook]]'''.
 
If you make changes or discover a problem with doorbot, please add it to '''[[Door control system/Logbook|the logbook]]'''.
  
* Issues are tracked [https://github.com/londonhackspace/Doorbot/issues/ on Github]
+
On [[hamming]], the listeners are at /root/Doorbot/listeners
* The main script is rundoorbot, which announces to irccat on Babbage if the python script dies.
 
* The python script (doorbot.py) announces on successful initialisation.
 
 
 
The service currently logs to /var/log/deamon.log on hamming, on perlman it sends the logs over the network to /var/log/network/perlman on boole (no local logs on perlman since it's an rpi). Note that killing the python script will be announced (really?). To start or stop doorbot, use:
 
 
 
/etc/init.d/doorbot start
 
/etc/init.d/doorbot stop
 
  
 +
sudo supervisorctl restart all
  
 
[[Category:Systems]]
 
[[Category:Systems]]
 
[[Category:Infrastructure]]
 
[[Category:Infrastructure]]

Revision as of 09:25, 23 November 2016

Preface

The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.

- Douglas Adams, 'Mostly Harmless'

Hardware

Front doorbot

The new front doorbot.

The new front doorbot is based on the ACNode infrastructure, specifically a TI Connected Launchpad, a PN532 NFC shield with a generic Arduino relay board. The bell is a 24VAC-powered generic doorbell, and currently bell presses are not detected by the doorbot.

The front doorbot sends out notifications about starting up and scanned cards via UDP to the global broadcast address 255.255.255.255 on port 50002. Any network device can listen in to these messages and set up their own bot/reporting infrastructure, etc.

Back Doorbot

The back doorbot is the same as the front - with two differences: there's no bell, and the relay is activated by setting the pin state to HIGH. This instance sends notifications to port 50000.

Biohackspace Doorbot

This is the same as above - sends notifications to port 50001. You need to be a member of the Biohackers to get in.

Software

The source code for the software is on Github.

All the logs go over the network to /var/log/network/ on boole.

The access list is JSON file. The acserver downloads a new version of the carddb file every 5 minutes from Turing (the machine that runs the website).

The door opener broadcasts on the network whenever the door is opened by a member using their card , or if the front doorbell is pushed. The back door broadcasts on 50000, and the front uses 50002, so we can tell the difference between them in the various listeners. This is a stop-gap until we add the door ID to the messages.

Doorbot listener scripts

There are listeners on hamming that connect to robonaut to announce on IRC, and flash the lights using Lighted. By default, this will include your full real name. If you wish to change this behaviour, you can set up a nickname in the cards section of the member area.

hamming also runs listeners for the scrolling led board and the audio announcements.

The announcement listener uses the GLaDOS voice. You can generate and use your own file as a greeting.

The code that runs the bandwidth meter on tesla also listens for doorbell and member entry messages.

Adding a card

Access is based on the RFID UID - it is not the number written on the back of your Oyster card. There are three ways to add a card:

  1. Use the Membership_Kiosk which is next to the book shelves.
  2. Run the "Add card to Doorbot" script on Tesla (hint: it's on desktop) and follow the instructions (basically, swipe your card and then enter your hackspace website login details).
  3. If you have a card reader get the code at Github and run addcard.sh. If you have another reader that can give you the UID, log in to the website and add it at the secret page. Note that doorbot is case sensitive; enter the (hex encoded) ID using upper case letters only.
  4. If you have an Android phone that supports NFC List of NFC-enabled mobile devices you can use this App (More details). Do remember to activate NFC connections on Config>wireless and network connections. Also, remember the app works with LHS membership Usernames and Passwords, not TFL's. and not the logins to this wiki... - Broken by new website changes, will differ fixing it until we get an API (and i get a new laptop) -- Jasper

Doorbot sounds

Doorbot audio files are stored in /mnt/doorbot-sounds/wavefiles/members. (Mounted on systems from colin:/doorbot-sounds) Set your wave file (in wav or mp3 format) on the members site. You may copy the files into the directory via chomsky.

Many early members enjoyed doorbot audio greetings in the style of GLaDOS - an artificial-intelligence sounding voice used in the Portal series of video games and in the movie Pacific Rim. Want to fit in with the 'classical' spirit of the Hackspace? Generate your own GLaDOS voice file on this site here.

Old GLaDOS Voice Generation Guide

There is a guide on Youtube made to show the process as its hard to describe simply in text: http://www.youtube.com/watch?v=OE8S9knXcW0

The original GLaDOS voices were generated by oni following the method found by Tom Wyatt. To create a GLaDOS voice one must do the following:

  • Go to ATandT's Text to Speech Website (now offline). Type in your name and download the file. Alternately, use Cepstral or another online text-to-speech site allowing downloads.
  • Load up the program Melodyne
  • Select the entire Waveform
  • Using the melodic algorithm, double click on one section of the waveform. I believe this moves the form to its nearest notes.
  • Using the zig Zag looking tool, flatten the pitch.
  • Up the pitch by dragging upwards by 160 or so.
  • Save

Managing Doorbots

Logging & maintenance

If you make changes or discover a problem with doorbot, please add it to the logbook.

On hamming, the listeners are at /root/Doorbot/listeners

sudo supervisorctl restart all