Electricity Grid Dashboard

Raspberry Pi Zero 2 W based

DIYODE Magazine

Issue 60, July 2022

This Raspberry Pi-powered desktop touchscreen provides an overview of the electricity grid so you can compare energy levels between states and territories. - by Luke Prior.

This month, we wanted to create a small desk-mount smart display to provide an overview of the different electricity sources in the Australian energy grid. The project is centred around a high-resolution round touchscreen display which makes it perfectly suited to displaying a pie chart. This chart format lends itself well to displaying the breakdown of energy sources for various States and Territories across numerous time periods.

The display can provide interesting insights such as the increasing role of renewable generation sources such as wind and solar in the Australian electricity system. The interactive nature of a touchscreen display allows for more information to be embedded which can easily be accessed allowing for comparisons.

The Australian Energy Grid

The Australian electricity grid consists of various networks with the largest being the National Electricity Market (NEM) which includes New South Wales, Australian Capital Territory, Queensland, South Australia, Victoria, and Tasmania. Western Australia and the Northern Territory each have their own independent grids which aren’t connected with the rest of the country due to location constraints.

CREDIT: ElectraNet

Electricity is moved within the NEM using a series of high voltage interconnects that allow the entire region to operate as a single grid. The Australian Energy Market Operator is responsible for operating the NEM and provides various real-time and historical energy usage data, including the breakdown of generation types for each State and Territory.

This data is collected and processed along with information from Western Australia’s South West Interconnected System by the OpenNEM project to provide insights into the nation's electricity usage and generation.

The processed data created by OpenNEM is made publicly available via a collection of APIs that will be used in this project to generate the various modes and displays for the device. The OpenNEM data is grouped into approximately 20 unique categories depending on the fuel type used.


These various categories include coal, gas, solar, wind, hydro, battery, and bioenergy. They also offer a variety of simplifications for easier display of data such as combing black and brown coal, rooftop and utility solar, and the five different gas generators. These groupings also exist for other characteristics such as renewables and flexibility.

All the orders, groupings, and colour coding for various technologies and groupings in the program were designed to closely match the displays found on the OpenNEM website. The results can slightly differ due to different ways of calculating time differences and rounding errors.


The Broad Overview

The centrepiece of the project is the Hyperpixel 2.1 Round High-Resolution touchscreen display from Pimoroni. The display features a 2.1” IPS panel with a resolution of 480x480 pixels excluding the corners. The screen attaches to the 40-pin Raspberry Pi header directly over DPI allowing for a smooth 60 FPS refresh rate with 18-bit colour. The integrated capacitive touch layer enables multi-touch input while dedicated drivers and software ensure the display works perfectly with the Raspberry Pi. The display measures 71.8mm x 71.8mm with a resolution of 229 pixels per inch.

We were originally planning to use the original Raspberry Pi Zero W with this screen as Pimoroni designed it specifically for this use case but after seeing successful reports from other users we decided to use the Raspberry Pi Zero 2 Wireless. The Raspberry Pi Zero 2 W is a significant upgrade from its predecessor featuring the same Broadcom BCM2710A1 SoC found in the Raspberry Pi 3 paired with 512 MB of LPDDR2 SDRAM. This processor upgrade contributes to a performance improvement of up to 5 times in certain workloads. The Raspberry Pi Zero 2 W maintains the same form factor as the original making it an easy replacement for existing projects and the inclusion of WiFi 4 and Bluetooth 4.2 easily facilitates connected builds.

Note: Pic shown here has the Zero V1 attached.

The other components required for the build include a microSD card with the operating system for the Raspberry Pi along with a suitable Micro USB power supply and a 3D printable case. This project was designed to be easily adaptable if you are wanting to use a different screen or Raspberry Pi model.

3D Printed Enclosure

We decided that a custom 3D printed enclosure to house the HyperPixel 2.1 and Raspberry Pi would be the best option for constructing the device so we started by taking some measurements of the components. The HyperPixel includes mounting screws which we utilised in our design to securely attach the frame of the case to the stand.

