Raspberry Pi /HOME SERVER CPU Status on a RGB LED

by anandkrish in Circuits > Raspberry Pi

472 Views, 2 Favorites, 0 Comments

Raspberry Pi /HOME SERVER CPU Status on a RGB LED

20210421_115006-01.jpeg


I was looking to set up a small raspberry pi home server for my local uses like hosting a cloud service like nextcloud and jellifyn etc..But since i did not have a cooling fan for i was searching for some how to get me alerted if my pi is getting too hot as well as if it is running out of memmory etc..
One way is to go to the terminal and check it manually , and the other ones are to connect it to the internet and get it as a mail or notification through various different softwres.
But i was looking for something simple and cool.

That is where i thought about a simple [By simple i also mean something that comes under my knowledge ;-) ] way to do it:
LED STATUS DISPLAY FOR A HOME SERVER


Hardware Requirements :-

- Ws281b RGB LED strip light: (Minimum 8 LEDs Recommended)

-Push button x 1 (Only if you want to change modes without coding)

-1K Ohm Resistor x 1 ( Only if you want to change modes without coding)

-Your Home server / Raspberry pi 3/4 and so

Connecting LED to Your Pi

2021-04-21 21_56_07-Untitled Sketch.fzz_ - Fritzing - [Breadboard View].png
2021-04-21 22_09_42-Connect and Control WS2812 RGB LED Strips via Raspberry Pi und 8 weitere Seiten .png

Connections:

Ws281b LED:------Pi:

Data------------------GPOI 18 /PWM pin

+Ve-------------------5V in Pi (Or from an external source): Please refer the diagram

GND------------------GND in Pi (Or from an external source): Please refer the diagram

Push Button:------Pi:

pin 1------------------GPIO 11

pin 2------------------GND

Software and Installations

2021-04-21 22_43_03-ubuntu@ubuntu_ ~.png
2021-04-21 22_47_52-.png

Now SSH into your Pi and follow these steps:

SOURCE: Connect and Control WS2812 RGB LED Strips via Raspberry Pi (tutorials-raspberrypi.com)

1.The package sources are updated:
sudo apt-get update

2.We install the required packages (confirm with Y):
sudo apt-get install gcc make build-essential python-dev git scons swig

3.The audio output must be deactivated. For this we edit the file
sudo nano /etc/modprobe.d/snd-blacklist.conf

4.Here we add the following line:
blacklist snd_bcm2835

5.Then the file is saved by pressing CTRL + O and CTRL + X closes the editor. We also need to edit the c configuration file:
sudo nano /boot/config.txt

6.Below are lines with the following content (with Ctrl + W you can search):
# Enable audio (loads snd_bcm2835)
dtparam=audio=on

This bottom line is commented out with a hashtag # at the beginning of the line:
#dtparam=audio=on

7.We restart the system:
sudo reboot

DOWNLOAD AND INSTALL THE REQUIRED LIBRARIES:

  • InstallRPI.GPIO

    pip install RPi.GPIO (please verify that you have installed PIP before)
  • Install rpi_ws281x Library

    git clone https://github.com/jgarff/rpi_ws281x
  • In this directory are on the one hand some C files included, which can be easily compiled. The example code for this is easy to understand. In order to use them in Python, we need to compile them:

    cd rpi_ws281x/
    sudo scons
  • However, in this tutorial we are mainly interested in the Python variant and therefore switch to the Python folder:

    cd python
  • Here we carry out the installation:

    sudo python3 setup.py build
    sudo python3 setup.py install
    sudo pip3 install adafruit-circuitpython-neopixel

Running Our Program

From here you can simply download/Copy Paste my code and run the .py file.(You only need to follow next steps if You dont know how to do it / want to learn some basics)

  • Now lets open the neopixel example file: (Type this only after you are in the /rpi_ws281x/python/ folder)

    sudo nano examples/strandtest.py

    Here You can se the example code for running a neopixel on a Pi, Also try changing and playing more with it to understand the working.After done you can either make a new .py file and paste my code OR download my code OR paste my code into the current example file
  • Press Ctrl + X to save and exit the IDE
  • Now Lets run our programm :

    sudo python3 examples/strandtest.py

    And there you go..now you can even set it up such that it runs automatically during startup of your system or run this in your background using systemctl

Downloads

USING THE BUTTON TO CHANGE MODES AND ITS WORKING

Raspberry pi RGB LED (Ws281) status bar || Programming and mode selection

I have made some small changes into my code after making the video (adding some extra modes etc.)
If you have more doubts either comment here below or you can also comment under my youtube video.


PLEASE NOTE:
That i am not an expirienced coder or a proffesional in python, your ideas and improvements are warmly welcomed.


Thanks :-)