Using Max to sense audio and communicate with Arduino:
In this Approach we use a small app made in Max MSP as a way to sense audio, smooth it and boost it with real time controls. The app then communicates with Arduino via serial and we can use it to control a servo motor.
Using a sound detector module digitally, i.e. sensing when sound goes over a threshold:
This approach makes use of a sound detector module to sense when sound goes over a threshold and trigger an animation in our servo motor, all done in Arduino. I used a Keyes Sound detector module and connected the 'D0' pin to pin 2 on the Arduino (the circuit diagram shows the Sparkfun sound module which should work too!)
Using a sound detector module analog input, i.e. sensing the actual sound level:
This approach makes use of a sound detector module to sense the actual sound level and control our servo motor, all done in Arduino. I used a Keyes Sound detector module and connected the 'A0' pin to our analog input 0 pin on the Arduino.
Its not an ideal sketch, its jerky because of the large sample window width, but twitchy with a shorter window. I'm sure there is a better way to smooth or filter the audio sensor input, but this was a quick attempt! A bit more research required...
Using the motor shield to control a solenoid:
A solenoid just has binary control, it is on or off. We can control it with the motor control shield just like a DC motor in the example from Adafruit, but we do not need speed control. The sketch below simply turns the solenoid on and off once a second.