Things used in this project

Hardware components:
R8326274 01
Raspberry Pi 2 Model B
×1
Software apps and online services:
73318 301258139977848 644841747 n
OpenCV

Schematics

H-Bridge
Circuit to drive the motor that taps on the screen
AFUi5he47SPfEaF7MoD7.sch

Code

Gaming BotPython
The code is written in python and runs on a Raspberry Pi. It needs openCV packages to be installed.
import RPi.GPIO as io
import cv2

cap=cv2.VideoCapture(0)
cv2.namedWindow("B & W")



io.setmode(io.BOARD)
io.setup(11,io.OUT)
io.setup(12,io.OUT)

def tap():
    io.output(12,io.LOW)
    io.output(11,io.HIGH)
    cv2.waitKey(150)
    io.output(11,io.LOW)
    io.output(12,io.HIGH)
    k=cv2.waitKey(50)
    io.output(12,io.LOW)


while cap.isOpened():
    ret,frame=cap.read()
    #bw=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    roi=frame[300:317,237:262]
    bw = cv2.cvtColor(roi,cv2.COLOR_BGR2GRAY)

    ret,bw=cv2.threshold(bw,170,255,cv2.THRESH_BINARY)
    k=0
    for i in range(0,17):
        for j in range(0,25):
            if(bw.item(i,j)==255):
                k=k+1
    print k
    
    #cv2.imshow("Frame",frame)
    #cv2.imshow("B & W",bw)
	
    if k<420:
	print("tap")
        tap()
	ret,frame=cap.read()
        ret,frame=cap.read()
        ret,frame=cap.read()

    if cv2.waitKey(1) & 0xFF==27:
        break

cap.release()
cv2.destroyAllWindows()



while False:
    io.output(12,io.LOW)
    io.output(11,io.HIGH)
    k=cv2.waitKey(50)
    if k==27:
        break
    io.output(11,io.LOW)
    io.output(12,io.HIGH)
    k=cv2.waitKey(50)
    if k==27:
        break

Credits

Photo
Ankur Deka

I love to make and break !

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

Solar Smart Greenhouse using Vertical Aquaponic Towers
Intermediate
  • 1,329
  • 22

Work in progress

Feed your family with 22 sqm greenhousing by combining permaculture, aquaponic vertical towers and IOT.

PiGlass
Intermediate
  • 2,267
  • 18

Full instructions

A device that can measure environmental conditions and relay to the user; in glasses form.

Raspberry Pi Facial Recognition
Intermediate
  • 4,167
  • 35

Full instructions

So you want to control entry to your secret lair, huh? This project will allow you to use facial recognition using a Pi and AWS.

Aquariumatic
Intermediate
  • 1,077
  • 10

Work in progress

Aquarium monitor with automation, Web GUI & IOT. Daisychain units can control multiple tanks all from the one master unit.

Vehicle Artificial Perception-Building Experimental Systems
Intermediate
  • 1,552
  • 15

Work in progress

Exploring Vehicle Artificial Perception in Self-driving technology with DragonBoard 410c and Raspberry Pi 3

Star Trek (LCARS) Home Automation Control Panel
Intermediate
  • 2,005
  • 14

Full instructions

When 2 classic sci-fi franchises collide. We build a Star Trek style control panel for our 2001 Space Odyssey style home automation system.

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback