Classroom noise detector

Problem I'm trying to solve:

More than half of my students have ADHD and other learning issues. The problem is sixth grade children with these issues are very loud and they don't have enough self control to sit and be quiet. When I get them quiet, they perform better (no surprise) but I'm spend most of my day telling them to stop talking, sit down, listen etc. I end up stressed out, and the kids are mad, or they ramp up so they get sent to the office. I need a different approach.

I saw something like a stop light( https://www.asistorefront.com/p-235-quiet-light-noise-monitor.aspx ) but the company selling them wants a lot of money for them ($140.00 plus shipping). It works in another classroom, so I thought I'd try to make one with my Nano, and some basic instructions. I bought the parts and built it, uploaded the code and I did get the single LED to come on, but this isn't going to work in a room with 35 kids shouting over each other. I bought a light ring to flash brighter so I could catch the kids attention. I use alarms on my computer to tell kids when to start and stop working, and the kids respond well to those, so a visual signal will most likely work really well, and I won't have to yell over them.

Ideally, the orange lights come on when a 30 dB level is reached. At 35 dB, it turns red, and at 40 dB, it starts strobing in bright red and blue.

As this is an issue every teacher is facing, I would appreciate it if someone could walk me through this beyond the simple tutorial I learned on YouTube and Elegoo's project website.

Besides hooking up the parts and then coding, which I can probably get ChatGPT to write for me... (maybe). The struggle I also had was setting the actual sound levels when adjusting the potentiometer screw. I need it to work at the dB levels, and I couldn't figure out how to dial it in to those.

// www.elegoo.com
// 2018.10.24
/*
 LED1 should be lit, showing power. LED2 indicates sound input, and the sensitivity is adjusted by potentiometer.
 There is a tiny screw on the blue potentiometer block that you can use for adjustment. Turning that
 clockwise lowers the potentiometer value, while counter-clockwise raises the potentiometer value.
 Use the potentiometer to adjust the Sound Sensor sensitivity. Turn the potentiometer
 several rotations until you see the LED2 extinguish (or just faintly blink). This might be slightly greater than
 500, if you are also watching Serial Monitor (inital adjustment), or, Serial Plotter (the latter is prefererd for observation).
 Special thanks to user CRomer, for his input and hard work!
*/

int  sensorAnalogPin = A0;    // Select the Arduino input pin to accept the Sound Sensor's analog output 
int  sensorDigitalPin = 7;    // Select the Arduino input pin to accept the Sound Sensor's digital output
int  analogValue = 0;         // Define variable to store the analog value coming from the Sound Sensor
int  digitalValue;            // Define variable to store the digital value coming from the Sound Sensor
int  Led13 = 13;              // Define LED port; this is the LED built in to the Arduino (labled L)
                             // When D0 from the Sound Sensor (connnected to pin 7 on the
                             // Arduino) sends High (voltage present), L will light. In practice, you
                             // should see LED13 on the Arduino blink when LED2 on the Sensor is 100% lit.
                             

void setup()
{
 Serial.begin(9600);               // The IDE settings for Serial Monitor/Plotter (preferred) must match this speed
 pinMode(sensorDigitalPin,INPUT);  // Define pin 7 as an input port, to accept digital input
 pinMode(Led13,OUTPUT);            // Define LED13 as an output port, to indicate digital trigger reached
}

void loop(){
 analogValue = analogRead(sensorAnalogPin); // Read the value of the analog interface A0 assigned to digitalValue 
 digitalValue=digitalRead(sensorDigitalPin); // Read the value of the digital interface 7 assigned to digitalValue 
 Serial.println(analogValue); // Send the analog value to the serial transmit interface
 
 if(digitalValue==HIGH)      // When the Sound Sensor sends signla, via voltage present, light LED13 (L)
 {
   digitalWrite(Led13,HIGH);
 }
 else
 {
   digitalWrite(Led13,LOW);
 }
 
 delay(50);                  // Slight pause so that we don't overwhelm the serial interface
}

I have an Arduino Nano with the KY-038 microphone, a 60 LED addressable RGB light ring (WS2812). I need this to run on 110 AC. How do I determine the power required for the light ring, and to step down the power to 5v for the Nano? I don't know how to power the bigger lights. And I don't know how to code the RGB lights to get the desired colors at the different dB levels. Can you suggest how to power this with the part number for the power control, and how to connect it, and code for the lighting? Thanks!

Provide a drawing of your intent.

WS2812 or WS2812B?
what you mean "bigger lights"?

Ws2812B is 5V device so you only need 5V power supply. For example good quality smartphone charger 5V2A.

WESIRI 60 LEDs WS2812B 5050 RGB LED Ring Lamp Light Individually Addressable Full Dream Color DC5V with Mini Controller - Amazon.com It says it is for 5v but it doesn't have instructions for connecting it to an Nano and using batteries to light it won't work all day long every day.

You didn't mention batteries...

Smaller groups would lower the disorder but that calls for more money...

Never going to happen. I have over 140 kids daily - five class periods and a third of the year I have to cover an additional class or two with my own classes because there aren't substitutes to cover absent teachers.

I have a power supply on my bread board as part of a kit I bought. I didn't use batteries. For what I'm doing, they wouldn't be practical day in and day out. I'd spend so much time replacing batteries that I'd never get any teaching done.

https://bouncyballs.org/

For power, I think a 12V power supply would be enough

1 Like

The potentiometer on the KY-038 sets a single threshold to control the device's digital output. If you want dB out of this, you have to read the device's analog output and calibrate your own thresholds.

-- This writeup has a schematic that indicates that the potentiometer would change the analog output as well.

Can you point at the tutorial you were following?

You have three problems that you should solve separately:

  1. detecting your threshholds ( make the Arduino Analog Read example work with your hardware setup)

  2. running your LED ring ( Try the Adafruit Neopixel Library examples as aimed at by reputable name-brand Neopixel ring providers: NeoPixel Ring - 24 x 5050 RGB LED with Integrated Drivers : ID 1586 : Adafruit Industries, Unique & fun DIY electronics and kits )

  3. translating the sensor levels into some more complicated logic to handle switching between levels. e.g.: Blinking two different colors above 40dB needs some state machine logic as per the Arduino BlinkWithoutDelay example.

Try to be clear.
If you don't need batteries, like I wrote before, some good smartphone charger 5V2A would be ok to power your arduino and ws2812w 60 led ring.

If you need to drive them at full power, you nedd 5V4A power supply, but I don;t see it necessary.

1 Like

I included the code above and here's a link to the website YT video

Okay. I'm watching how to code the light ring. It has a controller but it won't do what I want, so I have to do this on my own. I'm thinking about using a strip up to 300 LED's instead, depending on cost. I have the ring, and I thought I'd put a picture of our serious looking principal in the middle of it.

Try to be clear.
If you don't need batteries, like I wrote before, some good smartphone charger 5V2A would be ok to power your Arduino and ws2812w 60 led...

Sorry, I misunderstood. Thank you.

I feel for You. The daughter of a friend is a teacher and faces similar situations.

35 pupils in such a group.... Incredibly bad. 10 - 15 would likely be possible.

That's like swear in church in this forum. Start playing with the components You need, one at the time, learning them and mastering them.

That's something I've never seen. I'll definitely use it but what happens when I need to use my projector for (PowerPoint - ugh) lessons? This isn't visible. Thank you for sending this too me. I'll share it at work. It's the last week of school, and this will help until I build my project for next year.

1 Like

Throw it in trash. Arduino will be the controller. You don't need anything else.

What's worse is mixing grade levels, I teach 6th grade but the others will be 7th or 8th grade kids. It gets wild sometimes, and it's hard to control each group. They tend to behave for me because I'm a man, but the women really have the worst time of it.

And I find little or no help with coding so ChatGPT is my fallback until I can figure out what I'm doing. And though it's hated here in the forum, I've had the displeasure of people being hateful and rude when I ask for help with the coding. ChatGPT explains what and why this or that piece of code is included, and it doesn't think it's too good to help out. It just helps. I wish it wasn't that way, but it's been there when the forum has not.

1 Like