Skip to content

1010Technologies/pxt-makerbit-hc-sr04-clap

Repository files navigation

MakerBit Ultrasonic HC-SR04 Clap Detector

Build Status

MakeCode extension for detecting claps and finger snaps with a modified HC-SR04 ultrasonic sensor.

MakerBit Board

The MakerBit connects to the BBC micro:bit to provide easy connections to a wide variety of sensors, actuators and other components.

http://makerbit.com/

MakerBit MakerBit+R
MakerBit MakerBit+R with motor controller

Clap Detector

An HC-SR04 ultrasonic distance sensor can notify clap and finger snap sounds. Among audible frequencies, claps and snaps contain ultrasonic portions and thus the 40kHz receiver of the HC-SR04 detects them. In order to make this work, it requires a slight hardware modification of the sensor itself. We need to make sure that no other ultrasonic sounds are transmitted and therefore have to cover the transmitter (left cylinder). It turned out that masking tape works well.

HC-SR04

MakerBit onClap

Perform an action when a clap or finger snap is detected.

makerbit.onClap(DigitalPin.P5, DigitalPin.P8, () => {});

Ultrasonic Clap & Snap Example

makerbit.onClap(DigitalPin.P5, DigitalPin.P8, function () {
    basic.showLeds(`
        # # # # #
        # . . . #
        # . . . #
        # . . . #
        # # # # #
        `)
    basic.showLeds(`
        . . . . .
        . # # # .
        . # . # .
        . # # # .
        . . . . .
        `)
})

License

Licensed under the MIT License (MIT). See LICENSE file for more details.

Supported targets

  • for PXT/microbit
  • for PXT/calliope

About

Detect claps and finger snaps with a slightly modified HC-SR04 ultrasonic sensor.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published