Henglos IO
Built-in packages

Sound Sensor

A microphone module with a comparator (KY-037 / KY-038 and the like — AO, DO, +, G): Read gives how loud it is, Detect branches Loud or Quiet, and Sound Trigger runs a branch on a sound — a clap, a knock.

A microphone module with a comparator (KY-037 / KY-038 and the like — AO, DO, +, G): Read gives how loud it is, Detect branches Loud or Quiet, and Sound Trigger runs a branch on a sound — a clap, a knock.

@henglosio/component-soundsensorv1.0.0platform ^1.0.0
NodeKindWhat it does
Sound TriggerTriggerRuns its branch on a sound — a clap, a knock — then waits Cooldown before it can fire again.
ReadActionHow loud it is — level from 0 to 100 % (how far the microphone's signal swung over Window), and loud once it reaches Threshold or the module's DO is on.
DetectActionBranches Loud or Quiet — level past Threshold over Window (Analog Pin), or the module's DO on (Digital Pin); either, with both.

Triggers

Sound Trigger

Runs its branch on a sound — a clap, a knock — then waits Cooldown before it can fire again. With a Digital Pin, the module's DO is caught the moment it flips (nothing is missed); without one, Analog Pin is listened to every Interval.

A trigger: no input, one Out — the first action of its branch.

Settings

SettingTypeDefaultWhat it's for
Digital PinPin (digital in)—Board pin wired to the module's DO — the best for short sounds; set its threshold with the module's trimpot. Empty to listen on Analog Pin.
Analog PinPin (analog in)GPIO39Board pin wired to the module's AO — used when there's no Digital Pin.
ThresholdNumber (1 to 100)30The level that counts as loud, in % — 1 to 100. With Analog Pin.
CooldownNumber (from 0)300How long after a sound before it can fire again, in ms — one clap and its echo are one run.
ActiveOne of: High, LowHighAdvanced. Which DO level means sound — High on most modules (its LED lights up with it), Low on some.
WindowNumber (1 to 200)20Advanced. With Analog Pin, how long each listen is, in ms — 1 to 200. It holds the board that long, so keep it short.
IntervalNumber (from 10)100Advanced. With Analog Pin, how often it listens, in ms — 10 at least.
Full ScaleNumber (1 to 65535)16384Advanced. The swing (peak, 0 to 65535) that counts as 100 % — lower it if loud sounds barely move level; raise it if level is stuck at 100.

Publishes

OutputTypeWhat it is
levelfloatHow loud, 0 to 100 % of Full Scale — with Analog Pin.
loudboolAlways true — it fired on a sound.
atintWhen the sound came — the board's clock, in ms.

Actions

Read

How loud it is — level from 0 to 100 % (how far the microphone's signal swung over Window), and loud once it reaches Threshold or the module's DO is on.

Settings

SettingTypeDefaultWhat it's for
Analog PinPin (analog in)GPIO39Board pin wired to the module's AO — how loud. An analog input; GPIO32-39 keep working with Wi-Fi on. Empty to use DO only.
Digital PinPin (digital in)—Board pin wired to the module's DO — on past the threshold set on its trimpot (detected). Optional.
ThresholdNumber (1 to 100)30The level that counts as loud, in % — 1 to 100. With Analog Pin.
WindowNumber (5 to 1000)50Advanced. How long it listens, in ms — 5 to 1000. Longer catches a sound that comes and goes; it holds the flow that long.
Full ScaleNumber (1 to 65535)16384Advanced. The swing (peak, 0 to 65535) that counts as 100 % — lower it if loud sounds barely move level; raise it if level is stuck at 100.
ActiveOne of: High, LowHighAdvanced. Which DO level means sound — High on most modules (its LED lights up with it), Low on some.

Publishes

OutputTypeWhat it is
levelfloatHow loud, 0 to 100 % of Full Scale — with Analog Pin.
peakintHow far AO swung over Window, 0 to 65535 — to set Full Scale. Near 0 in silence.
detectedboolWhether the module's DO is on — with Digital Pin.
loudboolWhether level reached Threshold, or DO is on.
errorstrno_pin when neither pin is set; empty otherwise.

Detect

Branches Loud or Quiet — level past Threshold over Window (Analog Pin), or the module's DO on (Digital Pin); either, with both.

Ends on Loud, Quiet — or Fallback when it can't run.

Settings

SettingTypeDefaultWhat it's for
Analog PinPin (analog in)GPIO39Board pin wired to the module's AO — how loud. An analog input; GPIO32-39 keep working with Wi-Fi on. Empty to use DO only.
Digital PinPin (digital in)—Board pin wired to the module's DO — on past the threshold set on its trimpot (detected). Optional.
ThresholdNumber (1 to 100)30The level that counts as loud, in % — 1 to 100. With Analog Pin.
WindowNumber (5 to 1000)50Advanced. How long it listens, in ms — 5 to 1000. Longer catches a sound that comes and goes; it holds the flow that long.
Full ScaleNumber (1 to 65535)16384Advanced. The swing (peak, 0 to 65535) that counts as 100 % — lower it if loud sounds barely move level; raise it if level is stuck at 100.
ActiveOne of: High, LowHighAdvanced. Which DO level means sound — High on most modules (its LED lights up with it), Low on some.

Publishes

OutputTypeWhat it is
levelfloatHow loud, 0 to 100 % of Full Scale — with Analog Pin.
peakintHow far AO swung over Window, 0 to 65535 — to set Full Scale. Near 0 in silence.
detectedboolWhether the module's DO is on — with Digital Pin.
loudboolWhether level reached Threshold, or DO is on.

On this page