Coder Social home page Coder Social logo

bigboxer23 / pigarage2 Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 127 KB

SpringBoot webserver to remotely monitor and control a garage using a raspberry pi

License: Apache License 2.0

Java 98.53% Shell 1.47%
sensor garage garage-controller garage-door garage-door-opener raspberry-pi

pigarage2's Introduction

CodeQL

PiGarage 2.1

Updated from version one to use springboot to allow easy configuration of HTTPS and maven.

To add HTTPS support, create a file named application.properties and place into the src/resources directory. Example file contents would be something like:

server.port: 443
server.ssl.key-store: keystore.p12
server.ssl.key-store-password: mySecurePassword
server.ssl.keyStoreType: PKCS12

To generate a self signed certificate for development, the following command can be used: keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650

Good resource for setting this up: https://drissamri.be/blog/java/enable-https-in-spring-boot/

This project runs on a raspberry pi. It utilizes GPIO pins to track status of a magnetic sensor mounted to a garage door, and a relay used to open/close the door. It will trigger the garage door to close after a defined amount of time being left open. Additionally, it runs a small webserver which has REST service urls to trigger closing/opening the door and checking status. Additionally there's a dyp-me003 motion sensor wired up to reset the auto close timeout if motion detected. A temperature and humidity sensor can be attached to allow measurements to be fetched via REST url

Ties together these two projects:
Magnetic Sensor
Opener

Wiring devices to the pi

Sensor for garage door:

    <a href="http://www.smarthome.com/7455/Seco-Larm-SM-226L-Garage-Door-Contacts-for-Closed-Circuits/p.aspx">Seco-Larm SM-226L</a><br>

This is wired to Pin 9 (Ground) and Pin 13 (GPIO 27, WiringPi 2).

Sensor for garage house door:

Magnetic Door Sensor
The motion sensor wired up to pin 22 (GPIO 25, WiringPi 6), pin 20 (Ground)

Solid State Relay:

Solid State Relay
The solid state relay is wired to pin 6 (Ground), pin 2 (5v), and pin 7 (GPIO 4, WiringPi 7)

Motion Sensor:

PIR_Motion_Sensor_Module:DYP-ME003
The motion sensor wired up to pin 15 (GPIO 22, WiringPi 3), pin 2 (5v), pin 6 (Ground)

Temperature/Humidity Sensor (DHT22):

DHT22
The temperature/humidity sensor wired up to pin 19 (GPIO 10), pin 17 (3.3v), pin 25 (ground)
Note: This sensor requires the adafruit dht driver be installed in a path accessible location.
Example:

cd Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver<br>
sudo cp Adafruit_DHT /usr/bin

Configurable Properties

There are multiple configurable properties that can be set at runtime:
log.location: Path to the file to log information about opener status, actions, etc.
status.path: URL to get status from (default is "/Status2")
close.path: URL to close garage door (default is "/Close")
open.path: URL to open garage door (default is "/Open")
close.delay: Number of milliseconds before closing the door once it's detected open (default is 10 minutes)
triggerDelay: How long to leave the switch active before turning off (how long you press the physical button) (default is 400ms)
GPIO.status.pin: Pin to use for the magnetic sensor (default is WiringPi 2, pin 13)
GPIO.action.pin: Pin to use for the solid state relay (default is WiringPi 7, pin 7)
GPIO.motion.pin: Pin to use for the motion sensor (default is WiringPi 3, pin 15)
GPIO.temp.pin: Pin to use for the temperature sensor (default is GPIO 10, pin 19) GPIO.status.house.pin: Pin to use for the garage house door (default is WiringPi 6, pin 22)

Example application.properties

server.ssl.key-store: keystore.p12
server.ssl.key-store-password: mysupersecretpw
server.ssl.keyStoreType: PKCS12
GarageOpenUrl=https://myHub/S/OpenHAB/GarageOpen/100
GarageCloseUrl=ttps://myHub/S/OpenHAB/GarageClosed/100
GarageMotionUrl=https://myHub/S/OpenHAB/GarageLights/100
GarageHouseDoorUrl=https://myHub/S/OpenHAB/GarageLights/100
GarageNotificationUrl=https:/myHub/S/Notification
logbackserver=192.168.0.234:5671

Setup on pi:

Edit and run the scripts/install.sh. It will create a service definition which will launch the app automatically

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.