Jonah Samuels
Published © GPL3+

Lane Tech PCL - Washing Machine Monitor

A solution to let me know when my laundry is done

IntermediateWork in progress143
Lane Tech PCL - Washing Machine Monitor

Things used in this project

Hardware components

Argon
Particle Argon
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1

Software apps and online services

Pushover

Story

Read more

Schematics

Argon Schematic

Code

washing_machine_monitor

Python
import cv2 
import pytesseract 
import time 
from pushover import init, Client 
import requests

pushoverAPI = "" #pushover api key
clientID = "" #pushover client ID
particleCall = "" #particle argon integration link
frame_rate = 10 #preview frame rate (fps)


def main():
    #init pushover 
    init(pushoverAPI)
    #init cv2 
    cap = cv2.VideoCapture(0) 
    prev = 0 
    fps = cap.get(cv2.CAP_PROP_FPS) 
    print("CAMERA FPS: " + str(fps))

    while True:
        time_elapsed = time.time() - prev 
        res, image = cap.read() 
        #weird fps limit thing 
        if time_elapsed > 1./frame_rate:
            prev = time.time() 
            cv2.imshow("Frame", image) 
            text = pytesseract.image_to_string(image).lower() 
            print("INPUT: " + text) 
            pText = text[text.find("end") : text.find("end") + 3] 
            print("OUTPUT: " + pText) 
            if (pText == "end"):
                #notification 
                Client(clientID).send_message("Your laundry is done!", title="Washing Machine Monitor") 
                #particle 
                requests.post(particleCall) 
                #wait
                break 
            if cv2.waitkey (1) & 0xFF == ord ("s"):
                print("stopped")
                break 
    cv2.destroyAllWindows()
if __name__== "__main__":
    main()

argon_led

C#
int ledPin = 2;
bool lightCheck = false;

void setup() 
{
    pinMode(ledPin, OUTPUT);
    Particle.function("washing_machine", washingMachine);
}

void loop() 
{

}

int washingMachine(String param) 
{
    if (!lightCheck) 
    {
        digitalWrite(ledPin, HIGH);
        lightCheck = !lightCheck;
    }
    else 
    {
        digitalWrite(ledPin, LOW);
        lightCheck = !lightCheck;
    }
    return -1;
}

Credits

Jonah Samuels

Jonah Samuels

1 project • 0 followers

Comments

Add projectSign up / Login