VM-CLAP1 👏 sensor + gpiozero on Raspberry Pi

June 19, 2017

Last week I wrote about how easy it was to interface the Verbal Machines VM-CLAP1 sensor to an Arduino: Clap on 👏👏, Clap off 👏👏 . This week, I thought I'd show you how to use it with a Raspberry Pi.

Since the 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():
clap = Button(4)
clap.when_pressed = clapping


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.

(This article first appeared on the author's personal blog.)

Leave a comment

Comments will be approved before showing up.

Also in News

The Raspberry Pi Pico
The Raspberry Pi Pico

July 28, 2021

Raspberry Pi Pico’s are a great microcontroller that has a fair amount of range, despite the slightly more tricky set up process, once it’s ready to go there’s a lot you can do. 

Continue Reading

Raspberry Pi Troubleshooting

June 30, 2021

Continue Reading

An introduction to soldering
An introduction to soldering

June 08, 2021

Soldering is a good skill to learn and improve throughout your making and DIY-ing, there’s quite a few situations where it will be the best option for a more permanent build.

Continue Reading