/gatepass

Raspberry Pi Telegram Remote Control Bot

Primary LanguageJavaScriptApache License 2.0Apache-2.0

GatePass

Raspberry Pi Telegram Remote Control Bot

Poster Bot

Prerequisites

Hardware

  • Raspberry Pi
  • Servo

Scheme

Software

Node.js

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install npm

Pi Blaster

Follow Pi Blaster library install instructions:

$ cd
$ git clone https://github.com/sarfata/pi-blaster.git
$ cd pi-blaster
$ ./autogen.sh
$ ./configure

Patch file pi-blaster.c before compile to set 50Hz servo frequency:

#define CYCLE_TIME_US 20000
$ make
$ sudo make install

Installation

$ cd
$ mkdir projects && cd projects
$ git clone https://github.com/DirectX/gatepass.git
$ cd gatepass
$ cp .env.example .env

Replace <BOT_KEY> placeholder in .env with actual Telegram API key obtained using @BotFather

$ npm install
$ npm start

Systemd Service

$ sudo nano /etc/systemd/system/gatepass.service
[Unit]
Description=GatePass
After=network.target

[Service]
WorkingDirectory=/home/pi/projects/gatepass
ExecStart=/usr/bin/npm start
Restart=on-failure
User=pi

[Install]
WantedBy=multi-user.target

Start and Enable

$ sudo service gatepass start
$ sudo systemctl enable gatepass.service

Status

$ sudo service gatepass status
● gatepass.service - GatePass
   Loaded: loaded (/etc/systemd/system/gatepass.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-07-02 20:03:46 UTC; 1s ago
 Main PID: 3345 (node)
    Tasks: 6 (limit: 2200)
   Memory: 5.2M
   CGroup: /system.slice/gatepass.service
           └─3345 node /usr/bin/npm start

References