pimoroni / grow-python

Python libs for controlling the Grow HATs
MIT License
55 stars 44 forks source link

Increase frequency of beeps to improve loudness #12

Open kevinjwalters opened 3 years ago

kevinjwalters commented 3 years ago

There's an observation in Pimoroni Forums: Grow kit feedback

The piezo alarm is, in my opinion, very quiet. I will definitely not notice it chirping about dry soil from the other side of our busy kitchen.

I don't have an unboxed grow board to test this with but I suspect you are using a small piezo buzzer which performs at higher frequencyes (2-3 kHz) in terms of loudness but the code currently shows a liberal sprinkling of 440Hz. That's a useful referernce (A4) but may not be a good choice for producing a beep that's audible at a distance even with its square wave harmonics.

https://github.com/pimoroni/grow-python/blob/bc5fec56c69fdef26f9f47660df3d892a377a04c/examples/monitor.py#L786

And

https://github.com/pimoroni/grow-python/blob/bc5fec56c69fdef26f9f47660df3d892a377a04c/library/grow/__init__.py#L14

https://github.com/pimoroni/grow-python/blob/bc5fec56c69fdef26f9f47660df3d892a377a04c/library/grow/__init__.py#L45

Those two could also be a single variable rather than two independent values.

I don't know if there's already use of different perodic beeping to indicate different emergency conditions but frequency could also be a part of this using the frequency to effectively increase volume, i.e. as it gets drier beep at 550, 1100, 2200Hz.

tomgidden commented 2 years ago

For what it's worth, I tried changing the frequencies a LOT, but it didn't make much difference. I too thought it would just be a matter of finding the right frequency for the particular sounder.

Saying that, my 9yo kid could hear the (default) beeping from across the room.

kevinjwalters commented 2 years ago

My recollection is you can barely here C3 (263.74) on a transistor amped 5mm speaker but C6 and C7 are strangely loud at least in a relative sense. The Adafruit CLUE has this setup on the reverse-side of the board.

The CUI CMT-0503-75-SMT-TR might be comparable, the frequency response from datasheet is shown below:

CUI-CMT-0503-75-SMT-TR-datasheet-frequencyresponse

These devices often have a resonant frequency where it gets very loud. I'm not sure if it's healthy for the device to deliberately use that.