Leosac
0.7.0
OpenSourceAccessControl
|
Describe the installation process when using a Raspberry PI + Piface Board + Wiegand Reader.
This tutorial describes the full install process of Leosac on Raspbian. It will walk you through a complete install on a Raspbian system.
The goals of this tutorial is to end-up with a simple and working setup.
You'll have the ability to control a door. A card reader will read your input card, and Leosac (running on a Raspberry Pi) will take care of orchestrating the whole thing.
Here is a list of requirements, both hardware and software. The hardware requirements hard requirements for this tutorial to work.
Note: Leosac will work with something else than Raspbian, but some steps may change. If you know what you are doing and are fluent with Linux you shouldn't have any problem following this guide even if you don't use Raspbian.
There is 2 thing to make sure before installing Leosac:
apt-get update && apt-get upgrade
to make sure of this.raspi-config
–> Advanced Options
–> SPI
.modprobe spi_bcm2708
.You have your first choice to make:
If you chose to build from source, follow this guide. Note that building on Raspberry Pi will take quite a while, and cross compiling is out of scope for this guide.
Grab the latest armhf package from the Github Release tab. Install the package and install missing dependencies:
Before going to the next step, make sure you can launch the leosac
binary (ie, that it is available in your PATH).
Okay, so we now have Leosac installed. It needs to be configured before being useful. Below is a base configuration file:
Explanations:
plugin_dir
is a folder use to try and find Leosac's dynamic libraries (aka modules). This path will NOT be search recursively.network
configure the network. Unless you need to, we recommend you leave it disabled and configure networking through your system utility (/etc/network/interfaces
or whatever you use).name
is at your discretion, but it make to use something close to the shared library file.file
is the name of the shared library (.so
) file.level
is the order of module loading. The closer to 0 it is, the sooner the module will be load.module_config
is for per-module specific configuration information.MAKE SURE YOU DONT USE THE SAME LEVEL
TWICE
We need a few modules to make thing works:
We will do this step by step, as modules configuration will depends on our hardware.
You can find the documentation of the module here. It focus on how to configure the module for any use case. We will instead explain why we need a given configuration.
We are using a Wiegand card reader. Therefore we need 2 INPUTs GPIO. We also have 1 OUTPUT gpio for the door.
We add this to our config file:
As you can see, we are defining GPIO using the gpio port <no>
we wired our reader and door. !IMAGE HERE!
Note that we use <level>2</level>
to make sure this module is one of the first to start. We are assigning meaningful name to our GPIO. Keep them in mind because we will reuse them later.
Now that our configured GPIO are available to the rest of the application, we can configure the module that will understand our Wiegand Card Reader.
We have 1 reader to configure, and we will use both INPUT pin: wiegand_data_low
and wiegand_data_high
.
As you can see, we are re-using wiegand_data_low
and wiegand_data_high
. We assign them to our reader (MY_WIEGAND_1
). Note: Most wiegand card readers also have a green led and a buzzer than you can activate. We are not using them in this tutorial, we are leaving them out in the configuration.
In every access control system we need a component that is able to determine if an access should be granted or denied. This is what the auth file module is doing.
For this module we need a new configuration file, dedicated to this module only. This file will holds cards informations, group and user mapping and time slice informations.
Lets say this file is named "auth.xml".
For more information about the authentication and authorization config file, you can read this.
To enable this module, we also need to add something in the main configuration file. This something looks like this:
The <target>
match <door>
in the auth.xml
file. <auth_source>
is the name of the reader that will generate access attempt.
When an attempt is detect, this module will analyze it and either grant the access, or deny it. This response is then read by the doorman module.
At last, we need to react to those "grant access" or "deny access" from the auth module. In our scenario, we want to open the door for a few seconds when an access is successful. In case an access is failed, we do nothing. This is easy to do using the doorman module.
We are defining an action that will target my_door_gpio
and send the ON
command for 3000
ms.
This is the board with the PiFace plug onto it.
The orange port are output ports. Green ports are for inputs.
We have 3 wire to connect:
This is theoretically easy and should work. The whole configuration file can be found in cfg/example/guide_rpi_piface_wiegand/
.