Noise Monitor for My Cat (Interactive Electronic Art Final)

by cloudrider123 in Circuits > Arduino

558 Views, 8 Favorites, 0 Comments

Noise Monitor for My Cat (Interactive Electronic Art Final)

IMG_8653.jpg
IMG_7149.jpg
IMG_6893.jpg
IMG_5463.jpg

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

IMG_8623.jpg
IMG_0094.jpg
  1. Soldering Iron
  2. USB for Arduino UNO
  3. 3D Printed Cat Face
  4. Wire Stripper
  5. Three Jumper Wires
  6. Solder
  7. Arduino UNO
  8. Two 2812b Neopixel LEDs
  9. Six Stranded Wires
  10. Five Heat Shrink Tubing Pieces
  11. DAOKI High Sensitivity Microphone
  12. Three F-M Dupont Wires
  13. 9v Battery
  14. 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

3D_print_step_1.png
3D_print_step_2.png
3D_print_step_3.png
3D_print_step_4.png
3D_print_step_5.png
3D_print_step_6.png

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.

  1. On blender open File --> Import --> STL (.stl) --> Second Part.stl.
  2. Change edit mode with the tab key.
  3. 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.
  4. rotate to the back of the model and use the same method as step 3. Hold shift the entire time.
  5. Under the top bar click Edge --> Bridge Edge Loops and it should create holes where the selected objects were.
  6. Final model for the face should look like image 6.

Print Cat Face

IMG_8653.jpg
IMG_8652.jpg

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

IMG_8626.jpg
IMG_8628.jpg
IMG_8630.jpg
IMG_8632.jpg
IMG_8633.jpg
IMG_8643.jpg
IMG_8644.jpg
IMG_8646.jpg
IMG_8654.jpg

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).

  1. Strip the six stranded wires and one end of the three jumper wires.
  2. Twist each end that was stripped.
  3. Lightly solder the stripped ends for the jumper wires and one end for three of the stranded wires, and cut each tip.
  4. Solder the jumper wires to the three stranded ends from step 3.
  5. Heat shrink the soldered ends with a heat gun or a lighter.
  6. Solder these three wires to the first LED: red to 5V, black to GND, yellow to DIN.
  7. Solder the other three stranded wires to the other side of the LED, matching the colors.
  8. Solder the remaining ends to the second LED with the same orientation as step 6.
  9. Heat shrink the LEDs.

Connect LEDs and Mic to Arduino

wiring.png
wiring2.png

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

Tutorial: How to measure sound Decibel by using analog sound sensor and Arduino

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

tapeLED.jpg
tapeMIC.jpg

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.

  1. Tape the LEDs behind the eye holes (image 1).
  2. Tape the microphone so it is facing the mouth hole (image 2).
  3. Tape any holes.

Final Product and Reflection

final1.jpg
final2.jpg
final prototype

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.