How To Build A Robust Raspberry Pi Dashboard

A great Raspberry Pi dashboard allows you to get the most out of your raspberry pi device and create an unbeatable user experience when it comes to tasks such as easy home automation or displaying pages and video.

It is a bit of an intermediate task, but we will take you through it step by step in the guide and make it as easy and as intuitive as possible for you.

How To Build A Raspberry Pi dashboard

How To Build A Robust Dashboard With Raspberry Pi:

Before We Get Started

Here’s a bit of ‘light reading’ to get you started 😉 It would definitely be beneficial for you to become more familiar with these guides to make the process a little easier:

If you aren’t already familiar with the Raspberry Pi, we also recommend you acquaint yourself with it before moving on.

As far as basic Raspberry Pi skills go – you will need to know how to access the command terminal with SSH, burn an operating system to SD card, and connect your device to a network.

The Hardware And Parts You’re Going To Need

For this project, you will need the following:

  • Raspberry Pi
  • LED Backpacks
  • Breadboard
  • Sharp knife
  • Male/male jumper wires
  • USB Wi-Fi Dongle
  • Wire
  • Stepper and DC Motor HAT
  • Electrical tape
  • 5V 2amp supply for power
  • Buck converter or 3.3V regulator
  • Soldering tools
  • Chalkboard foamboard or dry-erase foamboard
  • Female/female jumper wires

Testing And Assembly

You’re going to need to test the HAT and LED backpacks before you start assembling. Simply follow these guides to test them once they are assembled: 

You can then go through this guide and install the Python LED backpack library, then test it using the Raspberry Pi backpacks. 