The entire enclosure was also designed as two separate components to simplify the 3D printing processes and allow for quick iteration/modification. The screen protector encloses the electronics used to drive the screen, preventing any electrical shorts or dust build-up. The frame also includes cutouts for the 40 pin GPIO headers, screw holes, and other tall components on the display controller board.

The Raspberry Pi Zero 2 W is mounted externally to the frame allowing for easy access to all the ports and improving cooling. This design also assists in securing the display to the frame alongside the two integrated screws. The entire screen frame assembly was designed to be secured to a cradle stand.

The stand features a flat base and a small podium with an integrated recess and cable route that allows the two components to be easily fitted together and permanently secured with some super glue. The two components were both designed with free 3D modelling software and you can find all the files on our website.

The Build:

Parts Required:JaycarAltronicsPakronics
1 x Pimoroni HyperPixel 2.1 Round-Pimoroni: PIM579-
1 x Raspberry Pi Zero 2 W-Element14: 3838499-
1 x microSD Card with NOOBS OSXC9030D0312APAKR-A0294
1 x Raspberry Pi USB Power SupplyMP3536--

Parts Required:

The assembly of the entire device was relatively straightforward with the Raspberry Pi Zero W 2 attaching directly to the HyperPixel 2.1 Round via the 40 pin GPIO header. The microSD card and Micro USB power supply could then be attached allowing for a test of all the components before they were fitted into the 3D printed case.

The two case components were both printed in PLA on an Ender 3 Pro using Cura. The total print time was relatively short due to the size and simplicity of the designs. The case could also be printed in a variety of other materials and colours to better suit the device's final position.

The HyperPixel screen is inserted into the front of the frame with the GPIO socket, mounting holes, and other components all aligned to the cutouts on the rear of the print. The HyperPixel can then be secured into the frame with two short screws before the Raspberry Pi is securely attached to the rear of the frame.

The final step is joining the completed frame component with all the components to the base stand. The stand features an integrated channel to route the Micro USB power cable which can be used as an alignment guide. The two components can then be fixed together with some super glue.


The Raspberry Pi Zero 2 W requires an operating system to be installed to a microSD so that it can be used. The Raspberry Pi OS can be flashed to the microSD card using the Raspberry PI Imager tool available for Windows, Mac, and Linux.

The latest version of the Raspberry Pi Imager also includes integrated tools to enable VNC/SSH, along with configuring WiFi network details, which will allow for headless operation of the device during setup.

The recommended Raspberry Pi OS (32-bit) image can be selected in the Raspberry Pi Imager along with the intended microSD card. The settings menu accessible from the bottom right corner allows for the configuration of optional settings. The Enable SSH option can be enabled which will also require a password for the default Pi user to be entered below.

The wireless LAN settings can also be configured with the details of the network to which the Raspberry Pi will be connected so that it can fetch the latest data for the display. The correct country also needs to be selected so that the relevant frequency settings are correctly set.

Once these options have been configured, the Raspberry Pi OS can be downloaded, configured and flashed to the microSD card using the Raspberry Pi Imager Tool. The microSD card can then be inserted into the Raspberry Pi Zero 2 W ready for operation.

The Code

The OpenNEM API is used to fetch the various data displayed on the device. The required API routes were determined using a combination of the official documentation and reverse engineering of the OpenNEM widget.

The API can provide information for each grid (NEM, WA) or State/Territory (NSW, VIC, ACT) over various time periods including the instantaneous supply. The responses from these APIs all use the same data formatting allowing for a simple function to be created to convert the information into a usable format.

The single Python script used to power the device begins by importing all the necessary dependencies and then loading all the default values and names for the various regions, technologies, and times.

The first step before any electricity data is downloaded is to check if any arguments have been provided to the program during launch and if so setting the relevant parameters so the correct information is provided to the user.

The data is then downloaded from OpenNEM using the default values or provided arguments. The raw JSON data from OpenNEM is then processed so that it can easily be used in the program. This processed data is also used to determine the maximum energy of the entire system before it is filtered and sorted for final display.

