A simple Node server to listen for activity on a Raspberry Pi using a motion detector. If activity is detected, the camera will snap a picture and send it to OpenALPR's API for analysis. Then, if the image can be recognized as a car with a readable license plate, the probable plate ID is checked against a Firebase database of known, trusted cars input by the user via the accompanying Android app (unfortunately, the Android app is not in this codebase). The door will then open automatically for trusted cars, remain closed for untrusted cars, and prompt the user to deny or accept an unrecognized car upon its arrival in front of the camera. If the user accepts via the Android app, the door will open.
This server was originally designed to support HTTP requests directly, but due to time constraints and security concerns, I refactored the code to have the server only communicate between OpenALPR's API and Firebase with no possible input from the outside world except when the camera is triggered.
Replicating my setup is largely infeasible, however, this code will be posted as a reference for anyone attempting something similar with a modified version of my code.
This server is intended to run on a Raspberry Pi and depends on PiGPIO, Node, and npm to run properly.
Install pigpio (Note: This will not work on most common, non-Pi Linux distros)
sudo apt-get update && sudo apt-get install pigpio
Install Node/npm
sudo apt-get install nodejs
(Optional/Recommended) Install Node using nvm
Ensure proper installations:
node -v
npm -v
pigpiod -v
Download and install required node_modules
npm install
Start the server
npm start
or
sudo node app.js
You're all set! You can shut down the server using:
npm stop
[Warning] This command is for dev purposes and will kill any running node instance, even other servers