• Stars
    star
    167
  • Rank 225,804 (Top 5 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A node.js based home automation system based around the Raspberry Pi.

raspberry-pi-home-automation

A node.js based home automation system based around the Raspberry Pi. For background around this project:

The Well Tempered Hacker

Installation

To get started, clone the repository and install the required dependencies.

git clone https://github.com/anders94/raspberry-pi-home-automation.git
cd raspberry-pi-home-automation
npm install

Hardware

The Raspberry Pi needs a little bit of circuitry to protect and amplify its GPIO ports. Here's schematics of the circuits I created for this project.

Protected Pull-Up Switch

If you want to read from the GPIO pins on the Raspberry Pi, you shouldn't just switch the pin between 3.3v+ and nothing. Rather, you should either pull it up to 3.3v+ through a small (1k) resistor or drain it down to ground through a larger (10k + 1k = 11k) resistance.

Protected Pull-Up Switch Circuit

Relay Driver

The GPIO pins on the Raspberry Pi run at 3.3v which isn't really enough to solidly throw relays. (in my case, I'm using a solid state relay but the theory is the same) This circuit uses an NPN transistor to amplify the 3.3v GPIO output to a 5v output which is enough to throw the relay.

Protected Pull-Up Switch Circuit

Server

The server uses MQTT, a lightweight messaging channel over TCP, and presents a pub-sub like interface to clients. Clients connect and can publish messages which get copied to all other connected clients.

To start the server:

node server

It will connect and listen to 0.0.0.0:1883 by default.

Clients

Clients read from and optionally write to the GPIO pins on the Raspberry Pi. Light switches are directly attached to 3.3v GPIO pins pushing them either high or low. Solid state relays to switch 120v AC loads are driven via 3.3v GPIO pins which are up-converted to 5v with a transistor. (3.3v isn't quite enough to solidly switch the Sharp S216S02 solid state relays I'm using) You may need to access GPIO pins as root depending on how you have things set up.

watch.js

Fires a callback when the GPIO pin state changes. Use this to test GPIO input functionality.

blink.js

Blinks GPIO pins on and off for 5 seconds so you can get your SSR setup working.

light-switch.js

Simple on or off lightswitch example, linking input and output. It does exactly what you think it does.

multi-light-switch.js

Connects to the server (IP is manually set in the source) via MQTT and publishes light switch events. It works as a four position lightswitch for two lights. See the video for a demonstration of this in action.

TODO

Publish the SPI code and circuit schematic for the 120vAC current sensing capability.

More Repositories

1

blockchain-demo

A web-based demonstration of blockchain concepts.
Pug
5,139
star
2

public-private-key-demo

Demonstrates public / private key pairs and signing in a blockchain context. This is part 2 of my Blockchain 101 video explainer.
JavaScript
546
star
3

bitcoin-2-of-3-multisig

Walkthrough of a multisig create / receive / spend on the command line.
JavaScript
52
star
4

disruptor

A distributed real-time computation platform in node.js.
JavaScript
29
star
5

https-authorized-clients

Force HTTPS clients to present a valid certificate
JavaScript
27
star
6

order-matching-engine

An exchange order matching engine implemented within PostgreSQL stored procedures.
JavaScript
27
star
7

loan-manager

Loan management bot supporting Bitfinex and Poloniex
JavaScript
23
star
8

pub-sub-map

Publish and subscribe to markers on a Google Map with real-time updating.
CSS
15
star
9

bitcoin-supply.com

We're tracking provably lost bitcoin at https://bitcoin-supply.com
JavaScript
10
star
10

sql-course

A beginner class on learning SQL
7
star
11

framebuffer-digits

Command line utility to display graphical digits on the frame buffer.
C
7
star
12

geoipdns

Location-Aware Authoritative DNS Server
C
6
star
13

iphone-sms-webapp

View and navigate SMS data from iPhone backups.
HTML
5
star
14

wif-decorruptor

A bitcoin WIF private key decorruptor.
JavaScript
4
star
15

mitcoin

mitcoin - a bitcoin fork
C++
3
star
16

eth-vanity-gen

A vanity Ethereum address generator.
JavaScript
3
star
17

with.drawal.info

ETH withdrawal monitoring website
JavaScript
2
star
18

generate-multisig-addresses

Node.js code to generate a large number of multisig bitcoin addresses.
JavaScript
2
star
19

LiftoffIn.com

Web based countdown timer. That's it - nothing else.
JavaScript
1
star
20

express-bootstrap-template

An express project with bootstrap to use as a template.
JavaScript
1
star
21

usdc-cool-js

The USDC stablecoin supply scanner
TypeScript
1
star
22

usdc-aum

JavaScript
1
star
23

api-docs

JavaScript
1
star
24

sbs

Old code from Stony Brook School services
Java
1
star
25

count-of-monte-cristo

The Project Gutenberg eBook of The Count of Monte Cristo, by Alexandre Dumas, père
1
star
26

picture-archiver

HTML
1
star
27

boxque

A web chat application eventually supporting file transfer via WebRTC
JavaScript
1
star
28

bitcoin-mempool-tracker

JavaScript
1
star
29

qfunc

Node.js queue of async/await functions that execute sequentially.
JavaScript
1
star
30

blockchains

Python
1
star