The program then proceeds to establish a new PyGame window set to the correct size for the circle display and begins to draw the processed data and text labels to the screen. This process of drawing all the information to the screen is constantly repeated with checks for touch input on each iteration.

The program will update the data parameters and force a refresh of the data if any of the options are changed by tapping on the screen. This same principle is also used to show the label for any section when tapped on.


The software used to run the device is distributed as a single Python script. The system first needs to be configured before the script can be installed and started. The Raspberry Pi console will be used for this process and can be accessed using SSH. The IP address of the Raspberry Pi needs to be found and used to connect using a tool such as PuTTy with the username and password set during the firmware flashing process.

The first requirement is installing the display drivers for the HyperPixel Round display. These can be downloaded and installed from the Pimorni GitHub repository using the following commands. They will take effect on the next reboot of the Raspberry Pi after their installation.

git clone
cd hyperpixel2r
sudo ./

The following code should be run from the root directory of the device which can be reached by running the cd command. This can then be followed with the mkdir code command to create a new folder in the root directory called code which will be used to store the script. The operating directory can be set to this newly created code folder by running cd code.

The code can be downloaded from GitHub using git or manually downloaded from the DIYODE website. The git command can be used to download the repository containing the script to the code folder.

git clone

The script is now downloaded to the machine but cannot yet be run as dependencies that the program requires are not installed by default. These dependencies are pygame and numpy which are used for render and calculations in the program.

They can be installed by running:

pip install pygame, numpy command.

This will enable the script to run as expected when manually launched from the command line using python The system can be configured to automatically run the program whenever the device is powered on or the script crashes using supervisord. This can be installed by running:

sudo apt-get install supervisor.

The supervisord program is configured by editing the default configuration file with details of the program and how it should be launched. This file can be edited by running:

sudo nano /etc/supervisor/conf.d/my-proccess.conf

The contents can be replaced with the following


The supervisord service can then be restarted which will cause it automatically boot the display program and monitor it.

sudo service supervisor restart

The final configuration that can be applied to the system is the automatic hiding of the cursor. This can be achieved using the unclutter program that automatically hides the cursor if no movement has been detected for a set period of time. This can be installed using:

sudo apt-get install unclutter

The unclutter command can then be used to start the service and set the timeout period to 5 seconds. This command can be set to run automatically on boot by adding it to autostart on the Raspberry Pi by running the following:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
unclutter -idle 5


The script includes support for all the regions covered by the OpenNEM API including the NEM, NSW, QLD, SA, TAS, VIC, and WA. These can be changed using the touchscreen by double-clicking on the left and right-hand sides of the display to cycle through them.

The program also allows for a variety of time periods for each of the regions including instantaneous, day, week, month, and year. The selection of these time periods works the same way as the regions by double-tapping the top and bottom of the display to cycle through them.

The data provided by the OpenNEM API breaks the various technologies into very specific categories, which can make the display cluttered so a variety of display options are available to show the default, simplified, renewable, and flexible modes. These can be cycled through in a single direction by double-tapping on the centre of the screen.

The details for any individual section can also be viewed by single tapping on it. This will open a new info screen in the centre of the device showing the relevant details.

These various options can also be set as defaults using command line arguments when launching the script. The script contains four optional arguments to control the region, time period, display mode, and refresh frequency. These can be set using the -r, -p, -d, and -t arguments and all the available options can be viewed by running python –help.

The supervisord service can be configured to launch the program with any of these parameters by editing the my-proccess.conf file previously created and modifying the command to include the desired arguments. This will take effect after a restart of the supervisord service.


The build and software used in this project are all publicly available and designed to accommodate future modifications and additions.

We considered several possible hardware editions including the addition of physical buttons for switching display options, additional RGB lighting to display further information, and support for different sized displays.

The software can also be modified to support different regions or display modes provided the relevant information can be found. We would encourage you to share any additions or changes to the software so that everyone can benefit.