Skip to content

Be-bibek/flutter-ml-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Companion Robot

An AI-Powered Interactive Robot Using Raspberry Pi and Edge LLMs

Flutter Raspberry Pi Python AI Offline Status

๐Ÿ”— Live Web App:
https://flutter-ml-web.web.app


๐Ÿ“˜ Abstract

Companion Robot is an AI-powered interactive robotic system designed to operate entirely offline using edge-based intelligence. Compact enough to fit on a desk, the system integrates speech recognition, computer vision, and distance sensing through a Raspberry Pi without relying on cloud infrastructure.

Voice commands are captured via an onboard microphone and processed locally using Large Language Models (LLMs). Visual perception is provided by a camera module, while spatial awareness and collision avoidance are achieved using ultrasonic distance measurement. All computation occurs on-device, ensuring low latency, enhanced privacy, and uninterrupted operation.

The robot provides real-time feedback through an integrated display and audio output. This project demonstrates how affordable hardware combined with efficient AI pipelines can enable autonomous, privacy-preserving robotic assistants.


๐ŸŽฏ Objectives

  • Enable fully offline AI interaction
  • Achieve real-time perception and response
  • Ensure safe autonomous navigation
  • Provide web-based control via Flutter
  • Maintain modular and scalable architecture

๐Ÿง  System Architecture

Companion Robot follows a layered architecture, ensuring clean separation of hardware interaction, processing logic, and intelligence.

๐Ÿ” High-Level Data Flow Diagram


๐Ÿงฉ Architectural Layers

1๏ธโƒฃ Input Layer

  • Microphone: Captures speech commands.
  • Camera Module: Supplies real-time visual data.
  • Ultrasonic Sensor: Computes distance using echo timing.

2๏ธโƒฃ Processing Layer

Implemented in Python with Flask, this layer:

  • Converts speech to text
  • Normalizes sensor signals
  • Routes commands between UI and AI
  • Maintains real-time API communication

3๏ธโƒฃ Intelligence Layer (Edge LLM)

  • Runs locally (offline) using LM Studio
  • Performs:
    • Natural language understanding
    • Scene and object analysis
    • Contextual decision-making
    • Emotion classification

4๏ธโƒฃ Output & Feedback Layer

  • Speaker: AI-generated speech output
  • Display: System state and responses
  • Motors: Physical movement execution
  • Flutter Web UI: Control, logs, and visualization

๐Ÿ› ๏ธ Hardware Components

Component Description
Raspberry Pi 4 Model B Central processing unit
Camera Module Visual perception
Ultrasonic Sensor (HC-SR04) Obstacle detection
Microphone Voice input
Speaker Audio output
3.5โ€ณ Touch Display Visual feedback
Motor Driver + Motors Locomotion
Regulated Power Supply Stable power delivery

๐Ÿ’ป Software Stack

  • Frontend: Flutter (Web/Desktop)
  • Backend: Python, Flask, Socket.IO
  • AI Engine: LM Studio (Local LLMs)
  • Vision: OpenCV
  • Speech: Web Speech API / PyAudio
  • Hardware Control: GPIO
  • OS: Raspberry Pi OS

โš™๏ธ Flask-Based Control Logic (Conceptual)

The Flask server acts as the central coordination unit.

Fail-safe logic ensures immediate stop or slowdown when obstacles are detected.


๐ŸŽญ Emotion & Interaction System

  • Emotion mapping from AI responses
  • Fullscreen emotion playback
  • Duplicate-emotion prevention
  • Automatic return to idle state

This enhances human-robot interaction quality.


๐Ÿ–ฅ๏ธ Flutter Web Interface

Features

  • Manual control dashboard
  • AI chat interface
  • Auto Mode hotkey
  • Live logs & diagnostics
  • Network configuration UI
  • Desktop full-screen support

๐ŸŽฎ Control Interface Overview

๐Ÿ•น๏ธ Manual Control Panel

๐Ÿ”ผ **Forward** Move the rover forward with controlled acceleration.
โ—€๏ธ **Left** Rotate or steer left precisely.
โน๏ธ **Stop** Immediately halts all movement.
โ–ถ๏ธ **Right** Rotate or steer right.
๐Ÿ”ฝ **Reverse** Moves the rover backward safely.

โšก Quick Actions

