Apple Detect AI System is a simple AI-powered system that detects apples using a camera and controls an Arduino board based on the detection result. This project uses LM Studio to run the Gemma 3 4b multimodal AI model locally.
https://youtube.com/shorts/DjQJwr3t2xY
- The camera captures an image.
- The image is sent to the AI model Gemma 3 4b running on LM Studio.
- The AI analyzes the image and determines if an apple is present.
- If an apple is detected:
- The system sends
1to the Arduino board. - The Arduino turns on an LED (or another connected device).
- The system sends
- If no apple is detected:
- The system sends
0to the Arduino board. - The Arduino turns off the LED.
- The system sends
- Computer (to run LM Studio and process images)
- Camera (compatible with
pygame.camera) - Arduino Board (e.g., Arduino Uno)
- LED or other output device
- USB cable (to connect the Arduino)
- Python 3
- LM Studio (running Gemma 3 4b)
- Arduino IDE
- Python Libraries:
openaipygamepyserial
- Download and install LM Studio.
- Load the Gemma 3 4b model.
- Start the LM Studio server (
http://localhost:1234/v1).
pip install openai pygame pyserial- Open
SaAIDS.inoin the Arduino IDE. - Select the correct board and port.
- Upload the code to the Arduino.
python CVTestAI.py- If an apple is detected: LED turns on.
- If no apple is detected: LED remains off.
- The console prints:
YesorNo.
This project is licensed under the MIT License.
