note: before you doing this project i want to tell you that this circuit is not works on proteus since proteus do not have any microphone input . But this cicuit is fully tested on real hardware and the code shown below is compiled using atmel studio 6 .Please use 10K resistor from reset to vcc i have forget there .
This is simple sound level meter using 10 bar bargraph display and interfaced with attiny85 microcontroller . Attiny85 is avr family microcontroller and is very useful in many project . This reserve less space on printed circuit board and highly compatable with mini projects .In this project the microcontroller takes input from the microphone and amplifies its output signal and process and and then convert it to logarithmic value and finally represents it using bar graph display .
This project used similar concept of analog to digital conversion as we have did our previous tutorial . This microcontroller also have 10 bit resolution of ADC , that means you can measure 0-1024 levels .If you do not know what is analog to digital conversion and how it can be done with AVR family please go to this link and there you will find a good tutorial about the analog to digital conversion , and then after do some cool projects like thermometer, voltmeter then you will have idea how you can do analog to digital conversion on AVR family.
Another cool thing with this project is logarithmic conversion function int LogBar (unsigned int x) ; Basically this function convert the result of 10 bit ADC to the logarithmic value . Let's say the output signal from the ADC is maximum ie 1024 but it is hard to represent this value on bar graph so by using the log(1024)=10 in binary it is 1111111111 that means 10 bar on display glows . Similarly equivalent binary of decimal value 9 is 1001 which has a bit-width of 4, so log29 = 4 so the logarithmic value of 9 is 4 and hence 4 bar is displayed on bar graph . I hope you understood why this function is used to represent value on bar graph .
That's all about new thing in this project . If you have any question about this project please feel free to post comment below . i will try to solve where you have stuck .