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 🙏🙏
No description
No description
No description
18 Replies
…Aarav…
…Aarav…OP•7d ago
I can’t really share the code for a couple hours…
MaderDash
MaderDash•7d ago
only ask in one place.
…Aarav…
…Aarav…OP•7d ago
Sry😢
MaderDash
MaderDash•7d ago
still waiting on a reply. this is exactly why we dont multi post. still waiting
…Aarav…
…Aarav…OP•7d ago
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
MaderDash
MaderDash•7d ago
this is on a ESP?
…Aarav…
…Aarav…OP•7d ago
Ye It’s MicroPython
MaderDash
MaderDash•7d ago
yeh thats one issue, get rid of that, and just code it stock.
…Aarav…
…Aarav…OP•7d ago
Micropython is the Issue or one of them?
MaderDash
MaderDash•7d ago
too many factors, there is a reason why we dont use MP. ITs not good.
…Aarav…
…Aarav…OP•7d ago
K But, can the module detect different levels of volume? And I gtg,
MaderDash
MaderDash•7d ago
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
// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 34;

// variable for storing the potentiometer value
int potValue = 0;

void setup() {
Serial.begin(115200);
delay(1000);
}

void loop() {
// Reading potentiometer value
potValue = analogRead(potPin);
Serial.println(potValue);
}
// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 34;

// variable for storing the potentiometer value
int potValue = 0;

void setup() {
Serial.begin(115200);
delay(1000);
}

void loop() {
// Reading potentiometer value
potValue = analogRead(potPin);
Serial.println(potValue);
}
Try this.
…Aarav…
…Aarav…OP•7d ago
C++? And thanks for taking your time to write me an code 🧑‍💻👍
MaderDash
MaderDash•7d ago
of course. CPP Theres no neeed in usingnything else.a
…Aarav…
…Aarav…OP•7d ago
Thx What does it do ? I’m new to cpp All I under stand is storing an pot
MaderDash
MaderDash•7d ago
same thing yours does except it shows it on the plotter. Look you wrote the python code right? @Aaravgohst
…Aarav…
…Aarav…OP•7d ago
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 !

Did you find this page helpful?