Code Monkey home page Code Monkey logo

dlock13's Introduction

dlock13

Breakout design (in EAGLE) and source code for our door lock actuator, running on a Raspberry PI(1). Communication with the lock happens over MQTT. Does not contain user interface, check door-web for that.

MQTT interface

To open the door, send the number of seconds to open to:

/bitraf/door/$door_id/open  # Ex: 20

On success, will output values:

/bitraf/door/$door_id/isopen # Ex: true/false
/bitraf/door/$door_id/openuntil # Unix timestamp when door will lock again. Ex: 1495469392

On error, will send a string with an error message:

/bitraf/door/$door_id/error # Ex: "Time to open is negative"

Where $door_id is for instance 2floor, frontdoor, 4floor. The /bitraf/door/ prefix is configurable, can be set to /mysystem/doorlocks.

Code

At dlock13-msgflo/dlock13.cpp.

Impementation is in C++11, using msgflo-cpp.

Python API

Also provided is a simple Python module which will handle checking the MQTT messages being sent out on success/error.

Installing

pip install dlock13

A command-line tool is included

dlock13-open /bitraf/door/$door_id 60

For how to use programatically, use dlock13-open as example code.

Board

RPI breakout board with components

The board has two MOSFETS for driving standard electronic locks. Expansion for two inputs also exists.

Single-sided board with through-hole components, can easily be CNC milled or etched.

RPi breakout board schematic

Pinout

# Function | Connector pin |  BCM SoC pin |  WiringPi pin  |
===
mosfet1    |     19        |   10         |  12
mosfet2    |     2         |   11         |  14

BCM SoC pin is the on used for /sys/class/gpio/gpioNN and similar.

Deployment

A systemd service template is normally used to each doorlock: [email protected].

systemctl status dlock13@2floor

The following environment variables are used. They can be specified in /etc/dlock13/$door_id.conf.

  • MSGFLO_BROKER - the MQTT broker connection details. Ex: mqtt://user:[email protected]
  • DLOCK13_PIN - the GPIO pin number to use. Ex: 11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.