Code Monkey home page Code Monkey logo

esp32_osdp_reader's Introduction

ESP32 OSDP access control reader

CP - OSDP control panel PD - OSDP peripheral device

This is my little side project related to access control, basically this is a lib for arduino IDE for ESP32 microcontroller (I used esp32-wroom) that enables it to act as an OSDP PD with access control reader capabilities. It's not a full implementation of OSDP protocol in any way its just a concept that works with HID EP1501 (aka mercury ep1501) with basic functionality i.e. partial support for led, beeper, card identification.

I haven't found any library that enables OSDP protocol for arduino IDE out of the box so I wrote one my self (used some structure definitions from https://github.com/goToMain/libosdp). Probably libosdp could have been compiled against esp32 platform, but it seemed too heavy for my purpose and I wanted to get familiar with OSDP protocol itself

How it works

ESP32 microcontroller which acts as OSDP PD waits for identification card packet (basically raw card number) via bluetooth LE interface. After it receives one, appropriate status to OSDP CP is sent. CP checks access rights of a given card number and replies with grant or deny. Based on OSDP reader configuration and hardware that you enabled you should see blinking led or hear beeping sound.

Usage

Won't dive into too much details, I assume user is familiar with OSDP and arduino IDE. For hardware I used esp32-wroom along with rs485 module for communication with mrc ep1501 and some basic circuits for tri-state led and buzzer. Firmware uploading/compiling was done using arduino IDE. To use this code place contents of repo under ...\Documents\Arduino\libraries\osdp_reader. And your basic sketch should look like this (don't forget to assign appropriate pins values, Serial/UART interfaces):

#include <osdp_reader.h>

#define TX_MODE_PIN 5 // rs485 module DE, RE
//#define R_LED_PIN 33
//#define G_LED_PIN 25
//#define B_LED_PIN 26
//#define BUZ_PIN 14
#define RX2_PIN 16 // rs485 module RO 
#define TX2_PIN 17 // rs485 module DI

osdp_reader reader(Serial, Serial2, TX_MODE_PIN);

void setup() {

  Serial.begin(115200); // for debugging purposes
  Serial2.begin(9600, SERIAL_8N1, RX2_PIN, TX2_PIN); // Serial2 is used for communicating with OSDP CP via rs485 
  reader.init();
}

void loop() {
  reader.loop();
}

NOTE: OSDP PD address is hardcoded to 0x01

Also there are osdp_reader constructors that accept led, buzzer pin configuration

esp32_osdp_reader's People

Contributors

sanke avatar

Watchers

 avatar

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.