Designed a system that can efficiently sort recyclables and transfer them to corresponding bins using Python, a Raspberry Pi, and Quanser Labs.

Overview

System for Sorting and Recycling Containers - Project 3

Table of contents

Overview

The challenge

  • Develop a system that can efficiently sort recyclables and transfer them to corresponding bins. Using Python create a program that can control robotic devices by connecting to a Raspberry Pi and using a remote environment (Quanser Labs).
  • Use the Q-Arm and the Q-Bot to transfer the containers in their appropiate bins.

Screenshot

Both Q-Bot and Q-Arm at Loading Position

Pic-1

Random Container Dispensed From the Tube

Pic-2

Q-Arm Loads the Containers Being Dropped at the Same Bin

Pic-3

Q-Bot Transfers the Containers & Engages the Hopper to Drop the Containers

Pic-5

My process

Built with

  • Python: Functions, conditionals, and loops.
  • Q-Arm and Q-Bot (ground robot) methods (common_libraries folder) used to move both robotic devices.
  • Ultrasonic sensor modules (common_libraries folder) provided to track the final bin distance.

Code snippets

Code to Determine the Bin Location of a Dispensed Container

  while (True):
      #Tracks the total mass of the containers
      total_mass = 0

      #Dispenses and loads the first container
      while (True):
          #Stores the information of the dispensed container (material, bin destination)
          container_list = []

          #Stores the bin ID of the first loaded container
          first_loaded_container = []

          #Checks if this is the first or second time a container is loaded to transfer 
          if (deposit_counter >= 1):

              #Stores the bin ID of the container which is not loaded
              first_target_bin = next_container[len(next_container)-1]
          else:

              #Dispenses a random container as this is the first time
              container_properties = my_table.container_properties(random.randint(1,6))
              container_list.append(container_properties)
              my_table.dispense_container()

              #Stores the bin ID from the container properties (material,mass,bin destination)
              for properties in container_list:
                  total_mass = properties[1]
                  first_target_bin = properties[2]

          print("First Target Bin:  ", first_target_bin)

          #Checks if dispensed container matches bin ID
          if (first_target_bin == "Bin01"):
              bin_ID = "Bin01"
          elif (first_target_bin == "Bin02"):
              bin_ID = "Bin02"
          elif (first_target_bin == "Bin03"):
              bin_ID = "Bin03"
          elif (first_target_bin == "Bin04"):
              bin_ID = "Bin04"

Q-Arm Code to Pick Up First Dispensed Container using Determined XYZ Coordinates

  #Loads the first container on the Q-Bot
  if (first_target_bin == bin_ID and total_mass < 90):
      #Appends the containers bin ID to compare with second dispensed container
      first_loaded_container.append(bin_ID) 
      arm.move_arm(0.68, 0.0, 0.2496)
      arm.control_gripper(45)
      arm.move_arm(0.2256, 0.0, 0.1898)
      arm.move_arm(-0.11, -0.300, 0.6)
      arm.move_arm(-0.11, -0.44, 0.39)
      arm.control_gripper(-45)
      arm.rotate_elbow(-33)
      arm.home()
      break
  else:
      break

Q-Bot Code to Transfer the Loaded Container using the Ultrasonic Sensor

  bot.activate_ultrasonic_sensor()

  #Checks if the loaded container matches bin ID and assigns a sensor value
  if (transfer_location == "Bin01"):
      bin_ID = "Bin01"
      #Value collected from ultrasonic reading which indicates when the Q-Bot should stop for each bin
      bin_target_location = [0.1]

  elif (transfer_location == "Bin02"):
      bin_ID = "Bin02"
      bin_target_location = [0.15]

  elif (transfer_location == "Bin03"):
      bin_ID = "Bin03"
      bin_target_location = [0.20]

  elif (transfer_location == "Bin04"):
      bin_ID = "Bin04"
      bin_target_location = [0.24, 0.25]

  if(transfer_location  == bin_ID):
      #While loop which runs until the target bin is located using ultrasonic sensor
      #Follows the yellow line until it arrives at target bin
      lines = 0
      while(lines < 2):
          lines, velocity = bot.follow_line(0.07)
          bot.forward_velocity(velocity)
          ultrasonic_reading = bot.read_ultrasonic_sensor(bin_ID)

          #Checks if assigned bin locations match the sensor values to stop the Q-Bot
          if(ultrasonic_reading in bin_target_location):

              #Stops the Q-Bot parallel to the bin
              bot.stop()
              bot.deactivate_ultrasonic_sensor()
              print("Reached target bin...")
              time.sleep(1)
              print("Deposit Container...")
              break
          else:
              #Moves Q-Bot forward until target location is determined
              bot.forward_speed(0.06)

What I learned

From this challenge I strengthened my knowledge of Python computation and scripting. Moreover, I learned more about python functions and also developed my abilities to resolve any bugs or issues within the program.

Owner
Mit Patel
Computer Engineering at McMaster University.
Mit Patel
Hourglass on the pi pico using circuitpython

