Skip to content

Flutter application for controlling GPIO pins on a Linux machine

License

Notifications You must be signed in to change notification settings

IoT-gamer/flutter_gpio_control_app

Folders and files

NameName
Last commit message
Last commit date
Feb 15, 2025
Feb 15, 2025
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025
Feb 15, 2025
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025

Repository files navigation

Flutter GPIO Control App

This is a Flutter application for controlling GPIO pins. The application implements clean architecture and uses the flutter_bloc package for state management. The application provides a user interface to interact with GPIO pins.

Features

  • Add new GPIO pins (input or output) with advanced configuration options
  • Toggle output pins
  • Monitor input pins
  • Visual feedback for pin states
  • GPIO pins will be properly closed in these scenarios:
    • When the app is terminated
    • When the app is minimized or hidden
    • When the user explicitly tries to close the app

Usage

  • Click the + button to add a new pin
  • Fill in the basic information (pin number and label)
  • Toggle Show Advanced Configuration to see additional options
  • Select the desired configuration options
  • Click Add to create the pin with the selected configuration
  • The UI will now show the configuration details in the expanded view of each pin.

Screenshots

drawing drawing drawing

Platform Support

Android iOS MacOS Web Linux Windows

Dependencies

Hardware Requirements

  • A Linux machine with GPIO pins
    • UI maybe be a bit laggy on Raspberry Pi 4B
    • Raspberry Pi 5 or more powerful SBC recommended
  • Jumper wires for connecting to GPIO pins
  • External devices to control or monitor (e.g., LEDs, buttons)

Getting Started

Prerequisites

  • Flutter SDK: Install Flutter
  • Dart SDK: Included with Flutter
  • CMake: Required for building the Linux application
  • gpiod: Required for controlling GPIO pins on Linux
    • Install the gpiod package:
      $ sudo apt-get install gpiod
    • Add permissions for GPIO pins:
      $ sudo groupadd gpiod
      $ sudo usermod -aG gpiod ${USER}
      $ sudo nano /etc/udev/rules.d/60-gpiod.rules
      • add the following:
      # udev rules for gpio port access through libgpiod
      SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpiod", MODE="0660"
      • reboot the system

Installation

  1. Clone the repository:

    git clone https://github.com/IoT-gamer/flutter_gpio_control_app.git
    cd flutter_gpio_control_app
  2. Install dependencies:

    flutter pub get

Running the Application

To run the application on Linux, use the following command:

flutter run -d linux

Project Structure

  • main.dart: Entry point of the application.
  • gpio_control: Contains the main features of the application.
    • device/: Hardware interaction layer (GPIO Pins) including repositories.
    • domain/: Domain layer including use cases.
    • presentation/: Presentation layer including UI and state management.

Building for Linux

The Linux build configuration is managed using CMake. The build process is defined in the build.ninja file.

About

Flutter application for controlling GPIO pins on a Linux machine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published