The algorithm

whistled_small5.JPG
As already mentioned, the algorithm I implemented is fairly simple and I'm sure you'll find many ways to improve it ;-) .
Anyway, one of the (many) advantages of working with the computed sound frequencies rather than the sound itself is that you can recognize a word said in different voice tones.
However, it may only work with the user that taught the word to the 'whistled' (should I rename this project?), as each person has its own way of saying a particular word.

The source code

As I needed additional space, I used the 2kB FlexRAM located on the K10 between 0x14000000 and 0x17FFFFFF (.bss3 section in the source code).
It is therefore used to store the recorded template word and a buffer containing the last computed FFTs.
All the source code is available here, so you can take your SWD programmer out of your dusty drawer ;-) .

Some reminders for the whistled tinkerers

For those who aren't going to use 12V LEDs with the whistled, I'd like to remind you a few things :-) .
- If you are going to connect a motor, don't forget to add a flyback diode:
Flyback diode
- The mosfetN on the board can only handle 25V, so if you want to switch a bigger device (no dimming), you can use a relay:
Relay connection
If you'd like a simple relay board, please drop me a message. In this case maybe I could add a tindie listing for it.
Finally, if you'd like to dim bigger DC loads (with dimming), you can always cascade another mosfet at the whistled output, one that can handle a higher Vds.

Where to get your whistled

Whether you'd like to put your custom sound recognition algorithm or just use the already programmed whistle detection functionality, you can find all my different listings on my tindie page:

Cheers!