hourglass-on-pico "Hourglass" on the raspberry pi pico using circuitpython circuitpython version 7.0.0 Components used: Raspberry Pi Pico ADXL345 acce

4 Jul 18, 2022
hardware design of the 250mm drone

hardware design of the 250mm drone

ZJU FAST Lab 645 Dec 25, 2022
Pi-hole with Inky pHAT ePaper display

Pi-hole with Inky pHAT ePaper display This is my Pi-hole with an ePaper display.

11 Sep 13, 2022
Automate gate/garage door opening via 433.92MHz emitter with Raspberry Pi, Home Assistant and Homekit.

Automate opening your garage door / gate Summary This project sums up how I automated opening my garage door using a Raspberry PI, a 433Mhz emitter, H

Julien Fouilhé 29 Nov 30, 2022
Monorepo for my Raspberry Pi dashboard and GPS satellite listener.

🥧 pi dashboard My blog post: Listening to Satellites with my Raspberry Pi This is the monorepo for my Raspberry Pi dashboard!

Andrew Healey 27 Jun 08, 2022
The PicoEMP is a low-cost Electromagnetic Fault Injection (EMFI) tool,

ChipSHOUTER-PicoEMP The PicoEMP is a low-cost Electromagnetic Fault Injection (EMFI) tool, designed specifically for self-study and hobbiest research.

NewAE Technology Inc. 312 Jan 07, 2023
This is a collection of python modules that interact with the Ryze Tello drone.

This is a collection of python modules that interact with the Ryze Tello drone.

DJI-SDK 1.2k Jan 03, 2023
LifeSaver automatically, periodically saves USB flash drive data into the PC

LifeSaver automatically, periodically saves USB flash drive data into the PC. Theoriticaly it will work with any any connected drive ex - Hard Disk ,SSD ... But, can't handle Backing up multipatition

siddharth dhaka 4 Sep 26, 2021
CPU benchmark by calculating Pi, powered by Python3

cpu-benchmark Info: CPU benchmark by calculating Pi, powered by Python 3. Algorithm The program calculates pi with an accuracy of 10,000 decimal place

Alex Dedyura 20 Jan 03, 2023
Python library for the Phomemo m02s bluetooth thermal printer

Phomemo M02S Python library This is a basic Python library for controlling the Phomemo M02S bluetooth thermal printer. It probably only works on Mac &

Stargirl Flowers 28 Nov 07, 2022
This is a python script to grab data from Zyxel NSA310 NAS and display in Home Asisstant as sensors.

Home-Assistant Python Scripts Python Scripts for Home-Assistant (http://www.home-assistant.io) Zyxel-NSA310-Home-Assistant Monitoring This is a python

6 Oct 31, 2022
USB Rubber Ducky with the Rasberry Pi pico microcontroller

pico-ducky Install Install and have your USB Rubber Ducky working in less than 5 minutes. Download CircuitPython for the Raspberry Pi Pico. Plug the d

AnOnYmOus001100 3 Oct 08, 2022
Isaac Gym Environments for Legged Robots

Isaac Gym Environments for Legged Robots This repository provides the environment used to train ANYmal (and other robots) to walk on rough terrain usi

Robotic Systems Lab - Legged Robotics at ETH Zürich 372 Jan 08, 2023
Workshop for student hackathons focused on IoT dev

Scenario: The Mutt Matcher (IoT version) According to the World Health Organization there are more than 200 million stray dogs worldwide. The American

Microsoft 15 Aug 10, 2022
Custom component for MPC-HC for home-assistant

mpc_hc The current mpchc integration in homeassistant violates ADR0004, so it will be deleted from core. This is just the existing integration copied

3 Dec 15, 2022
A low power 1U Raspberry Pi cluster server for inexpensive colocation.

Raspberry Pi 1U Server There are server colocation providers that allow hosting a 1U server for as low as $30/month, but there's a catch: There are re

Paul Brown 627 Dec 31, 2022
Component for deep integration LedFx from Home Assistant.

LedFX for Home Assistant Component for deep integration LedFx from Home Assistant. Table of Contents FAQ Install Config Performance FAQ Q. What versio

Dmitry Mamontov 28 Dec 13, 2022
Designed a system that can efficiently sort recyclables and transfer them to corresponding bins using Python, a Raspberry Pi, and Quanser Labs.

System for Sorting and Recycling Containers - Project 3 Table of contents Overview The challenge Screenshot My process Built with Code snippets What I

Mit Patel 2 Dec 02, 2022
Example Python code for building RPi-controlled robotic systems

RPi Example Code Example Python code for building RPi-controlled robotic systems These python files have been compiled / developed by the Neurobionics

Elliott Rouse 2 Feb 04, 2022
Transform a Raspberry Pi into a network diagnostic machine.

EtherView Last updated jan 30, 2022. Welcome to the EtherView project! This is a project to transform a RaspberryPi into a portable network diagnostic

1 Jan 30, 2022