This circuit is designed to read analog signals from two KY-037 microphones, process them through a Sparkfun Configurable OpAmp Board (TSH82), and perform basic noise cancellation using an Arduino UNO. The processed signal is then printed to the Serial Monitor. This setup is a basic example and does not represent a true adaptive filter. For effective noise cancellation, a more sophisticated algorithm like the Least Mean Squares (LMS) algorithm should be implemented.
Arduino UNO
KY-037 Microphone (Primary)
KY-037 Microphone (Reference)
Sparkfun Configurable OpAmp Board - TSH82
3.3V connected to:
5V connected to:
GND connected to:
A0 connected to:
A1 connected to:
D1 connected to:
D0 connected to:
VCC connected to:
Ground connected to:
Analog output connected to:
Digital output connected to:
VCC connected to:
Ground connected to:
Analog output connected to:
Digital output connected to:
VCC connected to:
VNEG connected to:
OUT1 connected to:
OUT2 connected to:
+IN1 connected to:
+IN2 connected to:
/*
* This Arduino sketch reads analog signals from two KY-037 microphones,
* processes them through an op-amp, and attempts a basic noise cancellation
* by subtracting the reference signal from the primary signal. The result is
* printed to the Serial Monitor. This is a basic example and does not represent
* a true adaptive filter. For effective noise cancellation, a more sophisticated
* algorithm like the Least Mean Squares (LMS) algorithm should be implemented.
*/
const int mic1Pin = A0; // Primary microphone signal
const int mic2Pin = A1; // Reference microphone signal
const int mic1DigitalPin = 1; // Digital output from primary mic
const int mic2DigitalPin = 0; // Digital output from reference mic
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(mic1DigitalPin, INPUT); // Set digital pin for primary mic as input
pinMode(mic2DigitalPin, INPUT); // Set digital pin for reference mic as input
}
void loop() {
int primarySignal = analogRead(mic1Pin); // Read primary mic analog signal
int referenceSignal = analogRead(mic2Pin); // Read reference mic analog signal
// Basic noise cancellation by subtracting reference from primary signal
int filteredSignal = primarySignal - referenceSignal;
// Print the filtered signal to the Serial Monitor
Serial.println(filteredSignal);
delay(10); // Short delay for stability
}
This code initializes the Arduino UNO to read analog signals from two KY-037 microphones and perform basic noise cancellation by subtracting the reference signal from the primary signal. The filtered signal is then printed to the Serial Monitor.