Skip to content

Latest commit

 

History

History
151 lines (124 loc) · 6.09 KB

INSTALL.md

File metadata and controls

151 lines (124 loc) · 6.09 KB

Build

Follow the BUILD file if you need to buy the components, set up the raspberryPi or connect the cables.

The following instructions regards the project installation only.

Setup

This project uses these tools:

  1. DotStar_emulator to simulate the led strip on pc.
  2. AppInventor for the android app build.
  3. Firebase to allow communication between web/android app and pc/raspberry.
  4. Adafruit_CircuitPython_NeoPixel to control the leds on the raspberry.
  5. audio-reactive-led-strip to control leds with music.

Since the DotStar_emulator cannot be installed on the raspberry and the rpi-NeoPixel does not work on pc, this two libraries are kept well separated.

In the following I will guide you to the installation and setup required to make everything work

Get the code on Raspberry

There are two ways to get the repo on your raspberry: cloning the repo or copying through ssh.

Clone

If you just wish to use the project without implementing custom patterns use:

git clone --recursive https://github.com/nicofirst1/ledypi

On your raspeberryPi

Copy

On the other hand, if you would like to play with the repo, you should clone it on your PC with:

git clone --recursive https://github.com/nicofirst1/ledypi

And then use the sync script to copy the repo onto your RaspberryPi

Python 3.7

The project works with python>=3.7, it is advised to source your custom env before proceeding.

RaspberryPi

The install script should take care of most of the installation part, simply use:

bash scripts/install.sh

If you run into any problems check out the full install instructions which follows.

Complete install instructions

  • Install packages:
sudo apt-get install python3-numpy 
  • Install Blinka with the tutorial
  • Install the required modules: sudo pip3 install -r requirements_pi.txt
  • Install opencv:
    • install dependencies
    sudo apt-get install libhdf5-dev libhdf5-serial-dev
    sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
    sudo apt-get install libatlas-base-dev 
    sudo apt-get install libjasper-dev
    
    or in one line
      sudo apt-get install libhdf5-dev libhdf5-serial-dev libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5 libatlas-base-dev libjasper-dev
    
    • install opencv
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python3 get-pip.py
    
    sudo pip3 install opencv-contrib-python==4.1.0.25
    
  • Install Pillow:
sudo apt-get install  libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 
sudo pip3 install pillow
  • (Optional) If you have a microphone connected to your Rpi follow the instructions in the audio reactive readme
  • (Optional) Increase led speed by adding following to /boot/config.txt ( as written here):
core_freq=500
core_freq_min=500

If you get a gcc error see this.

Ledyweb on raspberry

If you wish to run the ledyweb control server on the raspberry and connect with another pc you should follow this guide

Ledyweb on apache

If you rather have the ledyweb control directly running on the rpi, you can use the apache_setup scrip. Simply run it with:

bash scripts/apache_setup.sh

PC

  • Install the required modules: pip install -r requirements.txt
  • (Optional, only if you wish to create custom patterns) install DotStar_emulator repo to debug Patterns on pc:
python DotStar_Emulator/setup.py install

App Inventor

The MIT AppInventor is a tool to simply create apps with a building block programming paradigm. The first thing you'll need to do is make an account. Then you can import the app from the ledypi.aia file:

Click on 'Create Apps!'
Login
Click on 'My Projects' on the top left 
Import project (.aia) from my computer ...
And select the ledypie.aia file

Once imported you need to se the firebase URL and Token in

Click on th "Designer" button on the top left
In the "Components" window scroll down unti you see  "FireBaseDB1" and click on it
Set both the "FirebaseToken" and "FirebaseURL"

Now you need to se the firebase url in the blocks too

Click on th "Blocks" button on the top left
Find the orange global initializer called "fire_base_url"
Set it to your url

You can check the README in the AppInventor directory for more infos.

Firebase

The communication between the app and python works through the Firebase database.

Database creation and linking

To create a Firebase database and link it to the app use this tutorial and follow the Firebase Setup only, everything else is already implemented. Be aware the FireBaseDB is already present in the app, so you don't need to instantiate a new one, simply fill out the FirebaseToken and FirebaseURL as described above.

Generating private key file

To connect the database with the python application you will need to generate a private key file as follows

In the Firebase console, open Settings > Service Accounts.

Click Generate New Private Key, then confirm by clicking Generate Key.

This will create a privatekey.json file which will be used later.