Skip to content

embedwTej/Teachable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Teachable Machine + Wokwi Serial Control

Created by Yogesh M


🚀 Overview

This project integrates a Teachable Machine Image Model with the Web Serial API to send real-time predictions to a Wokwi simulation (or any microcontroller via serial).

  • Uses a webcam to capture live images
  • Runs an image classification model in the browser
  • Detects the most probable class
  • Sends the detected class to Wokwi via serial

🧠 Features

  • Real-time image classification
  • Confidence-based filtering (only sends if probability > 0.70)
  • Serial communication using Web Serial API
  • Simple browser-based interface

📁 Project Structure

project-folder/
│
├── index.html
├── README.md
└── my_model/
    ├── model.json
    ├── metadata.json
    └── weights.bin

⚙️ Requirements

  • Google Chrome (Web Serial API supported)
  • Teachable Machine exported image model
  • Wokwi simulation OR physical device with serial support

🔌 How It Works

1. Connect to Wokwi

  • Click Connect Wokwi
  • Select the serial port
  • Connection opens at 115200 baud

2. Start Model

  • Click Start Model
  • Loads the trained model
  • Starts webcam
  • Begins prediction loop

3. Prediction Logic

  • Evaluates all classes
  • Picks highest probability
  • If probability > 0.70 → sends class name via serial

🖥️ Usage

Run the Project

Open index.html in Chrome

If opening locally, use a local server (e.g., Live Server)


Start Workflow

  1. Connect Wokwi
  2. Start Model
  3. Show objects to webcam
  4. Observe predictions + serial output

📡 Serial Output Format

ClassName\n

Example:

LED_ON
LED_OFF

🔧 Customization

Change confidence threshold

if (writer && bestProb > 0.70)

Modify serial message

bestClass + "\n"

⚠️ Notes

  • Works only on https or localhost
  • Camera permission required
  • Ensure correct path for my_model/

💡 Use Cases

  • Gesture-based control
  • Smart IoT automation
  • Object-triggered actions
  • AI-powered device control

📌 Future Improvements

  • Add UI indicators for detected class
  • Map classes to specific hardware actions
  • Add audio/visual feedback
  • Improve model accuracy

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages