Can we use the speaker as Mic to trigger light?

Just an Idea… thoughts ?

My initial reaction would be a simple no, as nothing is designed to listen to audio as an input.
However, speakers do produce variable signal (they can work as a mic, as mics can also functions as speakers) so the thought occurs that maybe something about TouchButton input support would allow for sensing a variance?
Not a conventional use of course, but somewhat intriguing.

short answer: no (with caveats, see long answer)

long answer:

First problem is that the speaker isn’t hooked up to anything that can read from it. The amplifier may have some feedback information, but there is no way to get that information out from the amplifier. The solution would be to hook the speaker up to something in addition to the amplifier.

Second problem is that speakers are poor microphones, and the signal they generate are very low. (That’s technically true for any microphone though.) What this means is that you almost certainly need to amplify the signal from the speaker before sampling it. Also, that amplifier needs to have some decoupling filters, otherwise he amplifier or the cpu would fry when we play audio through speaker (which is hundreds or thousands of times higher voltage than the signal we get from the speaker.) Creating such an amplifier is not hard, a few resistors, capacitors and an op-amp would be enough to do the trick. Of course, it might be simpler to just use a separate microphone, especially one that has a builtin amplifier.

The third problem is memory. A V2 board has 64k of ram, and a good chunk is already spoken for. Let’s say we could reseve 20k RAM for audio, that only lets us sample ~1/3rd of a second at phone quality. (8-bit 8k uLaw) Not enough to store a phrase for analysis. A V3 board can do better. It has 160k RAM, so we can use up to 120k or so of RAM for audio samples, which could potentially store about 2 seconds. 2 seconds might even be enough.

FOURTH problem is cpu time. Voice recognition takes a silly amount of multiplications to do. I think our poor little 80Mhz CPU might struggle a bit to do that. It also tends to take a good chunk of flash memory for the model, plus more ram for the intermediate results. Since the speaker will be useless as a microphone when the saber is on, this would only work while the saber is off, which may help. (We don’t use as much CPU time when the saber is off.)

But other than that it’s totally possible…

Now that I read it again, I don’t know if you meant voice recognition or some other kind of audio control though…

Yeah, I took it to mean NOT connected to the speaker pads, instead being a seperate speaker just functioning like “The Clapper”
Like something happens with a loud sound hahaa.

1 Like
#define CLAP_ON
#define CLAP_OFF


1 Like