---
title: "Making a Clap-Sensing Web Thing"
description: "A clap-activated light controller is built as a JavaScript add-on for Mozilla's Project Things Gateway, using a USB microphone on a Raspberry Pi as a binarySensor Web Thing."
url: "https://swe.quest/articles/making-a-clap-sensing-web-thing-2c17550a76ff9774"
canonical: "https://hacks.mozilla.org/2018/02/making-a-clap-sensing-web-thing/"
source: "Mozilla Hacks"
published: "2018-02-22"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["javascript"]
---

# Making a Clap-Sensing Web Thing

A post on [Mozilla Hacks](https://swe.quest/sources/mozilla-hacks.md), published 2018-02-22, 6 min read, How-to. Original: [https://hacks.mozilla.org/2018/02/making-a-clap-sensing-web-thing/](https://hacks.mozilla.org/2018/02/making-a-clap-sensing-web-thing/)

## Summary

A clap-activated light controller is built as a JavaScript add-on for Mozilla's Project Things Gateway, using a USB microphone on a Raspberry Pi as a binarySensor Web Thing. The walkthrough forks the example-adapter, renames its classes to ClapSensor and ActiveProperty, and wires the clap-detector npm library (which depends on sox) so that each detected clap toggles the sensor's active property and notifies the Gateway. It ends with restarting the Gateway service, debugging via run-app.log, and creating a Gateway rule that switches a light on when the sensor becomes active.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- JavaScript and Node.js basics ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- Raspberry Pi setup

## Keywords

Project Things Gateway, Web of Things, clap-detector, sox, Raspberry Pi, Mozilla IoT

## Related posts

- [Light Up Your Builds with Render Webhooks](https://swe.quest/articles/light-up-your-builds-with-render-webhooks-cb1958e456f90033.md): Render · 2025-09-16 · Medium · 4 min read · Deployment, Hardware, API design
  A Raspberry Pi Pico W–driven 32×32 LED panel lights up with distinct animations whenever Render webhook events fire for build\_started, build\_ended, deploy\_started and deploy\_ended.
- [Run OpenClaw (Formerly Moltbot and Clawdbot) in a Sprite](https://swe.quest/articles/run-openclaw-formerly-moltbot-and-clawdbot-in-a-sprite-e675a6ce4227de15.md): Fly.io · 2026-01-26 · Medium · 3 min read · AI agents, Sandboxing & isolation, Serverless
  OpenClaw, the open-source AI assistant formerly called Clawdbot and Moltbot, can run inside a Fly.io Sprite, a hardware-isolated, stateful Linux sandbox, so the agent can have broad permissions without a dedicated Mac Mini.
- [Slack Bots on Sprites: OAuth is Easy Now](https://swe.quest/articles/slack-bots-on-sprites-oauth-is-easy-now-b82e289ea1ba6759.md): Fly.io · 2026-01-27 · Medium · 2 min read · Serverless, Identity & auth, JavaScript
  Fly.io Sprites remove the usual hassle of hosting a Slack bot's OAuth flow by giving each bot a public URL, a persistent filesystem for storing tokens, and automatic hibernation and wake.
- [Kitesurf is now open source](https://swe.quest/articles/kitesurf-is-now-open-source-47724e4bcd0ac7e3.md): Cloudflare · 2026-11-13 · Easy · 3 min read · Browsers, AI agents, Serverless, WebAssembly, Open source
  Kitesurf, Cloudflare's stateless browser for AI agents built on Workers, is now open source under Apache 2.0.
- [Introducing Search for Agents](https://swe.quest/articles/introducing-search-for-agents-37be0b6470822ab9.md): Cloudflare · 2026-11-25 · Medium · 6 min read · AI agents, Search, RAG & retrieval, CDN & edge
  Search for Agents is a one-toggle Cloudflare zone feature that automatically creates an AI Search instance, crawls and indexes the site, and exposes a search endpoint at /.well-known/search on the customer's own domain.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
