Things used in this project

Hardware components:
Intel.web.720.405
Intel Edison
×1
SparkFun capacitive touch sensor
×1
Grove 20starter 20kit 20plus 20  20intel c2 ae 20iot2 01
SeeedStudio Grove starter kit plus for Intel Edison
×1
Software apps and online services:
Ha 2up iot
Amazon Web Services AWS IoT

Code

trashmatic.pyPython
Script which handles trashmatic on Edison. Servo connects to D5. Compacitive touch connects to D7. RGB/Prox sensor connects to I2C slot. Run on Edison, and it handles the rest.
from upm import pyupm_servo as servo
import time
from upm import pyupm_grove as grove
from upm import pyupm_i2clcd as lcd
from HTU21D_Ed import HTU21D as RGB
from subprocess import call
from upm import pyupm_i2clcd as lcd

#myLcd = lcd.Jhd1313m1(0, 0x3E, 0x62)

recycle = 0
trash = 0
rgb = RGB(6)
touch = grove.GroveButton(7)
gServo = servo.ES08A(5)
opped = False

thingname = "edison-lightbulb"



def sendAWSData():
	payload = "\"{\\\"state\\\":{\\\"reported\\\":{\\\"recyclable\\\": " + str(recycle) + ", \\\"trash\\\": " + str(trash) + ", \\\"trashed\\\": " + str(trash + recycle) + "}}}\""
	
	shadow_command = "iot-data update-thing-shadow --thing-name " + thingname + " --payload " + payload + " output.txt"
	call("aws " + shadow_command, shell=True)

def recycleItem(recycle):
    recycle += 1
    gServo.setAngle(0)
#    myLcd.setColor(0,255,0)
    time.sleep(1)

def trashItem(trash):
    trash += 1
    gServo.setAngle(110)
#    myLcd.setColor(255,0,0)
    time.sleep(1)

rgb.initSensor()
gServo.setAngle(58)

while 1:
#        myLcd.setColor(0,0,255)
	if rgb.readUReg(0x9C) > 200:
		print("Something's in the bin!")
		time.sleep(2)
		if touch.value() == 1:
			print("Conductive material")
                        recycleItem(recycle)
                        opped = True
		a,r,g,b = rgb.color() # Checks data from sensor. a = ambient light
                if (a+r+g+b) > 2000:
                    print()
                    print("Paper!")
                    recycleItem(recycle)
                    opped = True

                if opped == False:
                    trashItem(trash)
		gServo.setAngle(58)

                opped = False

		sendAWSData()

Credits

121591c0564092035499cb0056c35fea
Douglas Jude Patz

I am a young aspiring hacker who is very into game development.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

SnapFood
  • 41
  • 0

Use EBT card to buy on-demand fresh food and online groceries with Alexa and Android.

SnapFood

Team SnapFood

Eat In Time
  • 323
  • 5

Know when to eat food before it expires.

Eat In Time

Team Eat In Time

Floragotchi
  • 232
  • 3

Floracotchi is the world's first Tamagotchi with a living plant.

Floragotchi

Team floragotchi

Facebook Notifier using Intel Galileo
  • 1,160
  • 20

Tell when you have a Facebook notification with an LED and an Intel Galileo

Facebook Notifier using Intel Galileo

by bogdan.vlad on projects.wyliodrin.com

A Display to Track the Days Until MAKE hits Newsstands
  • 439
  • 9

Display on an Intel Galileo controlled LCD when the next MAKE magazine will arrive at the newsstands

ProjectsCommunitiesContestsLiveFree StoreBlogAdd projectSign up / Login
Respect project