Created by Yogesh M
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
- Real-time image classification
- Confidence-based filtering (only sends if probability > 0.70)
- Serial communication using Web Serial API
- Simple browser-based interface
project-folder/
│
├── index.html
├── README.md
└── my_model/
├── model.json
├── metadata.json
└── weights.bin
- Google Chrome (Web Serial API supported)
- Teachable Machine exported image model
- Wokwi simulation OR physical device with serial support
- Click Connect Wokwi
- Select the serial port
- Connection opens at 115200 baud
- Click Start Model
- Loads the trained model
- Starts webcam
- Begins prediction loop
- Evaluates all classes
- Picks highest probability
- If probability > 0.70 → sends class name via serial
Open index.html in Chrome
If opening locally, use a local server (e.g., Live Server)
- Connect Wokwi
- Start Model
- Show objects to webcam
- Observe predictions + serial output
ClassName\n
Example:
LED_ON
LED_OFF
Change confidence threshold
if (writer && bestProb > 0.70)Modify serial message
bestClass + "\n"- Works only on
httpsorlocalhost - Camera permission required
- Ensure correct path for
my_model/
- Gesture-based control
- Smart IoT automation
- Object-triggered actions
- AI-powered device control
- Add UI indicators for detected class
- Map classes to specific hardware actions
- Add audio/visual feedback
- Improve model accuracy