LM393 mic dev boards be used for Music Visualizer?
I have 2 LM393 mic đ¤ based dev boards, I want to make an 5 led visualizer, by taking the decibel the mic measures, and comparing it to a set threshold to turn on the LEDs. But when I tried the code, the mic was not picking up anything. I tried both modules, the codes de-bug points where not picking up anything displayed in the serial monitor, the connections where fairly secure. I need help determining if these modules canât be used, or if there is something wrong with my code. Any help would be greatly appreciated đđ



18 Replies
I canât really share the code for a couple hoursâŚ
only ask in one place.
Sryđ˘
still waiting on a reply. this is exactly why we dont multi post. still waiting
from machine import Pin, ADC
import time
mic = ADC(Pin(34))
mic.atten(ADC.ATTN_11DB) # Full range 0-3.6V
leds = [Pin(5, Pin.OUT), Pin(18, Pin.OUT), Pin(19, Pin.OUT), Pin(21, Pin.OUT), Pin(23, Pin.OUT)]
while True:
value = mic.read() # 0-4095
print("Mic value:", value)
# Map analog value to 0-5 LED level if value < 200: # ambient noise threshold level = 0 elif value < 1000: level = 1 elif value < 1500: level = 2 elif value < 2000: level = 3 elif value < 2500: level = 4 else: level = 5 for i in range(5): if i < level: leds[i].on() else: leds[i].off()
time.sleep_ms(50) i had to get the code from my compter and its 10 years old so it took me an while
# Map analog value to 0-5 LED level if value < 200: # ambient noise threshold level = 0 elif value < 1000: level = 1 elif value < 1500: level = 2 elif value < 2000: level = 3 elif value < 2500: level = 4 else: level = 5 for i in range(5): if i < level: leds[i].on() else: leds[i].off()
time.sleep_ms(50) i had to get the code from my compter and its 10 years old so it took me an while
this is on a ESP?
Ye
Itâs MicroPython
yeh thats one issue, get rid of that, and just code it stock.
Micropython is the Issue or one of them?
too many factors, there is a reason why we dont use MP.
ITs not good.
K
But, can the module detect different levels of volume? And I gtg,
Then you shouldent ask if you dont have time to work on it.
When you get proper code running then you can record db level changes within reason, you will need to map it over to DB so you will need a decimogphr, and a known sourceting running and do a proper map.e
Try this.
C++?
And thanks for taking your time to write me an code đ§âđťđ
of course. CPP
Theres no neeed in usingnything else.a
Thx
What does it do ?
Iâm new to cpp
All I under stand is storing an pot
same thing yours does except it shows it on the plotter.
Look you wrote the python code right?
@Aaravgohst
Umm my goofy ahh WiFi messed up this msg
Ok thanks for all the help youâve given so me! It saved me hours of google digging to get just a better answer. Thank you !