0
\$\begingroup\$

I am working on detecting the amplitude of a signal coming from a guitar pickup. I am using an esp32 and an LM386 module for amplifying the signal.

I get quite stable readings with a multimeter, but the readings on the Arduino IDE show peaks and also peaks come when no signal should be there.

Arduino IDE Readings

Here is a link for short videos of both the esp32 readings and the multimeter:

https://drive.google.com/drive/folders/1gpvkN_sz627jG0TNPpUps82105EB89OF?usp=sharing

Thanks!

Simple code:

int ampedVoltagePin = 12;

void setup() {
  pinMode(ampedVoltagePin, INPUT);
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(ampedVoltagePin));
  delay(100);
}

Diagram:

Diagram

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

0.1 Hz is not enough to measure audible frequencies. You need to get at least double the sampling frequency for the signal you measure. See also: https://en.wikipedia.org/wiki/Nyquist_frequency

Say you have 500 Hz, then you need to sample at least 1000 Hz, or 1 ms. Then you can attempt peak detection.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.