Skip to content

OpenMicrolock/poc-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroLock

ESP32-based smart lock firmware that exposes a small HTTP JSON API over the local network. Built with PlatformIO and the Arduino framework.

Hardware

  • Board: ESP32 DOIT DevKit V1
  • Lock pin: GPIO 25 (drives relay / solenoid — HIGH = locked, LOW = unlocked)
  • Buzzer pin: GPIO 26 (feedback beeps)

Features

  • HTTP JSON API on port 1212 (default recommended)
  • Token-based authentication (token sent in request body)
  • Wi-Fi Station mode (connects to an existing network)
  • Automatic fallback to Access Point mode if STA connection fails within 15 s
  • Audible beep feedback on lock/unlock

Getting Started

Prerequisites

  • PlatformIO (CLI or VS Code extension)
  • An ESP32 DOIT DevKit V1 (or compatible)

Configure

Edit the constants at the top of src/main.cpp before flashing:

const char* WIFI_SSID     = "<your-wifi-ssid>";
const char* WIFI_PASSWORD = "<your-wifi-password>";
const char* AP_SSID       = "<your-ssid>";
const char* AP_PASSWORD   = "<ap-password>";
const char* AUTH_TOKEN    = "<your-secret-token>";

Build & Flash

pio run                 # build
pio run -t upload       # flash
pio device monitor      # serial monitor @ 115200

The device prints its IP to the serial monitor after connecting:

STA IP: 192.168.1.23

API

Full frontend integration guide is in docs/implementation.md.

Quick reference:

Method Path Auth Description
GET / no Device info / ping
POST /lock yes Lock the device
POST /unlock yes Unlock the device
POST /status yes Get current state

Authenticated requests send the token in the JSON body:

{ "token": "your-secret-token" }

Project Layout

.
├── docs/               # integration docs
├── include/            # project headers
├── lib/                # private libraries
├── src/main.cpp        # firmware entry point
├── test/               # unit tests
└── platformio.ini      # PlatformIO config

Security Notes

  • Traffic is plain HTTP — only use on trusted Wi-Fi networks.
  • The auth token is hard-coded in firmware. Change it before deploying and do not commit production tokens.
  • There is no rate limiting in firmware — the client should debounce lock/unlock actions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages