GithubHelp home page GithubHelp logo

deepsyx / home-automation Goto Github PK

View Code? Open in Web Editor NEW
3.4K 149.0 250.0 4.17 MB

Raspberry Pi 3 based home automation with NodeJS and React Native.

License: MIT License

JavaScript 89.51% Python 5.49% Java 4.99%
nodejs raspberry phone javascript home-automation react-native

home-automation's Introduction

Home Automation with RPi and Javascript

Updated article: https://viktorkirilov.me/post/home-automation-raspberry-pi/

Intro

Link to video

https://youtu.be/wh0OoLUTeM8

Alt text

Introduction

Since a kid I've been passionate about electronic and different kind of mechanisms. Previously I've done different small projects with arduino, like handbrake for my gaming steering wheel, custom LED tachometer for my car (see my github repo), voice controlled LEDs and so on. Recently I bought Raspberry PI 3 and around all the IoT hype, I decided to start automating my home.

The Technology Stack

Since I'm pretty familiar with javascript and its ecosystem I decided to create my own phone app via react native and connect it via websockets to NodeJS backend. I'm using ImmutableJS's Records for consistency of the data structure and the performance of the app. The data is sent between the client and the server via JSON strings, which are converted to back to Immutable records, when received on both sides. I've separated the shared modules(between client and server) to a separate local npm packages - home-records and home-config. For GPIO controlling (pins of the raspberry) I've used pi-blaster library, together with wiringPi. Since I couldn't find codes for my AC, I've recorded them by myself and added them to lirc config file. Duckdns cron is used as dynamic dns, because my IP address changes periodically and I won't have to recompile the whole app or change config each time. The server broadcasts the changes to all connected users realtime. The phone app is located in /phone-app folder, the server is located in /server. Why don't you take a look?

The Hardware

Raspberry Pi 3 is the controlling unit. High-power devices, such as LED strips, are powered via external 12V 5A power supply (shared ground with the PI). The AC is controlled via 950nm infrared LED. The heating system is wired via relay (on and off) and servo for the thermostat as I was avoid disassembling. Both white LED strip and the RGB strip are connected via IRLZ34N logical transistors to the PI. There is also IR receiver, just in case I want to record anything else. Temperature is measured via DS18B20 temperature sensor.

The wiring looks like:

Schematic

New Ideas

I'm open for all kind of ideas about different modules. If you have some ideas in mind, I'll be thankful if you add it in the issue tracker and label it as Idea.

Software dependencies

  • Node & Npm
  • Pi-Blaster
  • WiringPi
  • Lirc

home-automation's People

Contributors

deepsyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

home-automation's Issues

Idea: on/off light

Hi,

Seeing this is done in js makes me want to try my first attempt with Raspberry Pi. As beginner, it may great to start with something simple as controlling the light through the app. A ref from the hacker news about the device which can be used.
Also it would be great to see the make/models you used for led strip, and other controlling devices.

thanks.
bsr.

wiradikusuma 34 minutes ago [-]

anyone know good but cheap WiFi/Bluetooth-enabled adapter(?) for lightbulbs? e.g. so I can use any machine (not just Pi) that supports WiFi/Bluetooth to control (at least on/off) the bulb.
so: wall --> adapter --> lightbulb
reply

luma 25 minutes ago [-]

The Sonoff is a $5 WiFi relay with an embedded ESP8266 that is programmable via Arduino (and several other dev platforms), allowing you to control the relay via HTTP/REST/MQTT/etc.
https://www.itead.cc/sonoff-wifi-wireless-switch.html

How?

How do you connect room light bulb to rapsberry pi?

Idea: Camera support

I've used this repo to add a camera to my raspberry. It sends a stream through a socket to the client. Even though I've used it to track my dog, it can definitely be added to add a security area to the system. My code also supports playing songs through the web api. (:
I think that this can add a lot to your system. Hit me up if you need any help.

Run node.js server

Hi,
How can I run node.js server and from directory without changing directory structure? I'm trying run by few commands e.g.

  1. npm start --prefix ./server/index.js
    but I've got error in case of required directories

Automate window blinds

Its something I'm trying to work out using raspberry pi but haven't found a good way to twist the blinds handler.

how is the servo connected to the knob

can you explain/show how the servo is connected to the knob. perhaps a picture from the other end or a diagram which shows how these two are connected

Idea: voice control

An obvious integration point would be Alexa (#1) and Google Home. I've been working on a voice control library in Node called Sonus that gives you customizable offline hotword detection and streaming recognition.

It's super lightweight and runs really well on the Pi. It's currently used in a few large projects like my smart-mirror and Picco.

All you'd have to add in terms of hardware is a USB microphone/webcam like the PlayStation Eye. I'd be happy to lend a hand integrating if anyone is interested.

Idea: Integrate with Alexa

Looks great! I'm doing something very similar, but my end goal is to be able to control everything with voice via an Echo Dot with Alexa. I'm currently investigating the Wemo protocol to do this.

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.