GithubHelp home page GithubHelp logo

ledemotion's Introduction

Build Status

LedEmotion

A very cool, Web-based RGB LED strip controller for the Raspberry Pi

This program drives an RGB LED Strip (APA102C) available from Adafruit (Adafruit DotStar Digital LED Strip - Black 60 LED - Per Meter - BLACK). It does so by using one of the SPI channels available on the RPi.

You will need a fairly powerful power supply to drive a 4m strip of 60 LEDs per meter (5V 10A switching power supply).

A Raspberry Pi 3 is recommended just because it's faster.

Table of Contents

Software Components

  • EmbedIO, to drive the web-based UI.
  • RaspberryIO, to interface with our hardware.
  • SWAN, to avoid rewriting some basic building blocks like logging and bitmap management in out app.
  • dotnet-sshdeploy, to perform continuous deployments to the RPi

Check our proposed diagram to test the project

Running

1. Installing mono on the Raspberry Pi

# First, update and upgrade the distro
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mono-complete
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# If the command line above doesn't work for you, you need to install dirmngr:
# $ sudo apt-get install dirmngr
# and execute the command again
$ echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get autoremove
$ sudo apt-get clean 

Now, go ahead and verify the version of mono

$ mono --version

You should get something above 5.4.1.6

2. Enable SPI

$ sudo raspi-config

You'll get a GUI like this:

Raspberry Pi Software Configuration Tool (raspi-config)

Select 5 Interfacing Options from the menu and then select P4 SPI to enable SPI

SPI

3. Deploy and test continuously

Before to continue with this tutorial, check this

To kill the current mono process:

$ sudo pkill mono

To start the mono process again:

$ sudo mono /home/pi/[container folder]/Unosquare.LedEmotion.Controller.exe

To see a list of processes:

  • top
  • ps
  • htop (might need sudo apt-get install htop)

4. The rc.local file

In the command line edit this file:

sudo nano /etc/rc.local

Then add the following line before exit 0:

mono /home/pi/[container folder]/Unosquare.LedEmotion.Controller.exe &

Just like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

mono /home/pi/[container folder]/Unosquare.LedEmotion.Controller.exe &

exit 0

Miscellaneous

A. Practical example

Diagram

Schematic

What do you need?

  • 1 Raspberry Pi 3 modelo B, v. 1.2
  • 1 LED strip (APA102C. Available here)
  • 1 DC barrel jack adapter (female. Available here)
  • 1 USB to micro USB charger (5 V)
  • Wires

Expectation:

Expected

An example of how LedEmotion works (click the image to watch the video):

Transition

back to the tutorial

B. Setting up dotnet-sshdeploy

  • SSHDeploy comes preconfigured with some default properties inside the .csproj file like:
<PropertyGroup>
    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
    <SshDeployHost>172.16.17.54</SshDeployHost>
    <SshDeployTargetPath>/home/pi/ledemotion</SshDeployTargetPath>
    <SshDeployUsername>pi</SshDeployUsername>
    <SshDeployPassword>raspberry</SshDeployPassword>
</PropertyGroup>

These are just arguments for deploying LedEmotion via SSH using dotnet-sshdeploy and they can be modified to suit your needs. Click here for more information about dotnet-sshdeploy

<Target Condition="$(BuildingInsideSshDeploy) ==''" Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="cd $(ProjectDir)" />
    <Exec Command="dotnet sshdeploy push" />
</Target>
  • This target is what calls dotnet-sshdeploy after a successful build, we use it to automatically deploy LedEmotion using the defined properties explained above if you do not want to deploy every time you build LedEmotion you can remove this target and execute dotnet sshdeploy push in your project directory.

back to the tutorial

ledemotion's People

Contributors

arcigo avatar buda1994 avatar geoperez avatar israelramosm avatar jpalcala avatar

Watchers

 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.