- Overview
- Features
- Components
- Requirements
- Setup
- File Structure
- How It Works
- Customization
- Troubleshooting
- Future Improvements
- License
- Contributing
This repository contains the code and documentation for a Garbage Collector Robot that uses Raspberry Pi, TensorFlow for real-time object detection, and MicroPython to control servos and motors. The robot is capable of detecting trash, picking it up using a robotic arm, and placing it into a bin autonomously.
- Object Detection: Uses TensorFlow for detecting trash objects in real-time.
- Real-time Tracking: Tracks the detected trash using a Raspberry Pi camera.
- Autonomous Movement: Controlled by servos and motors for picking up trash and disposing it into a bin.
- MicroPython: Efficient lightweight scripting for controlling hardware components (servos, motors, sensors).
- Raspberry Pi: The brain of the robot, running TensorFlow and controlling hardware.
- Raspberry Pi Camera: Used for real-time video streaming and object detection.
- Servo Motors: Control the arm for picking up trash.
- DC Motors: Allow the robot to move towards the detected trash.
- MicroPython: Used for hardware interfacing with the Raspberry Pi.
- Raspberry Pi (preferably Pi 4)
- Raspberry Pi Camera Module
- Servo motors (for the robotic arm)
- DC motors (for movement)
- Motor Driver Module (L298N or similar)
- Power Supply for motors
- Various jumper wires, breadboard, etc.
- Raspberry Pi OS (Raspberry Pi 4)
- Python 3.x
- MicroPython
- TensorFlow Lite
- OpenCV (for image processing)
- RPi.GPIO (for motor and servo control)
To install TensorFlow Lite and OpenCV on your Raspberry Pi, run the following commands:
sudo apt-get update
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install python3-picamera
pip3 install tensorflow opencv-python
Install MicroPython on your Raspberry Pi to control the hardware components (motors, servos).
pip3 install micropython
git clone https://github.com/yourusername/garbage-collector-robot.git
cd garbage-collector-robot
- Connect the Raspberry Pi Camera to the Pi’s camera interface.
- Connect the DC motors to the motor driver and Raspberry Pi GPIO pins.
- Connect the servo motors for the arm to GPIO pins for control.
-
Object Detection: The object detection model (trained using TensorFlow) will be deployed on the Raspberry Pi. The camera will continuously monitor for objects identified as "trash."
To run the detection script:
python3 detect_trash.py
-
Movement and Trash Pickup: Once trash is detected, the robot will move towards the trash, pick it up with its servo-controlled arm, and place it in the bin.
To run the control script:
python3 control_robot.py
Garbox/
│
├── models/
│ └── trash_detection_model.tflite
│
├── src/
│ ├── detect_trash.py
│ ├── control_robot.py
│ └── utils.py
│
├── README.md
└── requirements.txt
- Object Detection: The camera captures frames, which are fed into a pre-trained TensorFlow Lite model to detect trash objects.
- Real-Time Tracking: Once the trash is detected, the Raspberry Pi computes the distance and direction to the trash.
- Movement: The robot moves towards the trash using DC motors and adjusts its direction based on camera feedback.
- Pick-Up Mechanism: The robotic arm (controlled by servos) picks up the trash.
- Trash Disposal: The robot moves towards the bin and deposits the trash.
GARBOX.mp4
You can train the object detection model with your custom dataset of trash objects using TensorFlow. Follow this tutorial for training and deploying TensorFlow Lite models.
To modify motor and servo speeds or to fine-tune the robot's behavior, edit the parameters in control_robot.py
to suit your hardware setup.
- Ensure the camera module is properly connected and enabled in the Raspberry Pi configuration.
- Check the wiring for the motors and servos.
- Verify the TensorFlow model is correctly deployed on the Raspberry Pi.
- Integrate more advanced AI models to classify different types of trash.
- Add sensors to detect obstacles and improve navigation.
- Optimize battery life and power consumption.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.