๐Ÿ”„ **Rotate 90ยฐ** Performs a precise quarter-turn rotation.
๐Ÿ” **Rotate 180ยฐ** Reverses direction using a half-turn rotation.
๐Ÿ›‘ **Emergency Stop** Overrides all commands and forces a safe halt.
๐ŸŽค **Voice Command** Activates offline speech-based AI control.

๐Ÿ—ฃ๏ธ Voice Prompt System

Text prompts can be entered manually and transmitted directly to the Raspberry Pi speaker. Voice commands are processed **locally** using the onboard AI pipeline.

๐Ÿ“ก Live Telemetry Monitoring

Real-time system telemetry is displayed during operation, allowing the operator to monitor rover state, diagnostics, and safety conditions while issuing commands.

๐Ÿ’ก Design Principle:
The interface is inspired by mission-command dashboards, emphasizing safety, clarity, and immediate operator awareness without reliance on keyboard input.


๐Ÿงฉ Interactive UI & System Visualization


๐Ÿ—บ๏ธ System Data Flow (Visual Diagram Card)

Purpose:
This flow ensures real-time, offline intelligence with minimal latency and maximum safety.


๐Ÿง  Auto Mode Interface

๐Ÿค– Auto Mode (AI-Driven Control)

Auto Mode enables autonomous behavior using local AI reasoning and sensor fusion.

Capabilities:

  • Continuous environment scanning
  • Voice-initiated task execution
  • Obstacle-aware motion control
  • Emotion-synchronized responses

Safety Behavior:

  • Ultrasonic distance monitoring
  • Automatic slow-down in congested areas
  • Emergency stop override at all times

Auto Mode always yields priority to manual or emergency commands.


๐Ÿ“ก Live Telemetry Panel

๐Ÿ“Š Real-Time System Telemetry

Metric Description
CPU Load Current Raspberry Pi processing usage
Temperature Live system thermal state
Distance (cm) Ultrasonic obstacle measurement
Network Status API connectivity health
Motor State Active / Idle / Emergency Stop

Telemetry updates continuously while commands are executed, ensuring operator awareness and system transparency.


๐ŸŽญ Emotion System UI

๐Ÿ˜Š Emotion & Expression Engine

The Companion Robot uses an emotion-mapped response system to enhance interaction.

Emotion Triggers:

  • AI response classification
  • System states (idle, thinking, alert)
  • Voice interaction outcomes

UI Behavior:

  • Fullscreen emotion playback
  • Duplicate emotion prevention
  • Automatic fallback to idle state

Examples:

  • ๐Ÿ˜Š Happy โ†’ Joke or positive response
  • ๐Ÿค” Thinking โ†’ Scanning or processing
  • ๐Ÿšจ Alert โ†’ Obstacle detected

This system improves clarity, relatability, and human-robot communication.


๐ŸŽฏ Design Philosophy

The Command Center UI follows **mission-control principles** โ€” prioritizing safety, clarity, and immediate feedback while eliminating unnecessary complexity.

๐Ÿ”’ Safety & Reliability

  • Ultrasonic obstacle avoidance
  • Speed reduction near objects
  • Emergency stop mechanism
  • Manual override priority
  • Non-blocking asynchronous execution

๐Ÿ“ธ Application Screenshots



Manual Control Panel
Directional and emergency controls


AI Chat Interface
Offline command & response system



Auto Mode Active
AI-driven autonomous behavior


Camera Preview
Real-time vision input for AI



Emotion Display
AI emotion-based visual feedback


Desktop Full-Screen View
Optimized wide-screen layout

๐Ÿงช Methodology

  1. Capture user input
  2. Preprocess locally
  3. Interpret using LLM
  4. Apply safety constraints
  5. Execute action
  6. Provide feedback
  7. Log system state

๐Ÿš€ Applications

  • Educational robotics
  • Offline AI assistants
  • Human-robot interaction research
  • Privacy-preserving AI systems
  • Smart automation demos

๐Ÿ“ˆ Future Scope

  • Follow-me mode
  • Patrol / guard mode
  • Face recognition (optional)
  • Expanded emotion library
  • Multi-language interaction

๐Ÿ“„ Disclaimer

This project is developed for educational and experimental purposes.
Proper safety measures must be followed during physical deployment.


โญ Companion Robot demonstrates the feasibility of intelligent, private, and autonomous edge-AI robotics using affordable hardware.

About

A Flutter-based machine learning web application (Live demo available)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors