# Overview
**Give your projects the gift of hearing with the Lonely Binary TinkerBlock TK27 Analog Mic Sensor!** This compact and versatile module is designed to capture sound from its environment, transforming acoustic vibrations into an electrical signal that your microcontroller can understand. Perfect for voice-activated controls, sound-reactive lighting, audio analysis, or even simple noise detection, the TK27 opens up a new dimension of interaction for your creations.
The TK27 features an analog output, providing a continuous, fluctuating voltage that directly corresponds to the intensity and pattern of the sound it picks up. This analog nature allows for a nuanced understanding of audio, letting you detect not just the presence of sound, but also its relative loudness and characteristics. With its straightforward GND, VCC, and Analog Signal pinout, integrating the TK27 into your Arduino, ESP32, Raspberry Pi, or other microcontroller projects is quick and easy. Start building projects that listen and respond to the world around them!

**Key Features:**
- **Analog Sound Detection:** Captures sound and outputs a varying analog voltage signal.
- **Real-time Audio Input:** Provides immediate feedback on sound levels and patterns.
- **Versatile Applications:** Ideal for sound-activated switches, audio visualization, noise monitoring, and interactive sound experiences.
> Analog
# Pinout
| Pin | Function |
| ------ | ------------- |
| GND | Ground |
| VCC | VCC |
| NC | Not Connected |
| Signal | Analog |
# Dimensions

# Sample Code
This Arduino code reads analog input from a microphone sensor connected to pin A3. It sets a `soundDetectionThreshold` and, if the raw microphone reading exceeds this threshold, it prints a "Sound detected!" message along with the raw analog value to the Serial Monitor. A brief delay is included after detection to prevent message
``` cpp
// Define the analog pin connected to the TK27 Analog Mic Sensor's Signal pin.
// Using a descriptive constant makes the code more readable and maintainable.
const int micSensorPin = A3;
// Define a threshold value for sound detection.
// This value (0-1023) will determine when sound is considered "detected".
// You may need to adjust this value based on your environment's ambient noise
// and the sensitivity of your specific TK27 sensor.
const int soundDetectionThreshold = 600; // Example threshold, adjust as needed
// Define a delay duration in milliseconds after a sound detection message.
// This helps prevent rapid-fire messages in the Serial Monitor when sound is continuous.
const int detectionMessageDelay = 300; // milliseconds
void setup() {
// Initialize serial communication at a baud rate of 9600.
// This allows the Arduino to send data (sound detection status and raw readings)
// back to your computer's Serial Monitor for monitoring and debugging.
Serial.begin(9600);
// Configure the microphone sensor pin as an INPUT.
// This prepares the pin to receive analog voltage signals from the sensor.
pinMode(micSensorPin, INPUT);
}
void loop() {
// Read the raw analog value from the microphone sensor pin.
// The analogRead() function converts the analog voltage (0-5V) into a digital value (0-1023).
// This value will fluctuate with the intensity and pattern of sound.
int rawMicValue = analogRead(micSensorPin);
// Check if the raw microphone value exceeds the defined sound detection threshold.
// When sound is present, the analog output of the mic sensor typically fluctuates more,
// and its peak values might cross this threshold.
if (rawMicValue > soundDetectionThreshold) {
// If sound is detected, print a message to the Serial Monitor.
Serial.print("Sound detected! Raw Value: ");
Serial.println(rawMicValue);
// Introduce a delay after printing a detection message.
// This prevents the Serial Monitor from being flooded with messages if the sound
// is prolonged or consistently above the threshold.
delay(detectionMessageDelay);
}
// Optional: You might want to add a small delay here even if no sound is detected
// to control the loop speed and prevent constant, rapid readings, though for
// simple sound detection, it's often not strictly necessary if 'detectionMessageDelay'
// handles the primary output rate.
// delay(10); // Uncomment and adjust if you want a consistent loop delay.
}
```
# Product Link
For product support, manuals, tutorials, and sample code, please visit our product page to access comprehensive resources.
[https://lonelybinary.com/products/tk27](https://lonelybinary.com/products/tk27)
# Support
If you encounter any issues, please go to [https://lonelybinary.com ](https://lonelybinary.com ) and click the Support button located in the bottom right corner. Our team is ready to assist you.
[](https://lonelybinary.com)
# Thank You
Thank you for choosing TinkerBlock to fuel your passion for STEM! Whether you’re a student diving into coding, an educator shaping future innovators, a hobbyist bringing your vision to life, or a business seeking cutting-edge solutions, TinkerBlock empowers you to create, learn, and innovate.
**For school orders, wholesale inquiries, or custom business solutions, please contact us to discuss your specific needs.**
[office@lonelybinar.com](office@lonelybinary.com)
> **Unleash Your Creativity with TinkerBlock – Where Coding Meets the Real World!**
TinkerBlock UNO R3 Starter Kit
Dive into the world of electronics, Arduino programming, and STEM projects with the Lonely Binary TinkerBlock Series Starter Kit.
- Choosing a selection results in a full page refresh.