Skip to content

lakshanthad/Flutter_reTerminal_LED_UI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPIO Control Demo Using Flutter on reTerminal

This is a demo application to control the GPIO pins on the reTerminal just by clicking buttons on the LCD!

Here I have used Flutter to develop the application on the PC and then run the application on reTerminal using flutter-pi. flutter-pi is a light-weight Flutter Engine Embedder for Raspberry Pi that runs without X. That means you don't need to boot into Raspberry Pi OS Desktop & have X11 and LXDE load up. You just need to boot into the command-line and run your application.

For a step-by-step guide on building your own UI using Flutter on the reTerminal, click here

pir

Install

First we need to install flutter-pi on the reTerminal.

Click here to access the GitHub repo of flutter-pi

  • Step 1. Log in to reTerminal as explained in this wiki and install flutter engine binaries on the reTerminal
git clone --depth 1 https://github.com/ardera/flutter-engine-binaries-for-arm.git engine-binaries
cd engine-binaries
sudo ./install.sh
  • Step 2. Install cmake, graphics, system libraries and fonts
sudo apt install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev  libxkbcommon-dev
  • Step 3. Update the system fonts
sudo fc-cache
  • Step 4. Clone flutter-pi and cd into the cloned directory
git clone https://github.com/ardera/flutter-pi
cd flutter-pi
  • Step 5. Compile flutter-pi
mkdir build && cd build
cmake ..
make -j`nproc`
  • Step 6. Install flutter-pi
sudo make install
  • Step 7. Open raspi-config
sudo raspi-config
  • Step 8. Switch to console mode by navigating to System Options > Boot / Auto Login and select Console or Console (Autologin)

  • Step 9. Enable the V3D graphics driver by navigating to Advanced Options > GL Driver > GL (Fake KMS)

  • Step 10. Configure the GPU memory by navigating to Performance Options -> GPU Memory and enter 64

  • Step 11. Press ESC on the keyboard to leave rasp-config window

  • Step 12. Give the reTerminal permission to use 3D acceleration. (NOTE: potential security hazard. If you don't want to do this, launch flutter-pi using sudo instead.)

usermod -a -G render pi
  • Step 13. Reboot reTerminal
sudo reboot

Usage

On the Host PC

  • Step 1. Intall Flutter SDK from here

Note: Make sure the flutter SDK is compatible to the installed engine binaries.

  • Step 2. Clone the following repo and cd into the directory
git clone https://github.com/lakshanthad/Flutter_reTerminal_LED_UI
cd Flutter_reTerminal_LED_UI
  • Step 3. Build the asset bundle
flutter build bundle
  • Step 4. Deploy the asset bundle to the reTerminal
scp -r ./build/flutter_assets pi@<ip_address_of_reTerminal>:/home/pi/testapp

Note: Use any location on the reTerminal to save the file

On the reTerminal

  • Step 1. Type the following on the command-line of reTerminal
flutter-pi /home/pi/testapp
  • Step 2. Connect an LED to GPIO 24

pir

Note: A resistor is needed between the GPIO pin and the LED or otherwise the LED will burn out.

  • Step 3. Type the following on the command-line of reTerminal to run the app
flutter-pi /home/pi/testapp

When you press the ON and OFF buttons, you will notice the LED which is connected to GPIO 24 will start to react accordingly!

You can also extend this by adding a relay to the GPIO pins and control home appliances and build a complete smart home solution on the reTerminal!

About

Simple GPIO Control Demo App Using Flutter on reTerminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published