Introduction: Volume Regulator
Attention all librarians and library-lovers!
If you're like us and need some peace and quiet to get some work done, check out Linda, the library monitor. Linda is a volume regulator in disguise! As soon as the room gets too loud it will make sure to voice its concerns. No more being too shy to ask for the person next to you to stop talking, Linda's got you covered!
First, Linda will tell the person to be quiet, but if they persist, it will warn them a few times before it really show it's anger. No one will be able to ignore Linda, it's got quite the perseverance! They'll run out of breath before Linda does.
Supplies
Electronics:
1 x Arduino board
1 x Breadboard
2 x 9V Batteries
1 x Micro Servo Motor SG90
1 x NPN Transistor PN2222
1 x 330 Ω Resistor
2 x Electret Mic MAX9814 amp Auto Gain
1 x SPKME-001338 3W 8 ohm Speaker
1 x microSD Breakout Shifter
1 x 18W TDA2030A Amp
1 x Micro SD Card
Alligator to Jumper Cables
Jumper Wires
Other Materials:
Large Book (e.g. a Dictionary)
Wood Sheet (or other material for laser cutting)
Tape
Super Glue
Tools:
Ruler
Scissors
Xacto Knife
Soldering Iron
Access to a Laser Cutter
Step 1: Audio Setup
Create your own audio files from https://voicegenerator.io/ (using Linda's voice). Alternatively, you can use the attached files.
Bring the audio files into the Audacity app to raise their volumes. Export the audio files as unsigned 8-bit .wav files. You can skip this step if you used the attached files.
Format your SD card (make sure it is fat32 or fat16 format)
Upload the audio files onto the SD card using simple names that can be called upon in the code (e.g. 1.wav)
Step 2: Circuit Setup and Theory
Wire your parts according to the circuit diagram
Sensors:
Microphone
Using a microphone component, the Arduino can measure sounds and bring about actions in accordance with the input it receives. For example, in this project, we intended for the volume of a room to trigger an Arduino’s response.
Audio signals are an alternating current with highly variable waves. The volume or loudness of a sound is directly related to the amplitude of the peaks. A higher amplitude audio signal creates a higher volume sound, and vice versa (Figure 1).
In this project, we will be taking a series of analog reads from the microphone pin in order to plot the fluctuating audio signal. From there, we will use the minimum and maximum values recorded in that series of analog reads to calculate the difference, or delta, between these two peaks. A smaller difference in peaks is indicative of a smaller amplitude of the audio signal waveform, and thus a quieter sound (Figure 2). A greater difference in peaks is indicative of a larger amplitude of the audio signal waveform, and thus a louder sound (Figure 3).
We found the “How to use microphones on the Arduino” page by Circuit Basics very informative and we highly recommend that you give it a read (https://www.circuitbasics.com/how-to-use-microphones-on-the-arduino/).
The breakout board we use is the Adafruit MAX9814 electret microphone amplifier with auto gain control. This board features a 20Hz-20KHz electret microphone and a built-in pre-amplifier. This preamplifier helps adjust the detected audio signal to a level that the Arduino can work with before it is received by the Arduino. For more details on the specification of this microphone, refer to this datasheet: https://cdn-shop.adafruit.com/datasheets/MAX9814.pdf
Actuators:
Motor
A servo motor is a rotary actuator that allows for the precise control of angular positions, velocity and acceleration. For this project, we made use of the Micro Servo Motor SG90, a tiny and lightweight servo motor with high output power. It can rotate 180 degrees and has a stall torque (4.8v) of 1.8kg/cm.
For more details on the specification of this servo motor, refer to this datasheet: https://ullisroboterseite.de/projekte-teedipper/SG90%209%20g%20Micro%20Servo.pdf
Speaker
Speakers are actuators that work by converting electrical energy into mechanical energy, or motion. The mechanical energy pushes and pulls the air surrounding the speaker’s moving coil, compressing it and creating pressure waves, otherwise known as sound.
Audio transducers, such as speakers, are inherently analog. This necessitates the use of Pulse Width Modulation, or PWM, a technique for getting analog results with digital means. This digital-to-analog converter is used to create a square wave of varying widths that simulates the behaviour of an analog wave. Luckily, the Arduino IDE has a built-in function “analogWrite()” which can be easily used to generate a PWM signal that our speaker can understand.
For this project, we used the SPKME-001338 3W 8OHM Speaker.
Step 3: Coding Setup
Use the attached Arduino Code. You will need to install the "TMRpcm" library by TMRh20 from the library manager. Note, once you have the library, open its folder, then the file named "pcmConfig.h" and uncomment the line which says "#define USE_TIMER2".
Next, calibrate the microphones according to your room: run the code once in a quiet room to get your lowest values, then run it again while making a loud noise next to the microphones to get your highest values.
Once you have your range, you can adjust the "Level0", "Level1", "Level2" and "Level3" variables in the code to suit your room (with Level0 being the lowest and Level3 the highest).
You should also change the name of the audio files to match your own nomenclature.
Attachments
Step 4: Building Linda
Laser cut a mount for the servo motor using the attached .pdf file. Using a piece of the wood, you can also attach an extension to the servo motor arm to raise the book cover higher.
Cut out the insides of the book according to the orange parts in the image (all measurements are in millimeters). Cut deep enough to fit all the components into the book. Also make sure that the holes for the microphones are cut at different depths, so that the pages remain connected to the book.
Place the circuit inside the center hole in the book
Place the microphones in the side cuts in the book
Attachments
Step 5: Enjoy Your Peace and Quiet!
Congratulations! You now have your very own Linda!
Make sure to let us know how it went for you. We know that for us, we had a lot of trouble getting Linda to speak in the first place! Troubleshooting and calibrating Linda to the right noise level for the room was another difficulty. But the greatest difficulty of all, was getting Linda to speak and move at the same time - it seems Linda is rather lazy - but no worries, Linda just had to learn to use two separate timers to do both tasks at once!
Linda also sometimes gets really upset and all it wants to do is curse at us - we definitely didn't expect Linda's temper!



