Unit B · What your device can sense
What we are making: a page showing the loudest sound in the last moment — and a lesson in why that is harder than it sounds.
Sound is a vibration. Read the microphone once and you catch the wave wherever it happens to be — possibly at zero, in the middle of a shout. Read it once a second and you will miss almost everything.
So the program reads it two hundred times in a fifth of a second and keeps only the biggest. That is called peak detection, and it is how every sound meter works.
| What you see | Why | What to do |
|---|---|---|
| Number is always about the same | The sensitivity screw is at one end. | Turn it slowly with a small screwdriver while watching the readings. |
| Always reads 4095 | Sensitivity too high, or wired to 5V. | Turn the screw down. Use 3.3V. |
| A clap does not register | Too few samples. | Raise the loop count. A clap is very short. |
| The page takes ages to load | You are sampling for too long. | That is the trade-off. Find a length that catches claps and still feels quick. |
In this session