Noise Monitor for My Cat (Interactive Electronic Art Final)
by cloudrider123 in Circuits > Arduino
581 Views, 8 Favorites, 0 Comments
Noise Monitor for My Cat (Interactive Electronic Art Final)
For this project the assignment was to make either a prototype or a finished product that extends our nervous system. I decided to make a device that extends my senses by notifying me of when the room is too loud specifically so I can make my room more comfortable for my cat Gus with the added benefit of preventing early hearing loss. The reason I decided on this is because Gus is extremely skittish especially with loud noises and often times I don't know if the noise I am making whether it be through my speakers or from me, are too loud for him and could be causing him discomfort. The output of the device will be through LEDs changing color from green to red based on the noise level input. To the credit of my professor I want to put the circuit inside of a cat head object with the eyes showing the LED output.
Supplies
- Soldering Iron
- USB for Arduino UNO
- 3D Printed Cat Face
- Wire Stripper
- Three Jumper Wires
- Solder
- Arduino UNO
- Two 2812b Neopixel LEDs
- Six Stranded Wires
- Five Heat Shrink Tubing Pieces
- DAOKI High Sensitivity Microphone
- Three F-M Dupont Wires
- 9v Battery
- Snap-On Connector for Battery
Find Cat Face Box
The first thing that I did was try to find either a premade cat face box to drill holes in or a 3D model that I could edit it how I needed to. I wanted to add holes on the eyes for the LEDs and on the mouth so that the microphone can get a good signal. I decided to find a 3D model as I have access to a 3D printer and I felt like it would result in a better product. I chose a model by Zarkkar named "Cat Box" because its design has an easy to access inside. The link for the model is https://cults3d.com/en/3d-model/gadget/cat-box and I attached the files it came with. I do recommend supporting the artist as the model is only $1.
Add Holes to Face Using Blender
I will attach the file that I ended with but will also include steps for anyone wanting to know how to do it.
Each steps image corresponds to the step number.
- On blender open File --> Import --> STL (.stl) --> Second Part.stl.
- Change edit mode with the tab key.
- Using the select box click on the points highlighted blue and green while holding shift. NOTE: you should only select the front and back of one place at a time not all three the image only shows all three as those are the places I cut holes.
- rotate to the back of the model and use the same method as step 3. Hold shift the entire time.
- Under the top bar click Edge --> Bridge Edge Loops and it should create holes where the selected objects were.
- Final model for the face should look like image 6.
Downloads
Print Cat Face
Here is the printed cat face with the three components separate and together. My dad printed it so I unfortunately wasn't able to get any steps on how to print.
The final print was done at 150% scale so that everything could fit inside with some room to spare.
Solder the 2812b LEDs
Each steps image corresponds to the step number (apologies for the low quality image for step 4, I didn't realize it was blurry until after completing the wiring).
- Strip the six stranded wires and one end of the three jumper wires.
- Twist each end that was stripped.
- Lightly solder the stripped ends for the jumper wires and one end for three of the stranded wires, and cut each tip.
- Solder the jumper wires to the three stranded ends from step 3.
- Heat shrink the soldered ends with a heat gun or a lighter.
- Solder these three wires to the first LED: red to 5V, black to GND, yellow to DIN.
- Solder the other three stranded wires to the other side of the LED, matching the colors.
- Solder the remaining ends to the second LED with the same orientation as step 6.
- Heat shrink the LEDs.
Connect LEDs and Mic to Arduino
The images attached show the wiring schematics for the microphone and the LEDs to the Arduino UNO.
Since there are only two LEDs being used it isn't necessary to connect them to an external power source or a breadboard.
- Microphone:
- Out pin on mic module connected to A0 on the UNO
- GND on mic module to GND on the UNO
- VCC on mic module to 3.3V on the UNO
- LEDs:
- 5V on LED to 5V on UNO
- DIN on LED to pin 6 on UNO
- GND on LED to GND on UNO
Code
Here is the code that I used and attached are the files that I used to make my code as well as mine:
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
const int sampleWindow = 50;
unsigned int sample;
#define SENSOR_PIN A0
#define PIN 6
#define NUMPIXELS 2
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
pinMode (SENSOR_PIN, INPUT);
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pixels.begin();
Serial.begin(9600);
}
void loop() {
pixels.clear(); // Set all pixel colors to 'off'
unsigned long startMillis= millis(); // Start of sample window
float peakToPeak = 0; // peak-to-peak level
unsigned int signalMax = 0; //minimum value
unsigned int signalMin = 1024;
while (millis() - startMillis < sampleWindow)
{
sample = analogRead(SENSOR_PIN); //get reading from microphone
if (sample < 1024) // toss out spurious readings
{
if (sample > signalMax)
{
signalMax = sample; // save just the max levels
}
else if (sample < signalMin)
{
signalMin = sample; // save just the min levels
}
}
}
peakToPeak = signalMax - signalMin; // max - min = peak-peak amplitude
int db = map(peakToPeak,20,900,49.5,90); //calibrate for deciBels
Serial.print("Loudness: "); //prints to serial
Serial.print(db);
Serial.println("dB");
if (db > 70) //uses db value to change and display the color of the LEDs
{
pixels.setPixelColor(0, pixels.Color(150, 0, 0));;
pixels.setPixelColor(1, pixels.Color(150, 0, 0));;
pixels.show();
}
else if (db < 52)
{
pixels.setPixelColor(0, pixels.Color(0, 150, 0));;
pixels.setPixelColor(1, pixels.Color(0, 150, 0));;
pixels.show();
}
delay(100);
}
Attach to 3D Print
I used black electrical tape to keep the LEDs and microphone in the proper places for better results.
I also used the electrical tape to cover any holes so no light other than the eyes get out of the box.
- Tape the LEDs behind the eye holes (image 1).
- Tape the microphone so it is facing the mouth hole (image 2).
- Tape any holes.
Final Product and Reflection
Shown are images of what the final product looks like and how it functions.
Overall I'm happy with how it came out but there are a few improvements I could make in the future if I were to continue. So the microphones by themselves that work with Arduino don't technically measure decibels they just trigger when it detects a noise so there really isn't any fine tuning for it. Even though it still definitely works and it's a good indicator of when to turn volume down in the room I would want to later implement an actual decibel calculation and use that to show multiple colors for the eyes to indicate volume. This would require a few more components and much more time than I had to complete this but I feel like it's a good start to a full product.