A toy project to drive Sense Hat's matrix by using Go, Flutter/Web, and Docker

Overview

matrix2

Awesome Flutter Awesome Flutter

A toy project to drive Sense Hat's LED matrix by using Go and Flutter


RPI4 warning

RPI4 and matrix hat have some issues during boot. To avoid:

  • For Raspbian OS, add hdmi_force_hotplug=1 to /boot/config.txt
  • For Ubuntu, add hdmi_force_hotplug=1 to /boot/firmware/config.txt



1. Description

This project consists of 2 parts:

  • A simple mobile front-end based on Flutter/Web that can modify the matrix data for 64 LEDs on Sense Hat.
  • A Golang based web server with WebSocket that accepts the configuration from the front-end and controls the LEDs via I2C.

2. Prerequisites

First of all, the user should be familiar with Raspberry Pi and its terminal interface.

Hardware-wise, RPI 3B+ is recommendable because it works regardless of the OS (either Raspbian or Ubuntu 18.04 32/64 bit). However, RPI 3A+ only works when it has Raspbian 32 bit.

2.1. I2C interface activation

Enable i2c communication by using raspi-config.

sudo raspi-config

2.2. Docker installation

Get Docker's prerequisites as follow.

sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common \
     git

Docker itself can be installed and activated by these commands.

curl -sSL https://get.docker.com | sh

sudo systemctl enable docker
sudo systemctl start docker

2.3. User permission for Docker

To give the permission of the docker command to a user, the current username should be added to the docker group in the file.

sudo vi /etc/group

Don't forget rebooting to apply the change.

sudo reboot

3. How to run

Now, everything is ready to run. Please follow the below commands and access to localhost:3000 from a web browser.

git clone https://github.com/bus710/matrix2

cd matrix2/src/docker # or docker_for_arm64v8 for Ubuntu ARM64 on RPI

docker build -t matrix2 .

docker run -p 3000:3000 --device /dev/i2c-1 -it --rm --name matrix2i matrix2

From the browser, the frontend can be shown on the screen like this.
(Access to the RPI's IP and port 3000 - 192.0.0.10:3000 for example).

The components have features like this:

  • Each box represents each LED on Sense Hat (each box can be pressed to be chosen).
  • The sliders can change the color of boxes selected.
  • All and None buttons can be used to pick all or none of the boxes.
  • The red button can be used to send the configuration to the backend.

4. Clean up

Things should work properly but before closing, the images and containers should be cleaned up with these commands:

docker container prune
docker image prune

If all the docker objects should be cleaned, below commands would be helpful (but be careful!)

docker rm -f $(docker ps -qa)
docker rmi $(docker images -q)

5. Conclusion

With this simple project, the LEDs on Sense Hat can be easily controlled by the front-end and there is no such procedure to install any comlex development tools. However, anyone interests to use Flutter, Golang, or the I2C of RPI may check the source code in the repository to add more feature.

Writer


Disclaimer

This is just a toy project that cannot be used for safety/commercial products.   
The developer doesn't take any kind of (phsical, mental, and financial) responsibility. 
You might also like...

A fast and space efficient library to deal with data in Dart, Flutter and the web.

Dart Data Dart Data is a fast and space efficient library to deal with data in Dart, Flutter and the web. As of today this mostly includes data struct

Nov 4, 2022

Lottery smart contract is built with Solidity and Brownie. Flutter Web is used to buid the UI and link the smart contract.

lottery_dapp A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Dec 15, 2021

A web dashboard that allows you to monitor your Chia farm and sends notifications when blocks are found and new plots are completed through a discord bot. It can link multiple farmers/harvesters to your account.

A web dashboard that allows you to monitor your Chia farm and sends notifications when blocks are found and new plots are completed through a discord bot. It can link multiple farmers/harvesters to your account.

farmr A web dashboard that allows you to monitor your Chia farm and sends notifications when blocks are found and new plots are completed through a di

Jan 2, 2023

Decentralized SkyDB-based alternative to Twitter, YouTube and Instagram with a native iOS, Android and web app.

Decentralized SkyDB-based alternative to Twitter, YouTube and Instagram with a native iOS, Android and web app.

SkyFeed SkyFeed is a decentralized SkyDB-based alternative to Twitter, YouTube and Instagram with a native Android, web and (soon) iOS app. Use You ne

Oct 28, 2022

Notefy is a note-taking web app built with ReactJS and Django, with a subtle yet attractive UI and great functionality!

Notefy is a note-taking web app built with ReactJS and Django, with a subtle yet attractive UI and great functionality!

Notefy Notefy is a note-taking web app built with ReactJS and Django, with a subtle yet attractive UI and great functionality! Demo Here is the websit

Nov 20, 2022

About This is Personal Expenses Planner. You can add your expenses in to the app and manage your transaction. and you can see How much did you spend on which day. I developed this project using flutter.

expense_planner A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Jul 6, 2022

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

Dec 30, 2022

Flutter UI Kits for mobile, tablet, desktop and web application

Flutter UI Kits for mobile, tablet, desktop and web application

UIKits2 A complete UIs for mobile and tablet, which include 16 categories. Start SignUp & Login Walkthrough Loading Profiles Feed Article Activity Cre

Oct 8, 2022

Web3 Ethereum, Etherjs and Wallet Connect wrapper for Flutter Web.

flutter_web3 This is a fork of flutter_web3_provider. Be sure to check out the original package. Introduction flutter_web3 v2 is full Dart class and f

Jan 2, 2023
Owner
A software developer
null
⚗️A privacy centric matrix client

a privacy centric matrix client - now in open alpha* Syphon is still in alpha and we do not recommend using it where proven and independently verified

Syphon 882 Dec 31, 2022
A sample application to show Google Drive Flutter Clone.

Flutter Google Drive UI Demo A sample application to show Google Drive Flutter Clone. Demo Android Screen iOS Screen Getting Started This project is a

FlutterDevs 9 May 6, 2021
Music reader for online data (Google Drive implementation). Cross platform goal : iOS, Android, MacOS, Windows

omusic A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

JeanNicolasdeLamballerie 0 Nov 30, 2021
Flutter Web application having splash screen and providing Web view Using web view packege.

Webview with Splash Screen in Flutter Flutter Web View With Splash Screen. Subscribe Our YouTube Channel. Visit Website Demo OutPut ?? Links Getting S

Habib ullah 1 Dec 7, 2021
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

cross_connectivity A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Androi

MarchDev Toolkit 29 Nov 15, 2022
This project consist of Netflix UI for Mobile and Web using Flutter

Flutter Netflix Clone(Pending) A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to g

Aby T Mathew 1 Oct 24, 2021
Web development for smartgreen's RYO-OHKI Project, should contain: a login page, import, export and visualization of cards (almost a dashboard) it is under construction!

Web development for smartgreen's RYO-OHKI Project, should contain: a login page, import, export and visualization of cards (almost a dashboard) it is under construction!

Beatriz gonçalves 6 Nov 13, 2021
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesn’t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 6, 2023
Rename Flutter Project Bundle ID Plugin with Firebase Project Support

About (Null-Safety) It helps you to change your flutter project's AppName and BundleId for different platforms, currently only available for IOS, Andr

Inter-Con Security 1 Nov 12, 2021