ledemotion

LED Emotion

View the Project on GitHub unosquare/ledemotion

Codacy Badge 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

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:

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?

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

OnBuildSuccess 172.16.17.54 /home/pi/ledemotion pi raspberry
These are just arguments for deploying LedEmotion via SSH using dotnet-sshdeploy and they can be modified to suit your needs. Click [here](https://github.com/unosquare/sshdeploy) for more information about dotnet-sshdeploy
``` xml
<Target Condition="$(BuildingInsideSshDeploy) ==''" Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="cd $(ProjectDir)" />
    <Exec Command="dotnet sshdeploy push" />
</Target>

back to the tutorial