Code Monkey home page Code Monkey logo

led-strip-server's Introduction

led-strip-server

This is a simple server program for a Raspberry Pi that hosts a web page to select different colors on it.

These colors are then displayed on an RGB led strip.

In addition, the server can receive commands over MQTT to control the led strip from Openhab.

Demo

Try out a demo here

Modes

Three different modes are currently available.

  • The one color mode allows you to select a simple color.
  • The fade mode can be used to smoothly transition inbetween several selected colors.
  • The changing colors mode switches between all selected colors.

Download

Download the server git clone https://github.com/mec-kon/led-strip-server.git Then navigate into the server folder with cd led-strip-server. Initialize the submodules with git submodule update --init

Config

To use the server, you must change the ip address of the server. You can do this by typing nano static/src/deviceConfig.json.

Installation:

The easiest way to build the program is with CMake.

First you need to install all required dependencies. You can do this with sudo apt-get install cmake wiringpi build-essential.

You will also need to install libmosquittopp if you want to use mqtt in this project. You can do this with sudo apt-get install libmosquittopp-dev.

Then, all you have to do is create a new folder with mkdir build in the current project folder, change to this folder with cd build and create a makefile
with cmake .. or cmake .. -DUSE_MQTT=OFF if you don't want to use mqtt .
Then you can create the executables by simply typing make
Now install the server with sudo make install.

Autostart

To start the server automatically when booting, you can use crontab. But first you have to activate the automatic login. For this you have to open the settings with sudo raspi-config.

Navigate to "Boot Options" and then to "Desktop/CLI". Select "Console Autologin" and then "Finish".

Restart the Raspberry Pi.

Next type crontab -e. In the window that opens, add the line "@reboot /usr/local/bin/led-strip-server".

Openhab

To receive commands from Openhab, the following files must be added or modified in "/etc/openhab2/":

  • create "color.items" in "/etc/openhab2/items"
  • modify "default.sitemap" in "/etc/openhab2/sitemaps"
  • create "color.rules" in "/etc/openhab2/rules"

The mentioned files can be found here

Pull requests

Pull requests are always welcome !

led-strip-server's People

Contributors

jvreiput avatar mec-kon avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.