VM-CLAP1 πŸ‘ sensor + gpiozero on Raspberry Pi

Well, that was easy!

Since the Verbal Machines VM-CLAP1 sensor is an open collector type β€” that is, it sinks current when triggered β€” it behaves like a simple button to gpiozero, the Raspberry Pi Python GPIO library. If you attach a callback function to the sensor’s when_pressed event, your Python script will call that function every time it registers a clap.

The wiring is as simple as it could be:

 VM-CLAP1: Raspberry Pi:
Β ========= =============
Β      GND β†’ GND
Β      PWR β†’ 3V3
Β      OUT β†’ GPIO 4

This example code just prints clap! when the board picks up a πŸ‘:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Raspberry Pi gpiozero test for
# Verbal Machines VM-CLAP1 clap sensor
#   scruss - 2017-06
#
# Wiring:
#
#  VM-CLAP1:    Raspberry Pi:
#  =========    =============
#    GND     β†’   GND
#    PWR     β†’   3V3
#    OUT     β†’   GPIO 4

from gpiozero import Button
from signal import pause

def clapping():
        print("clap!")

clap = Button(4)
clap.when_pressed = clapping
pause()

This is a trivial example, but at least it shows that anything you can do with a button, you can also do with this hand-clap sensor.

1 thought on “VM-CLAP1 πŸ‘ sensor + gpiozero on Raspberry Pi”

  1. so guess who noticed that I accidentally had used “hand wave” instead of “hand clap” emoji in the article? Around me, a hand wave sensor would be 100% redlined all the time …

Leave a Reply

Your email address will not be published. Required fields are marked *