constraints
80 percent accuracy
4 minutes or less
Make sure they don't jump into other containers
What to fix from the prototype
FUNNEL
Needs to be smaller and not curved at the top, Skittles get stuck in the funnel, and then it doesn't move
It also needs to be thinner because 2 skittles go down at the same time to be sensed, and then it bounces out or doesn't move
SLIDE AND BOXES
The boxes go too far to the left, and then the whole thing goes to the slide, dosent reach
We had to share bins for yellow and green. We split them in half, and that made it hard to sort
Need to make them smaller and in a better design
SENSOR
The sensor needs to be enclosed in the sorter so that there is no outside light, so we don't have to keep changing values
Double-layered slider so that it takes one skittle at a time to the sensor
CODE
The values were finicky depending on what lights were on, we need to ensure that it sorts with 80% accuracy (we were at 48% for the prototype)
OVERALL BOX
The box needs to look better, with many holes and wires all around, and the glue is visible
1.) The skittles go down the funnel
2.) The grabber grabs a Skittle and moves it to the sensor
3.) The sensor senses the skittles color and then moves to the hole
4.) Once it reaches the hole it falls and moves to the proper basket associated with the color
Funnel
slide
import time #Imports a library called time
import board #Imports a library called board
import pwmio #Imports a library called pwmio
from adafruit_motor import servo #Imports a library called servo from adafruit_motor
import busio
import adafruit_tcs34725
# create a PWMOut object on Pin A2.
pwm = pwmio.PWMOut(board.GP6, duty_cycle=2 ** 15, frequency=50) #Defines an object using pwmio library and attaches it to GP22 and naming it pwm.
# Create a servo object, my_servo.
my_servo = servo.Servo(pwm) #Defining a servo object using the lervo library naming it my_servo.
##################
# *EDIT*
# Set configurable values below
# Feed name for Adafruit IO
# milliseconds to gather color data
sensor_integration_time = 150
# manually override the color sensor gain
sensor_gain = 4
# Collect this many samples each time we prompt the user
num_samples = 5
#
# End of editable config values
##################
# Create sensor object, communicating over the board's default I2C bus
i2c = busio.I2C(board.GP5, board.GP4) # uses first I2C SCA/SCL pair on pico
sensor = adafruit_tcs34725.TCS34725(i2c)
red_i = sensor.color_rgb_bytes[0]
green_i = sensor.color_rgb_bytes[1]
blue_i = sensor.color_rgb_bytes[2]
my_servo.angle = 110 #Rotates our servo one direction at full speed.
time.sleep(1.5) #Waits 2 seconds
print("Temperature: %d" % sensor.color_temperature)
print(
"r: %d, g: %d, b: %d"
% (
sensor.color_rgb_bytes[0],
sensor.color_rgb_bytes[1],
sensor.color_rgb_bytes[2],
)
)
print("Lux: %d" % sensor.lux)
if red_i > 21 and green_i > 13 and green_i < 18 and blue_i < 10:
print("This is orange!")
elif red_i < 20 and green_i > 25 and blue_i < 10:
print("This is green!")
elif red_i > 25 and green_i > 20 and blue_i < 5:
print("This is yellow!")
elif red_i > 22 and green_i > 15 and green_i < 20 and blue_i < 15:
print("This is red!")
elif red_i < 20 and green_i > 19 and green_i < 25 and blue_i > 10:
print("This is purple!")
else:
print("IDK!")
my_servo.angle = 75
time.sleep(1)
my_servo.angle = 162# Rotates our servo the opposite direction at full speed.
time.sleep(1.5) #Waitsh 2 seconds
while True:
red_i = sensor.color_rgb_bytes[0]
green_i = sensor.color_rgb_bytes[1]
blue_i = sensor.color_rgb_bytes[2]
my_servo.angle = 110 #Rotates our servo one direction at full speed.
time.sleep(1.5) #Waits 2 seconds
print("Temperature: %d" % sensor.color_temperature)
print(
"r: %d, g: %d, b: %d"
% (
sensor.color_rgb_bytes[0],
sensor.color_rgb_bytes[1],
sensor.color_rgb_bytes[2],
)
)
print("Lux: %d" % sensor.lux)
if red_i > 21 and green_i > 13 and green_i < 18 and blue_i < 10:
print("This is orange!")
elif red_i < 20 and green_i > 25 and blue_i < 10:
print("This is green!")
elif red_i > 25 and green_i > 20 and blue_i < 5:
print("This is yellow!")
elif red_i > 22 and green_i > 15 and green_i < 20 and blue_i < 15:
print("This is red!")
elif red_i < 20 and green_i > 19 and green_i < 25 and blue_i > 10:
print("This is purple!")
else:
print("IDK!")
my_servo.angle = 75
time.sleep(1)
my_servo.angle = 162# Rotates our servo the opposite direction at full speed.
time.sleep(1.5) #Waitsh 2 seconds
This was more complicated than other projects I’ve done
Needed to combine code, hardware, and mechanical design
The hardest part was getting accurate color readings
Fixed it by adjusting RGB thresholds + blocking outside light
I am most proud of the physical sorter because that was the part I built while my partner worked on the code
This is my documentation notebook it has the process of every single prototype, sketch, video and more. having a documentation notebook was very helpful because we could find everything we needed for our robots in there.
Onshape/Digital Fabrication:
I used Onshape to digitally fabricate all of the exterior walls of my robot. I used finger joints on all 90 degree angles to make sure the structure of the robot was secure. We created 3D components like mounts for our servos and holds for our ball bearings with onshape as well.
Coding was one of the most important aspects of this project because if the code didn’t work your robot wouldnt move. The programming language we used was Python. This language is beginner friendly due to its simplicity compared to other coding languages. We used functions to control the robot's movements, including forward, backward, left, and right. These functions were especially helpful because they allowed us to simply call Forward() instead of rewriting all the code for that movement each time. Additionally, "if" statements played a significant role in adding our neopixels. For instance if you press the circle on the dabble app my lights turn on and they are yellow,
In this video I was racing marielle and ethan. I came in second place only because I got stuck on a corner.
Overall my functionality was pretty good even though my robot was pretty big and heavy. When moving forward my robot would drift a little bit due to the weight and the materials i made my wheels out of. When turning my robot did very well despite the weight. The only downside was that it would get stuck sometimes while turning because it was big.
How has this project compared to other projects that you have done in your other classes?
Although this project was difficult I really enjoyed the design aspect of this project. It has definitely been the hardest engineering project I have done. I feel like I have learned a lot of skills like using onshape, sautering, 3D design, and learning how to use python and code. One hard thing about this project for me was the fast pace of the class, because of this we had to quickly come up with fixes without problems or we had to work outside of class on them.
What would you change about your robot if you were to do this project again?
one thing i would change about my robot if i where do this project again would be making my van smaller. If i knew all of the paths we had traverse and how the weight would affect how fast it would be.
What is the top skill that you think you know well enough that you could teach others and why?
One skill I think I could teach someone else is how to use onshape. I feel like I have learned onshape very well and I can explain how to do most of the things on there.