Things used in this project

Hardware components:
peristaltic pump
×1
Fairchild semiconductor pn2222abu. image
General Purpose Transistor NPN
×1
Fairchild semiconductor 1n4004. image
1N4007 – High Voltage, High Current Rated Diode
×1
phenolphtaleine
×1
Intel.web.720.405
Intel Edison
×1
13036 01
SparkFun Block for Intel® Edison - Arduino
×1
Camera (generic)
×1
Tens70
9V battery (generic)
×2
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
73318 301258139977848 644841747 n
OpenCV
Hand tools and fabrication machines:
Form Labs 3D printer

Custom parts and enclosures

CAD files for microfluidic prototype
Print on Form2 with translucent resin
F7Eg4UfPx8GbMVHUbHfS.3dm

Schematics

Render of millifluidic device
plug it in
5aalg8poqe44qugc668i

Code

DNA detectorPython
This script runs the pump, camera, processes images with openCV and sends a text message with results via IFTTT
#!/usr/bin/env python

import mraa
import time
import numpy as np 
import cv2
import os


button = mraa.Gpio(6)
button.dir(mraa.DIR_IN)

pump = mraa.Gpio(11)
pump.dir(mraa.DIR_OUT)
pump.write(0)

led = mraa.Gpio(12)
led.dir(mraa.DIR_OUT)
led.write(0)

buzzer = mraa.Gpio(4)
buzzer.dir(mraa.DIR_OUT)
buzzer.write(0)

cap = cv2.VideoCapture(0)
ret, frame = cap.read()

# delays
pumpDelay = 45
soakDelay = 15

# iteration = 0


# define range of pink color in HSV
lower_pink = np.array([110,50,50])
upper_pink = np.array([130,255,255])


def captureImage():
        # Take each frame
        ret, frame = cap.read()
        print "read ret: " + str(ret)

        # Convert BGR to HSV
        hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
        return hsv

def readImage(imgname):
        print "read image" + imgname
        img = cv2.imread(imgname,0)
        # Convert BGR to HSV
        hsv = cv2.cvtColor(img, cv2.COLOR_RGB2HSV)
        return hsv


def calculatePinkPixels(image):
        mask = cv2.inRange(image, lower_pink, upper_pink)
        return cv2.countNonZero(mask)



def getButtonPress():
        while True:
                if (button.read() == 1):
			print "Button Pressed %f" % (time.time())
                        return
                else:
                        time.sleep(0.05)

def sendCurl(message):
        command = "curl -X POST -H \"Content-Type: application/json\" -d '{\"value1\":\"%s\"}' https://maker.ifttt.com/trigger/dnaDetected/with/key/cTs_Jqc-oa-NLl-jo6dKL1" % (message)
        os.system(command)

def chirpBuzz():
	buzzer.write(1)
	time.sleep(0.05)
        buzzer.write(0)

def takeMeasurement(iteration):
        print "...cap img 1"
        img1 = captureImage()
        # img1 = readImage("test_img#1.jpg")
        cv2.imwrite('/home/root/programs/it%d-img1.jpg' % (iteration), img1, [cv2.IMWRITE_JPEG_QUALITY, 90])
        
        print "...pump 1"
        pump.write(1)
        time.sleep(pumpDelay)

        print "...pump 0"
        pump.write(0)

        time.sleep(soakDelay)
        
        print "...cap img 2"
        img2 = captureImage()
        # img1 = readImage("test_img#2.jpg")
        cv2.imwrite('/home/root/programs/it%d-img2.jpg' % (iteration), img2, [cv2.IMWRITE_JPEG_QUALITY, 90])

        print "...calc pixels"
        diffPinkPixels = calculatePinkPixels(img2) - calculatePinkPixels(img1)
        print "...diff pink pixels %d" % (diffPinkPixels)

        if diffPinkPixels > 100:
                message = "DETECTED"
        else:
                message = "UNDETECTED"

        print "...send curl"
        sendCurl(message)

def run():
        iteration = 0
        while True:
                getButtonPress()

                print "buttonPressed"
                led.write(1)
                print "led on"
                print "start measurement"
                takeMeasurement(iteration)
                print "end measurement"
                led.write(0)
                iteration = iteration + 1



def end():
        print "releasing camera"
        cap.release()        
        

try:
        run()
finally:
        end()

Credits

Vexogkqjv6a2idbkyj8a
Léonard Roussel

Acoustic engineer, sound designer. Grew up in Europe, live in NYC, want to do more sound art by adding behavior to physical or artificial objects.

Contact

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

Intelligent Community Alerts Beacon [-iCAB-]
Advanced
  • 211
  • 9

A cloud connected alert system that parses local alert feeds ranging from weather to missing persons and provides visual and audio feedback.

Wifi controlled ceiling fan
Advanced
  • 133
  • 4

Full instructions

My young children were not tall enough to pull the chains on the ceiling fan, to turn on the fan & light. Alexa, turn on the 'Boys Light'.

Power Lunch
Advanced
  • 114
  • 4

Full instructions

An insulated food container divided into two sections by a thermoelectric cooler module for quickly heating one side and cooling the other.

Power Lunch

5 members

Suicide Prevention Gun Safe Locking System
Advanced
  • 157
  • 3

Full instructions

An IoT device that helps prevent gun suicides through safe monitoring, only allowing access to a safe through a request/approval process.

Smart Compost System
Advanced
  • 104
  • 2

A smart system that can help anyone compost. The system aerates and hydrates your compost, and lets you know when you need to take action.

Smart Compost System

Team Boomer Sooner

Purdue ExoMIND Glove
Advanced
  • 729
  • 7

The ExoMIND Glove is a stroke rehabilitation device used to generate biofeedback for physical therapists and patients.

Purdue ExoMIND Glove

Team Purdue MIND

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login