Marcel Kruse
Published © GPL3+

Walabot Person Recognizer

Combine the Walabot, Alexa, Raspberry Pi and Computer to measure and recognize people with voice commands!

AdvancedWork in progressOver 1 day2,321

Things used in this project

Story

Read more

Code

Raspberry Pi (Alexa commands --> Serial data)

Python
""" 
    RPi_Walabot.py 
   
    This is a demo python file showing how to take paramaters
    from command line for device name, port, and GPIO.
    All credit goes to https://github.com/toddmedema/echo/
    for making the first working versions of this code.
"""
 
import fauxmo
import logging
import time
import serial
import io
import sys
import RPi.GPIO as GPIO ## Import GPIO library
 
from debounce_handler import debounce_handler
 
logging.basicConfig(level=logging.DEBUG)
 
class device_handler(debounce_handler):
    """Publishes the on/off state requested,
       and the IP address of the Echo making the request.
    """

    TRIGGERS = {"wallabot": 52000,"measurement":51000, "result":53000}

    def act(self, client_address, state, name):
        print("State", state, "from client @", client_address)
        if name=="wallabot":
            ser.write('W')
        elif name =="measurement":
            ser.write("M")
        elif name =="result":
            ser.write("R")        
        else:
            print("Device not found!")

        return True
 
if __name__ == "__main__":
    # Startup the fauxmo server
    fauxmo.DEBUG = True
    p = fauxmo.poller()
    u = fauxmo.upnp_broadcast_responder()
    u.init_socket()
    p.add(u)
    
    ser = serial.Serial(
               port     = '/dev/ttyAMA0',
               baudrate = 115200,
               parity   = serial.PARITY_NONE,
               stopbits = serial.STOPBITS_ONE,
               bytesize = serial.EIGHTBITS,
               timeout  = 1
           )
 
    # Register the device callback as a fauxmo handler
    d = device_handler()
    for trig, port in d.TRIGGERS.items():
        fauxmo.fauxmo(trig, u, p, None, port, d)
 
    # Loop and poll for incoming Echo requests
    logging.debug("Entering fauxmo polling loop")
    while True:
        try:
            # Allow time for a ctrl-c to stop the process
            p.poll(100)
            time.sleep(0.1)
        except Exception as e:
            logging.critical("Critical exception: "+ e.args  )
            break

Windows application

C#
This is a early build... I will update it soon with fixes and additions
No preview (download only).

Windows Application V2

C#
Updated version of the Windows application.
No preview (download only).

Credits

Marcel Kruse

Marcel Kruse

5 projects • 26 followers
Software & Hardware tester at an Embedded Systems company. Studied Electrical Engineering. Follow me on twitter: twitter.com/marcelkruse

Comments