20140703b PWM with Oscope and Tone Generator, Piezo Buzzer, Microphone Amplifier.
3 small projects, 2 of which turn out to be related to each other, A quick demo of PWM using an Oscilloscope and voltage meter. The other is a demo of a Piezo buzzer, using PWM to produce a tone. The 2nd will be a little more understanable after the 1st :-) PWM is a way to produce a voltage using a digital pin, there are a couple of different ways to do this, Any pin can be used for PWM using what is called bit-banging which is turning a pin on and off very quickly. The speed and duration of how long the pin is on determines what the output voltage is going to be. It’s all a little bit of magic if you ask me.
Here is a link to Super Mario Theme song sketch: https://codebender.cc/sketch:37932
The orignal mario project can be found here: http://www.princetronics.com/supermariothemesong/
The 3rd project is a very simple microphone demo, the mic is this:
According to the website the mic is
High sensitivity; The module has two outputs: AO, analog output, real-time output of the microphone voltage signal / DO, when the sound intensity reaches a threshold, the output high and low signal threshold - Sensitivity potentiometer adjustment
And in the simplest form it’s a switch, when the sound meets a certain level set by the variable resistor, then it puts an output on output pins. I simply took a sketch from Adafruit that was written for use with a physical switch, and put the mic in the switches spot. it turns a LED on. Pretty simple, no libraries were used.
Sketch can be found here: https://codebender.cc/sketch:37939
The AdaFruit Tutorial can be found here: http://www.ladyada.net/learn/arduino/lesson5.html
We may have to setup a video or something for the PWM demo, I think I can explain what it’s doing, but not sure if I can write it down and explain it any better then anyone else on the internet. Now that I see it, it does make since what is going on just to read about it, didn’t make a whole lot of since.