Assembling The Dashboard

  1. Build or write the dashboard using your chalk or dry eraser (don’t use permanent markers, as you will want to update and change labels.
  2. Trace out every display’s shape, then cut out the corresponding hole in the board. 
  3. Tape the displays and motor to the dashboard, being careful not to tape over delicate parts.
  4. Check your foamboard to see if your foamboard is less than ¼ inch thick, you can poke a hole in it to fit the stepper gauge through. If not, you will need to cut a hole.
  5. If you have standoffs, use them to cover the Raspberry Pi HDMI port. Use electrical tape to cover the HDMI port if you don’t have standoffs to hold the motor HAT. 
  6. Carefully solder the wires or headers onto the GND, SCL, SDA, 5V, and 3.3V pins to allow the 12C bus and LED to connect.
  7. Press the motor HAT onto the Raspberry Pi’s GPIO.
  8. Using the same method you used when testing, wire the auto gauge steppers and motor HAT terminals together.
  9. Now, connect the power supply (5V) to the motor HAT’s negative and positive power terminals.
  10. Connect the SCL header, clock, SCL pin, SDA pin, and data to the Raspberry Pi SDA header.
  11. ***You can power ~1-3 LED backpacks straight from the Pi by connecting each backpack to the GND negative power and the positive to the 3.3V power. 
  12. If you’re using the 1.2” 7-segment backpack, connect it to the 5V.
  13. ***Use a dedicated 3.3V power supply if you are using more than 3 backpacks, as the Pi won’t have enough power to run it correctly.  
  14. The dashboard should now be assembled, and you will need to check through everything to ensure it is in good working order. Carry out tests to make sure you don’t run into any problems.
  15. Now, you will need to label your dashboard with your chosen metrics. 

The Software

Now, you will need to start installing the correct software. However, you will first need to make sure of two important things:

  1. Your Raspberry Pi runs the newest Jessie Lite or Raspbian Jessie operating system
  2. The Raspberry Pi is connected to the internet via a wireless network connection (this is important as software dependencies can be installed).

You should also ensure that you read over the aforementioned guides to know your way around Raspberry Pi, as you will need to know how to do a few things. 

Once these have been checked, you can move on to the software installation process. 

Installing The Software

Now you will need to install the necessary software. We will go through this process step-by-step and provide the coding for you to input. 

Install the dashboard software to the Pi terminal from GitHub and run this command:

sudo apt-get update

sudo apt-get install -y git build-essential curl python-pip python-smbus python-dev

git clone https://github.com/adafruit/Pi_Physical_Dashboard.git

cd Pi_Physical_Dashboard

sudo pip install -r requirements.txt

Once you run the final command, you should see pip print telling you that the installation has been successful and is being cleaned up. This message should start with this: Requirement already satisfied (use – – upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages

You will notice that the software is installed in the /home/pi/Pi_Physical_Dashboard folder. You can run it with its main.py Python script.

Before doing this, it should be configured. 

Configuring

Configuring

Configure the dashboard software by editing its config.ini file within a text editor. You can use the nano editor on the Pi itself by inputting this command in the Pi_Physical_Dashboard folder: 

nano config.ini

Once inside, you will see lines beginning with # – these are comments that explain the configuration. 

This is an example of a seven-segment widget configuration:

# Example of a seven segment display called ‘cpu’.  The type is SeveSegmentWidget,

# the I2C address of the device is specified as 0x74, and the number of digits

# to show after the decimal point is set to 0.

#[cpu]

#type = SevenSegmentWidget

#address = 0x74

#decimal_digits = 0

To enable the widget, you just need to remove the comments by simply inputting this:

# Example of a seven segment display called ‘cpu’.  The type is SeveSegmentWidget,

# the I2C address of the device is specified as 0x74, and the number of digits

# to show after the decimal point is set to 0.

[cpu]

type = SevenSegmentWidget

address = 0x74

decimal_digits = 0

In this case, the widget has the name cpu, a type, and several sets of seven-segment display-specific options. You can scroll through the configuration file and notice numerous widget types (such as AutoGaugeWidget or AlphaNum4Widget).

Add your own widget configuration to the config.ini. An example of this would look like the following:

[foo]

type = SevenSegmentWidget

address = 0x72

[bar]

type = AutoGaugeWidget

motor_id = 1

Now, you need to save your configuration by pressing Ctrl-o, enter, and Ctrl-x. This will also exit you from the nano

Using It

After configuration, you will be able to check everything out. Run the program by finding the Pi_Physical_Dashboard file, and type in the following command: 

sudo python main.py

Don’t be alarmed when you notice all the automotive gauges have been moved to the left – this is normal! 

If the Dashboard Doesn’t Check The Output

You should check if you can find a reason for the dashboard to be failing if it doesn’t look right. Check through the codes to make sure no mistakes were made. 

Take a look at the 12C address for each widget to ensure that it has been input correctly. You can easily use i2cdetect to do this and see if you get the address that you are expecting. 

Ensure The Server Is Working Correctly

Access the server widget from the web browser to check on it. Simply open your browser and go to http://raspberrypi:5000/widgets (or where “raspberrypi” is, input the name you gave your Pi”. 

If that fails, you will need to check the router and look at the IP address. It should be assigned to the Pi. The widgets should be in a JSON format like the following: 

{

“widgets”: [ 

{

“description”: “Seven segment LED backpack widget. Can display simple numeric values\n in the range of -999.\n”,

You can now set the widget value by making an HTTP POST request here at http://raspberrypi:5000/widgets/widget_name. 

The request can be made in the form of a curl command, which you might need to install. Once installed, you can set the value of the widget by using a command like this one: 

curl -d value=55 http://raspberrypi:5000/widgets/cpu

If the widget value doesn’t update, double-check to ensure you’re using the correct widget name. You should also see if a helpful error message is printed out to help you figure out the issue.

**Please be aware that every widget will have a different range of values set. Check these values before making any changes. 

Below are some examples of what values set with curl might look like:

# Set an alphanumeric widget called foo to have a value COOL:

curl -d value=COOL http://raspberrypi:5000/widgets/foo

# Set a bicolor bargraph widget called bar to be 35% illuminated:

curl -d value=35 http://raspberrypi:5000/widgets/bar

# Set a bicolor bargraph widget called bar to be 75% illuminated red:

curl -d value=475 http://raspberrypi:5000/widgets/bar

# Set an auto gauge widget called gauge to be at 35%:

curl -d value=35 http://raspberrypi:5000/widgets/gauge

This should sort out any issues you might be having!

buy raspberry pi accessories

Final Thoughts

As you can see – building a dashboard for your Raspberry Pi requires a few steps and some familiarity with the Raspberry OPi, however, is definitely worth learning how to do as it can help you keep track of everything, make awesome displays, operate your connected devices and generally make your RPi experience more streamlined and enjoyable. Hopefully, this article has helped you – good luck!

Erik D

Leave a Comment

Your email address will not be published. Required fields are marked *