Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Codacy Badge Build Status


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


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:// --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 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

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


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"

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

exit 0


A. Practical example



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



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


back to the tutorial

B. Setting up dotnet-sshdeploy

  • SSHDeploy comes preconfigured with some default properties inside the .csproj file like:

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" />
  • 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