SOUND SENSOR DATA ON ARDUINO SERIAL PLOTTER - Arduino tutorial #30
HTML-код
- Опубликовано: 13 июл 2024
- The CZN-15E sound sensor with microphone is able to detect sound. This sensor or for example used in a so called "clap sensor". In this tutorial I'll explain how you can read the sound sensor, and plot the result on the Arduino IDE's serial plotter. In order to draw this chart we need to process the sensor data with a technique called sampling.
The plotted amplitude is the amount of sound sampled over time. It does NOT represent a sound wave. The sensor is binary, it only measures if there is sound or not and is therefore incapable of determining sound frequency or amplitude.
The Arduino for beginners tutorials series guides you through the world of Arduino. A video is around 10 minutes and shows you step-by-step how to build the circuit and write the code. The website contains the course material, circuit diagram, Arduino code and shopping list of all the components used in the tutorial.
⬇️ Arduino code, circuit diagram and part list arduino-tutorials.net/tutoria...
👉 More tutorials and projects on arduino-tutorials.net
🇳🇱 Deze tutorial is ook in het Nederlands beschikbaar • 🇳🇱 GELUIDSSENSOR OP SE...
CHAPTERS:
00:00 Introduction
00:16 Components
00:26 Sound sensor
02:09 Building the circuit
02:40 Arduino code - part 1
04:08 Arduino code - part 2
COMPONENTS
🇨🇳 Arduino Uno (clone) with cable - AliExpress
arduino-tutorials.net/r/Jd28hF
🇳🇱 Arduino Uno (clone) - Opencircuit
arduino-tutorials.net/r/8237Hd
🇳🇱 Arduino Uno SMD (original) - Opencircuit
arduino-tutorials.net/r/Ud29dh
🇳🇱 Arduino Uno Chip (original) - Opencircuit
arduino-tutorials.net/r/Jd82ha
🇨🇳 Jumper wire assortment (MM/MF/FF) - AliExpress
arduino-tutorials.net/r/Fh378fg
🇨🇳 Jumper wire male-female - AliExpress
arduino-tutorials.net/r/sjf83h
🇳🇱 Jumper wire male-female - Opencircuit
arduino-tutorials.net/r/a7DH2g
🇨🇳 CZN-15E sound sensor - AliExpress
arduino-tutorials.net/r/2387yD
🇳🇱 CZN-15E sound sensor - Opencircuit
arduino-tutorials.net/r/8374HDv
VIDEO SUMMARY:
In this tutorial Bas is showing how to use a sound sensor to show audio on the serial plotter. He explains that the sensor captures sound waves with a microphone and translates them into resistance which is the same as the amount of sound. When there is low resistance, the sensor sends 5V to the OUT and when there is lot of sound it sends around 0V. The potentiometer on the sensor can be adjusted to set the level of the boundary that determines whether the signal will be seen as LOW or HIGH. Then, Bas demonstrates how to build the circuit, connect the sensor to the Arduino, and run the code. To display the intensity of the sound, he shows how to use the serial plotter. He also mentions that he changed the code to sample the audio and use millis() to measure the elapsed milliseconds since the last time.
#arduino #BasOnTech
Great videos. The world needs more teachers like you.
Thanks really appreciated! 😃
yes we do
This works incredibly well!
Hi, great to hear! 😃
outstanding explanation, to make the sound wave plot alive using millis() was a genius idea. thank you
Thanks! 😃
Great code!. THX for sharing with us!
Thanks for letting me know, great to hear! 😃
Geweldig! Mijn eerste stap naar de bouw van een lichtorgel.
Great! 😃
thanks LOT FOUND IT.MORE POWER HOPE TO SEE ANOTHER VERSION OF TUTORIALS ABOUT SOUND SENSOR
You're welcome! 😃
Simple and Precise 😍
Thank you Brother😃
RUclips please recommend me these things 😑
Thanks! Unfortunately I can't control the RUclips algorithms 😉 So liking the videos is probably the only thing that helps 😄
Your video is amazing, thank you so much
Hi, great to hear! Thanks! 😃
Great tutorial ! Thank you !
You're welcome! 😃
👉 Don't forget to check arduino-tutorials.net for the code and more Arduino tutorials and projects.
If you have questions, don't hesitate to ask them in de comments. Remember: There are no stupid questions 😃
🔔 Want to stay up-to-date with the latest videos? Subscribe to the Bas on Tech channel!
clear and simple thanks
You're welcome! 😃
Really amazing video, thank you
Great to hear, thanks! 😃
Excellent video, very well explained....
Thanks, appreciated! 😃
Great Video! Would like to see how the next step, showing the frequencies, should look like
That would be a completely different video, since this sensor can't do that 😄 But great suggestion for a future video 😃
Really amazing video, thank you lots.
Glad you liked it! 😃
you prolly dont care but if you're stoned like me atm you can watch all the latest movies and series on InstaFlixxer. Have been streaming with my gf for the last few weeks xD
@Keegan Corey Yea, have been watching on InstaFlixxer for years myself :D
Exactly what I was looking for.
Great to hear! If you have any questions, just ask 😃
@@BasonTech So the sensor you used is for binary sound detection. Instead, I want to do full multi-channel sound recording so that I can play the recorded sound back? Will I need the same sensor? If no, please suggest alternative. Thanks!
Nope, this sensor can't do that. I am also wondering if the Arduino has enough processing power to record multi channel audio. I think the Sony Spresense would be more suitable since it is fast and has multi mic input out of the box: developer.sony.com/develop/spresense/specifications
Thank you so much that helped me a lot
Great to hear! 😃
great video. thanks 👏
Thanks, glad you like it! 😃
Nice demo
Thanks! 😃
thanks this really helped
Great to hear! 😃
Thanks alot!
You're welcome! 😃
Thanks a lot bro ! It's help me for my project :)
Great to hear! 😃
Helo, I might be a little late but does the project really work with his code? I'm thinking of doing one for school. :D
@@user-dj8et5np4e Why shouldn't it work?
@@BasonTech I was just wondering due to my fear of messing up, apologies if it offended you
@@user-dj8et5np4e No worries! The only thing you can mess up is with the hardware. If you connect the wires in a wrong way causing a short circuit of something 😃
Thaaank you
My pleasure! 😃
Very clear. 1 question. Is there a formula i can use to show the Sound waves in Db values?
Hi Dražen, this sensor is a binary sensor, it just tells you if there is sound. By sampling I try to get a bit of an idea of the intensity of the sound. There is no way this can tell you the amount of decibels. If you want to measure that you'll need another sensor.
Thank you for the nice explanations. Is there any ways which I can be able to save the plotted audio into WAV or MP4 to an SD Card or by using PySerial?
Nope, it just tells you if there is sound or not. No frequency, dB or anything else.
Thank you very much for your clear instructions! I only have one weird outcome, when there is no sound, the value is very high and when there is sound the value gets lower. I just copied the code so i think that can't be the problem, but I use another sound sensor: Robodyn Sound Detector. It has 4 pins instead of 3, I connected the Digital Out with digital 8 on arduino. Do you maybe know what went wrong? Thank you!
Hi, it sounds like the signal is being inverted by your sensor. This is no problem, just change the code so you'll get the inverted value. So 0 needs to become 1024 and 1024 needs to become 0 😃
@@BasonTech Could you elaborate a little bit more on that. e.g. where exactly to change the code?
@@ACID2BREAKS try changing the digitalRead from LOW to HIGH
Hello, great video, still havent bought any of arduino. Im wondering if i would desolder Microphone and replaced it with RFID antenna, could i read RFID tags?
Hi, that is not going to work. I had a tutorial about RFID, but I took it down because of an error in the video. I can't promise when I upload the fixed version.
Hey, great project!!
Can we obtain the same output which shows the amplitudes if we connect the out pin to a PWM pin on the Arduino and do an analog read instead of a digital read?
Thank you
Thanks! The sensor I am using does not have an analog out. So in this tutorial I basically try to mimic an analog signal by sampling a digital one 😃
@@BasonTech Got it, thank you
Thanks for such a clear video. If I want to monitor the absence of sound in 10 seconds, how will I code that?
What have you tried so far, and on what are you stuck?
Wow..just wow!
Thanks ...you solved my problem......
I would also like to know whether you are familer with the sound sensor module which has analog pin output too....I expected such a waveform when I connected it to the analog pin but there's no difference at all no matter what sound I make!
I thought the mic was damaged but everyone had the same problem!
The digital sampling I use in this tutorial will not work with the analog output. With an analog output it should be a log easier. Just print the value read on the analog port to the serial monitor. You should see a value variation depending on your sound.
Thanks for helpful video..
Just i have a question how can get the sample on binary form for the sound and saying.... With regards
You can't, the sensor just tells you if there is sound or not. It does not provide you with any waveform audio.
Hi Boss,
This is such an amazing video, it worked for me however I have 2 questions:
1. I'm struggling to read the signals from the Audio sensor using a Osciloscope, if I want to create a program that will action something based on some frequency (i.e. a clap light switch) can I use the plotter instead of the osciloscope ?
2. My plotter view is like very big, I would like to zoom out the plotter to have your same view, is there any setting to change to make it ?
THANKS !.
Hi, to display the signals on an oscilloscope you have to output them as analog signals. My code sends it to the serial monitor and the IDE makes the graph. So you then have to modify the code that you use an analog pin to set the correct value over time.
Further this sensor does not measure frequency, so you can't really detect a certain frequency.
To zoom out my guess is that you need to multiply the values by a certain factor which fits your need.
I have the same mic as you.
Do you think it is possible to analyze different freuqencies wirh the arduino?
Maybe with the Help of the FFT libary?
Yes, you can analyse different frequencies with an Arduino. Unfortunately not with this sensor. This is a "binary" sensor so it tells you if there is sound or not and that's it.
thank for the video and do u know how to detect the frequency of acoustic signal using this circuit?
You can't this sensor is a binary sensor and only tells you of there is sound or not. With this code we are mimicking some kind of detection by using sampling.
ela
THANKS THIS HELPED ME A LOT!! may i know like where do i enter the code on
Hi, what do mean exactly?
Great demonstration. Is it possible to recognize a sound with arduino. I mean I want to sample a sound like a door bell, then if the doorball rings arduino let say gives 1 for example.
Unfortunately not. The "waveform" you see is not actually a waveform. It is a graphical representation of sampled sound intensity. There is no actual information about the sound in the waveform.
Hello, it's very helpful video and nice presentation. Thankyou so much. I'am doing a project based on this but instead of aurdino how can we interface sound sensor to FPGA. If you know anything about it kindly reply.
I have no idea, sorry 😃
Thanks for your response
1k th like ✌️😬
Thanks for you explanation and i need help from you sir, the code to shows only analog value of sound but i like to see in dB value , how to convert Analog sound data to dB ? can you put video on this or any idea?
You can't. This sensor does not detect dB nor the frequency of sound. What I detect is the frequency of the sensor detecting sound. Maybe the text version of the tutorial makes it clearer: arduino-tutorials.net/tutorial/drawing-sound-sensor-data-on-serial-plotter
Hello. Great video sir!
I just want to ask something sir if its okay. I want to turn on a LED when it reaches a certain amplitude on the plotter (300 for example).
I copied your code and tried a bunch of stuff but it wont work. Sometimes the LED is just steadily on sometimes it wont even turn on. What should i do sir? Thank you in advance
Hi, could you tell me what exactly you've tried already?
Would you please make a video about sound classification using sound sensor.
What do you mean by sound classification?
Amazing video man! super dope I just bought this component and your video is exactly what I was looking for. I also make tech footage too check out my projects when you get the time
Glad I could help! 😃
@@BasonTech When I make my project using it I am going to shout you out !
Hello I shouted you out in my most recent footage! thanks for all the help! I recently posted it.
Thanks! :)
@@BasonTech welcome
Awesome video and production qulity! I subscribed and look forward to more videos :)
Unfortunately the code does not seem to work for me. I'm using a different sensor though, the ky-037 or 38, which both has digital out and analog outputs. When using the digital output from the sensor and hooking it up as you did, I'm getting a zero's in serial monitor except for when shouting really loudly or clapping.
Any idea why?
Thanks! What I see on pictures is that on the sensor there is a blue potentiometer which you can adjust. With this you should be able to adjust the sensor sensitivity. Hope this works 😃
@@BasonTech Thanks that worked! The potentiometer was so ridiculously sensitive though :D
Thank you very much sir. Sir I want to analyze multiple sound sensors data. Is it possible to analyze on same serial plotter and detect the sound sensed by a particular sensor.? Thank you in advance 😊
Hi, you want multiple lines plotted on the same screen?
Hello, can it connect to a LED then when it reaches a certain sound level (your desired or assigned level) the LED will turn on or will light up?
Hi, sure you can. Just add an if statement which monitors the current value. When it is larger you turn on the LED.
Excuse my simple question, but I have a goal in mind to record this data over time and stream it to a text file. I understand that I would require an SD card module connected to the arduino in order to do so. Therefore I am considering going for a raspberry pi to fulfil this purpose (given the added benefits of using a Pi).
My question is: would this sensor module work with a raspberry Pi as well, and would I be able to reproduce this scenario with a modified script? (Using a while loop in any programming language for example, instead of the native arduino loop)?
Hi, this sensor should probably work on a RPI as well. Keep in kind that this is not audio waveform data. You are not able to play this data as audio.
Hi there! Absolutely informative video. one question, how can we use this sensor to detect a specific audios like cry, laugh and trigger a relay?
Hi, this is not possible. The sensor just detects if there is sound or not. The highest achievable would be "clap detection".
@@BasonTech so can this be achieved using KY-037 or 038?
@@BasonTech I am trying to turn on the camera when the cry is detected using sound module..help me out please 😅
It could be, the biggest issue is to detect the characteristics of the waveform what we see as "cry" of "laugh".
Hi thanks for the video. I have a question: If I have the audio of the SIM800L when a call is outgoing, Can I connect from the speaker outputs of SIM800L to this sound sensor instead of micro inputs in order to detect when someone answer its smartphone for example? thanks
Hi Jesusita, this sensor isn't really the right device for that. I think you need to look into a VU-meter device to which you can connect the speaker out of you SIM800L
@@BasonTech thanks
interesting video! i guess we can figured out the frequency of the sound based of the sampling?
i hope u answer my question
Hi, unfortunately we can't. This sampling calculates the amount of sound the sensor detects in the given sample time. It is unrelated to the frequency of sound. It is more the frequency of the amount of sound detected 😃
Thank you for the video, great stuff!!. I suppose the same can be done with other similar sensors such as KY-037 or KY-038. Thank you!
The KY-037 or KY-038 are different sensors. While the sensor in the video is binary (it detects if there is sound or not), the KY-037 or KY-038 have also an analog out to give the intensity of the sound. In my video I kinda mimic this behaviour which is not necessary for the KY-037 or KY-038. 😃
Hoi Bas, Werkt dit ook met die met een rode printplaat lijken op wat kleine verschillen het zelfde. En wat kun je er later mee??
Heel lastig te zeggen, heb je een linkje naar het component?
Congratulations was cool, but have you ever thought about making a spectrum analyzer using WS2818 led strip and the sound sensor?
Hi Luiz, yes I did! Unfortunately time is currently not on my side, but it is definitely something I want to look into 😃
@@BasonTech do you have the code ready?
Nope, I have the parts laying around, but not yet build anything
hello, sir I want to ask you if ever worked with esp8266 I want to visualise the frequencies and their amplitudes on the serial plotter .
The code should work on an ESP8266 😃
first of all thanks for your video. I and my son trying to make recgognize to speech. if i say for example "yellow" i can see some numbers on serial monitor. if i describe some diffrent patterns can i recognize that word and light the yellow red ? please . thanks from Turkey
Hi, that is not going to work on an Arduino. A Raspberry Pi for example should be more capable of such a task.
Hi Bas on Tech. I am using a mic and custom op amp circuits to amplify the sound. But when i run part 2 of your code, i am not able to see the same kind of values your are seeing. Using a headphone jack breakout I was able to hear the audio input to the mic. But my arduino is not showing me those waveforms. Would you be able to help me out on this?
Kinda hard to say, I've made this tutorial specific for this kind of sensor who is a binary sensor. A mic and amp does not work this way.
very good video. roughly what sensor is suitable for measuring the number of dB?
Thanks! The datasheet states: Sensitivity: -46±3dB -42±3dB -38±3dB -34±3dB (0dB=1V/pa,1KHz) more info at eva.fing.edu.uy/file.php/585/materiales/HD/CZN-15E.pdf
@@BasonTech thanks
Hello sir..I want to make vu meter using ws2812b RGB led and sound sensor..so if I use the statement" if sound value is between x and y then display z leds"..will it be the correct statement..
I want to use if statement ..can I guide me sir.
(X,y,z are just examples I have taken)
This sensor is not so suitable for a VU meter since it is binary. Have a look at the KY-037 or KY-038 which has an analog out. The correct state for between 50 and 60 is:
if((x > 50) && (x < 60)) {
thank you. i ask if we can gets sound of leak water in pipline with arduino
Recognising a specific sound with an Arduino is not really possible. You then want to look into a Raspberry PI with a sound recognition software. I have no experience with this.
Does it measure if the sound is high or low, or does it measure the dice of the letter that comes out of the mouth?
It does measure if there is sound or not during the giving sample time. It has no sense of frequency, tone, voice etc.
Amazing! Can you show us if there is a way in which we can convert this analog read into dB? really useful if you could. thanks in advance
You can't with this sensor. The sensor only detects if there is sound, thats is. There is no way to detect dB, volume, intensity or frequencies.
@@BasonTech Oh, Thanks for the response. I was starting to think that this sensor is not really for the environment.
thank you. how if we want using 4 microphone, and make them to be array ?
Just use another pin for each microphone. You can then read each mic individually.
Hey....can I know how /what position did you set the Screw/Potentiometer
The same as the thumbnail shows. Unfortunately my guess is that the position is not really comparable between devices.
Hi, I have a question, what are you exactly report in the serial plotter? Whats the meaning the numbers in x-asis and y-asis
Hi Ismael, great question! I've added the explanation to the website as well: arduino-tutorials.net/tutorial/drawing-sound-sensor-data-on-serial-plotter The x-axis (horizontal) is the time axis. We set SAMPLE_TIME to 10ms. This means that each horizontal point is equal to 10ms. So if we see the number 100 on the x-axis (100x 10ms), 1 second has passed.
The y-axis (vertical) is the number of moments within 10ms that the Arduino sensed sound. This is related to how fast the Arduino can go through the loop(). For example, an 8Mhz Arduino will be able to do fewer measurements per second than a 16Mhz Arduino. They are therefore not exact values, but should be viewed more relative to each other.
Sir, Thank you . It's a great tutorial. sir, is there a way to try this code for this sound sensor with an ATmega32 microcontroller ?
I can't think of anything why that wouldn't work 😃
@@BasonTech ok thank you sir
..😊
Hi Bas - I find it very difficult to tune the potentiometer - the same as the one in your link. The "sweet spot" between registers "ON" all the time vs registers "OFF" all the time is a hair's breadth. Literally even touching the pot with a screwdriver is enough to turn it from full on to full off, or vice versa. I bought a different mic board, and got the same result. Any ideas on this?
Hi John, that is weird. The only thing I could think of is that for example you use a 5V sensor on a 3V Arduino or something like that. On a 3V Arduino everything higher than 1.5 is considered to be 1. When having 5V connected that is 80% of the time, instead of 50%.
@@BasonTech Thanks, but no I tried them on 5V and 3.3V. It's either full on or full off, with a hair trigger separating the two states. I've ordered another mic and if that doesn't work I'll give up. When I am able to find the sweet spot, after 10 minutes it's already worked its way out into the full on or full off states, without any external intervention, rendering it useless for the 24/7 ambient noise-level monitoring that I was hoping to use this for...
Keep in mind that sometimes it takes me multiple tries as well to get things figured 😄
Can this be used with arduino fft because it looks like analog output but will it behave like analog signal with arduino fft like an analog signal from sound sensor
Hi, unfortunately I have no experience with Arduino FFT. The signal from the sensor is digital with my sampling you kinda get an analogish signal but is not real analog like a soundwave
Can we make a 3d sound localization system with czn15e mics??? I want exact point where the sounds come from.
Theoretically yes, but you then need a very precise timer and calibrated sensors to do such measurements.
can i ask if you know how to show the decibel equivalent of the sound?
I've having a hard time with it .
You can't with this sensor. It does not measure decibel at all.
Is it possible to save the audio files as .wave? Using this sensor
Not at all. The data is a sampled representation of the sound intensity. It is not a so-called "waveform". So the data you see does not in any way represent the actual audio content.
Hi ! 1. Can I connect more than one sound sensor at one time?
2. Can the data transfer to a bluetooth serial transreciever?
1. You can connect as many as you have ports on your Arduino
2. It should be possible to send the data over Bluetooth
Keep in mind that this is not audio data but just sampled data on whether there is a sound or not. It is not audio waveform data.
what do the values represent on the Y-axis? I cant seem to still understand what those values mean on the chart?
During the sample period we count if there was sound or not. We keep track of a counter during this sample period. Every time we detect sound we increase the value by 1. So you can see it as the amount of time over the sample period.
great.. now what i need to do is somehow transmit the output via wifi then access it remotely ...the ultimate aim is to monitor sound levels remotely...plase guide me on the setup i need cheers
On what part are you getting stuck?
I found that it was detecting too much noise and if was looking a mess. If you put the line " delay(1); " below the if statements it delays the feedback just enough to smooth the graph and looks much neater.
Keep in mind that delay(1) actually tells the cpu to wait 1ms. So basically you're telling the Arduino to ignore the sensor values within that 1ms. Another way to smoothen is to widen your measurement window and subtract a base level where the noise is 😃
@@BasonTech I find that it sends an unwanted peak. It's one way of removing it :)
btw didn't the peak go away by adjusting the sensitivity?
sir!! can you code the program to display the same wave on OLED display ?
If you combine my OLED tutorial from ruclips.net/video/SuSqalI90G0/видео.html with this tutorial, you should be able to write it yourself 😃
Great Video, but us there a way to have the serial plotters values as a usable value in an if statement, I am working on a small project for example when the serial plotter hits over 100 I want a led to turn on, and when its below 100 to turn off, but I just dont know what variable to put into the if statement.
Like the serial plotter shows the values up to 1000, but when using an if statement or the sampleBufferValue the statement only works when its being compared to a 1, and nothing over 1
Hi, in my code I use:
if (millisElapsed > SAMPLE_TIME) {
This if checks if the sample time has passed. You can add an additional if inside this if (or extend the if) for your desired value like:
if ((millisElapsed > SAMPLE_TIME) && (sampleBufferValue > 100)) {
@@BasonTech Perfect, that works great, thanks for the help!
Great to hear! 😃
I am using just an electret condenser microphone but without the module circuit. how can I show the output of the microphone on the serial plotter with intensity?
You then need a component which does convert your mic into an analog signal suitable for your Arduino. E.g. 0-5V for 5V Arduinos of 0-3V for 3V Arduinos. Never did this though, so I don't know which component would work.
Hi, the video bis pretty cool, but I was thinking what if i want to manipulate the frequency of the sound and the pitch, how that could be done.
I geuss, we need to connect the mic to a digital to analoge converter, that could be done by coding as well but we need to use equations. Anyway, do you have a clue of how that could be done
You can't since this is a binary sensor. The plot is only plotting the amount of sound, not the frequency. If you want to work with the frequency of sound you'll need another sensor 😃
@@BasonTech you please make a video for frequency vs amplitude
Can you help me to build a circuit for my University project?
Sir so how to do make a combination for this sound sensor and LED light? As I want to know about it. Could you plz make a video about it?
Hi, what do you want to achieve with the LED?
How to use arduino, 16bit adc and Bluetooth module to transmit digital audio to bluetooth earphone?
Sorry I have no experience with these components. Maybe you can ask on the Arduino Reddit of on the Arduino forum?
I am having trouble trying to run two of these sensors at the same time? No matter how I try to rewrite the code enabling a second sensor the graph will only show one. Any suggestions?
What have you tried so far and didn't work out?
How can i use the different decibel/sound values in my code
You can't, at least not with this sensor. It is a binary sensor which has no clue about decibel or frequencies. It just tells you if there is sound or not.
May I know what is the unit reading of the output in serial plotter
I've added the explanation to the website as well: arduino-tutorials.net/tutorial/drawing-sound-sensor-data-on-serial-plotter The x-axis (horizontal) is the time axis. We set SAMPLE_TIME to 10ms. This means that each horizontal point is equal to 10ms. So if we see the number 100 on the x-axis (100x 10ms), 1 second has passed.
The y-axis (vertical) is the number of moments within 10ms that the Arduino sensed sound. This is related to how fast the Arduino can go through the loop(). For example, an 8Mhz Arduino will be able to do fewer measurements per second than a 16Mhz Arduino. They are therefore not exact values, but should be viewed more relative to each other.
Hi dear sir, can we use two sounds and then differentiate their frequencies and display?
Hi, not with this sensor. This is a binary sensor: it tells you if there is sound or not. It doesn't measure a frequency at all. In order to do so you need another sound sensor.
@@BasonTech sir, actually I want to make a device to measure different frequency sound waves and find individual wave like in fast forrier transform of quite nice range. If any sensor available, please reply. Thank you.
Can you please make a video for frequency vs amplitude
Hello, I want the relay to be on all the time when there is voice. and then turn off the relay when the voice is finished.
Then you should add some kind of "debounce" and a threshold. When there is noise the relay turns on. When there is no sound the debounce makes sure the relay doesn't immediately turn off.
Can i use audio signal with RCA cables without microphone?
No you can't. For that you need a different circuit this is just a binary sound sensor.
Can you please make a video for frequency vs amplitude
I'll write it down as a possible video topic, no guarantees though 😉
@@BasonTech ok, but can you please share some blog or something, because i need it by next week . It will be very helpful. We have project to get amplitude vs frequency from audio/voice
Then you have to search how to use a microphone on an Arduino and get the information you want from its data.
Whats the lowest db this sensor can detect? and what distance can it detect?
The datasheet on eva.fing.edu.uy/file.php/585/materiales/HD/CZN-15E.pdf only says: Sensitivity: -46±3dB -42±3dB -38±3dB -34±3dB (0dB=1V/pa,1KH
How to display these types of spectrum anysis on a P10 led module
Then you have to translate the chart values to bar lengths, and show this on the P10 module
Remember, this sensor cant measure noise level (dB). The amplitude on diagrams dont show noise level, it only shows how long sound sensor was triggered on. When it is quieter, the sensor does not detect the quieter sound as a lower noise level, but activates fewer times in a set period of time.
exactly this 😃
how far is the detection range of the sound sensor?
Copied from the datasheet at eva.fing.edu.uy/file.php/585/materiales/HD/CZN-15E.pdf
Sensitivity: -46±3dB -42±3dB -38±3dB -34±3dB (0dB=1V/pa,1KHz)
Impedance: Low impedance
Directivity: Omnidirectional
Frequency: 20-16,000Hz
Voltage range: 1.5V-10V
Standard operation voltage:4.5V
Current consumption: Max.0.5mA
Sensitivity reduction: Within -3dB at 3V
S/N ratio: More than 60dB
Hello, I would like to ask, i have a similar sensor and tried this out but instead, I notice that the opposite happens on my plot. Like the module outputs a HIGH when there's noise and a LOW when there's none. Am I doing something wrong or?
Are you 100% sure you have the same sensor? I know there are sensors with analogue output as well 😃
@@BasonTech oh I was able to make it work now, tho I realized that before I have the 2nd LED turned on and that's when it outputs a HIGH when there's noise. When I turned the pot and the 2nd LED on the left was turned off, it now outputs a LOW when there's noise. They look exactly the same on first glance but maybe they were different modules after all haha
Great you solved it! 😃
Well, if the sound is below 100, I want to do an action
if(sampleBufferValue
This should be correct. Are you using it in the loop() function?
Is it possible to measure the exact decibel. Like if the intensity of sound is more than a specified limit one can get warning or something like that?
The sensor just measures if there is sound or not. So there is no measurement of the intensity, decibel, frequency or whatsoever.
@@BasonTech so what's the solution for this?
Probably use a "real" decibel sensor. Unfortunately I have no experience with these
@@BasonTech no problem..
Thanks for replying
How can I reflect this kind of graph to the 5110 lcd.
I've never worked with the 5110. But if you manage to get te screen working you should be able to convert the chart values into lines on your screen.
I'm trying second part and only geting 0 and 1.
If I put SAMPLE_TIME = 100 , I can take up to 3000.
How should I tune the potentiomerter in sensor to have bigger values with SAMPLE_TIME = 10?
It is two steps: The first step is to make sure your sensor is correctly giving the 1 and 0 depending on the sound volume. This can be done with the potentiometer. The second step is to pick the correct sample time. The longer the sample time the higher the values will be.
Can this sensor detect ultrasound, teacher. Thanks in advance 😍
According to the datasheet the CZN-15E has a frequency range of 20-16,000Hz. Ultrasound starts at 20,000, so it can't detect this
I mimicked your code, but cannot seem to get it correct. I have a four pinned sound sensor, and for some reason, it gives me 1650 something, and then 1501, and the sensor doesn't work.
Please advise
Hi Rohan, are you sure the pin layout and sensor is the same? There are other sensors which looks the same but work differently.
This has good possibilities. I will need to calculate how fast the sample rate is, if anyone could help me with that I would be grateful.
Good question! You probably can do something with the millis() function to measure elapsed time? Although this is not super accurate.