No video

SOUND SENSOR DATA ON ARDUINO SERIAL PLOTTER - Arduino tutorial #30

  Рет қаралды 102,279

Bas on Tech

Bas on Tech

Күн бұрын

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-tutori...
👉 More tutorials and projects on arduino-tutori...
🇳🇱 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-tutori...
🇳🇱 Arduino Uno (clone) - Opencircuit
arduino-tutori...
🇳🇱 Arduino Uno SMD (original) - Opencircuit
arduino-tutori...
🇳🇱 Arduino Uno Chip (original) - Opencircuit
arduino-tutori...
🇨🇳 Jumper wire assortment (MM/MF/FF) - AliExpress
arduino-tutori...
🇨🇳 Jumper wire male-female - AliExpress
arduino-tutori...
🇳🇱 Jumper wire male-female - Opencircuit
arduino-tutori...
🇨🇳 CZN-15E sound sensor - AliExpress
arduino-tutori...
🇳🇱 CZN-15E sound sensor - Opencircuit
arduino-tutori...
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

Пікірлер: 382
@BasonTech
@BasonTech 4 жыл бұрын
👉 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!
@ishantripathi9707
@ishantripathi9707 2 жыл бұрын
Great videos. The world needs more teachers like you.
@BasonTech
@BasonTech 2 жыл бұрын
Thanks really appreciated! 😃
@momisoma6564
@momisoma6564 Жыл бұрын
yes we do
@kijijikhalid601
@kijijikhalid601 Жыл бұрын
outstanding explanation, to make the sound wave plot alive using millis() was a genius idea. thank you
@BasonTech
@BasonTech Жыл бұрын
Thanks! 😃
@benbelkacemdrifa-ft1xr
@benbelkacemdrifa-ft1xr Жыл бұрын
Would you please make a video about sound classification using sound sensor.
@BasonTech
@BasonTech Жыл бұрын
What do you mean by sound classification?
@sanjanaattanayake4231
@sanjanaattanayake4231 3 жыл бұрын
Simple and Precise 😍 Thank you Brother😃 KZbin please recommend me these things 😑
@BasonTech
@BasonTech 3 жыл бұрын
Thanks! Unfortunately I can't control the KZbin algorithms 😉 So liking the videos is probably the only thing that helps 😄
@harynian
@harynian 3 ай бұрын
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.
@BasonTech
@BasonTech 3 ай бұрын
exactly this 😃
@ijlie
@ijlie 3 жыл бұрын
Geweldig! Mijn eerste stap naar de bouw van een lichtorgel.
@BasonTech
@BasonTech 3 жыл бұрын
Great! 😃
@brittvandenboogaard8750
@brittvandenboogaard8750 3 жыл бұрын
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!
@BasonTech
@BasonTech 3 жыл бұрын
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 😃
@ACID2BREAKS
@ACID2BREAKS Жыл бұрын
@@BasonTech Could you elaborate a little bit more on that. e.g. where exactly to change the code?
@jedi_interceptor
@jedi_interceptor Жыл бұрын
@@ACID2BREAKS try changing the digitalRead from LOW to HIGH
@ACID2BREAKS
@ACID2BREAKS Жыл бұрын
Great Video! Would like to see how the next step, showing the frequencies, should look like
@BasonTech
@BasonTech Жыл бұрын
That would be a completely different video, since this sensor can't do that 😄 But great suggestion for a future video 😃
@slapshot256
@slapshot256 3 жыл бұрын
This works incredibly well!
@BasonTech
@BasonTech 3 жыл бұрын
Hi, great to hear! 😃
@majorchristopherkyle1077
@majorchristopherkyle1077 Жыл бұрын
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!
@BasonTech
@BasonTech Жыл бұрын
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.
@ipyanamwaisekwa8209
@ipyanamwaisekwa8209 3 ай бұрын
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?
@BasonTech
@BasonTech 3 ай бұрын
Nope, it just tells you if there is sound or not. No frequency, dB or anything else.
@randzvlog3364
@randzvlog3364 3 жыл бұрын
thanks LOT FOUND IT.MORE POWER HOPE TO SEE ANOTHER VERSION OF TUTORIALS ABOUT SOUND SENSOR
@BasonTech
@BasonTech 3 жыл бұрын
You're welcome! 😃
@user-ny5be4lm8z
@user-ny5be4lm8z 2 жыл бұрын
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
@BasonTech
@BasonTech 2 жыл бұрын
On what part are you getting stuck?
@juliogCyg
@juliogCyg 11 ай бұрын
Great code!. THX for sharing with us!
@BasonTech
@BasonTech 11 ай бұрын
Thanks for letting me know, great to hear! 😃
@aiswaryababu7694
@aiswaryababu7694 3 жыл бұрын
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.
@BasonTech
@BasonTech 3 жыл бұрын
I have no idea, sorry 😃
@aiswaryababu7694
@aiswaryababu7694 3 жыл бұрын
Thanks for your response
@kamrenmccullen1387
@kamrenmccullen1387 Жыл бұрын
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?
@BasonTech
@BasonTech Жыл бұрын
What have you tried so far and didn't work out?
@coder1448
@coder1448 Жыл бұрын
Well, if the sound is below 100, I want to do an action if(sampleBufferValue
@BasonTech
@BasonTech Жыл бұрын
This should be correct. Are you using it in the loop() function?
@zandwu2678
@zandwu2678 3 жыл бұрын
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
@BasonTech
@BasonTech 3 жыл бұрын
Hi, could you tell me what exactly you've tried already?
@Naber796
@Naber796 Жыл бұрын
Can we make a 3d sound localization system with czn15e mics??? I want exact point where the sounds come from.
@BasonTech
@BasonTech Жыл бұрын
Theoretically yes, but you then need a very precise timer and calibrated sensors to do such measurements.
@shillowcollins6392
@shillowcollins6392 Жыл бұрын
Thanks for such a clear video. If I want to monitor the absence of sound in 10 seconds, how will I code that?
@BasonTech
@BasonTech Жыл бұрын
What have you tried so far, and on what are you stuck?
@panjapornsittanu9967
@panjapornsittanu9967 2 жыл бұрын
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.
@BasonTech
@BasonTech 2 жыл бұрын
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.
@rohanhablani133
@rohanhablani133 2 жыл бұрын
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
@BasonTech
@BasonTech 2 жыл бұрын
Hi Rohan, are you sure the pin layout and sensor is the same? There are other sensors which looks the same but work differently.
@reefermaker
@reefermaker 4 жыл бұрын
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.
@BasonTech
@BasonTech 4 жыл бұрын
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 😃
@reefermaker
@reefermaker 4 жыл бұрын
@@BasonTech I find that it sends an unwanted peak. It's one way of removing it :)
@BasonTech
@BasonTech 4 жыл бұрын
btw didn't the peak go away by adjusting the sensitivity?
@sensatyajeet1360
@sensatyajeet1360 3 жыл бұрын
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)
@BasonTech
@BasonTech 3 жыл бұрын
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)) {
@utkuserin9750
@utkuserin9750 2 жыл бұрын
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.
@BasonTech
@BasonTech 2 жыл бұрын
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.
@noviaakarostiani8366
@noviaakarostiani8366 2 жыл бұрын
thank you. how if we want using 4 microphone, and make them to be array ?
@BasonTech
@BasonTech 2 жыл бұрын
Just use another pin for each microphone. You can then read each mic individually.
@amanshastry2651
@amanshastry2651 3 жыл бұрын
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
@BasonTech
@BasonTech 3 жыл бұрын
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 😃
@amanshastry2651
@amanshastry2651 3 жыл бұрын
@@BasonTech Got it, thank you
@elyaakoubyyassine336
@elyaakoubyyassine336 2 жыл бұрын
thank you. i ask if we can gets sound of leak water in pipline with arduino
@BasonTech
@BasonTech 2 жыл бұрын
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.
@gowthamj8301
@gowthamj8301 2 жыл бұрын
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?
@BasonTech
@BasonTech 2 жыл бұрын
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
@rajnegi266
@rajnegi266 3 жыл бұрын
i have an issue, for some reason my data numbers are starting from 1530 and decrease, instead of starting from 0, not sure what wrong
@BasonTech
@BasonTech 3 жыл бұрын
Have you checked the potentiometer setting and wiring?
@untraditional6235
@untraditional6235 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@MiG-25IsGOAT
@MiG-25IsGOAT 8 ай бұрын
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
@BasonTech
@BasonTech 7 ай бұрын
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.
@MiG-25IsGOAT
@MiG-25IsGOAT 7 ай бұрын
@@BasonTech Oh, Thanks for the response. I was starting to think that this sensor is not really for the environment.
@sedraahmed250
@sedraahmed250 Жыл бұрын
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?
@BasonTech
@BasonTech Жыл бұрын
It does measure if there is sound or not during the giving sample time. It has no sense of frequency, tone, voice etc.
@Trix8574
@Trix8574 2 жыл бұрын
what do the values represent on the Y-axis? I cant seem to still understand what those values mean on the chart?
@BasonTech
@BasonTech 2 жыл бұрын
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.
@hasnainahmed7605
@hasnainahmed7605 2 жыл бұрын
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 😊
@BasonTech
@BasonTech 2 жыл бұрын
Hi, you want multiple lines plotted on the same screen?
@Mohammedmalkawi33
@Mohammedmalkawi33 3 жыл бұрын
Thanks for helpful video.. Just i have a question how can get the sample on binary form for the sound and saying.... With regards
@BasonTech
@BasonTech 3 жыл бұрын
You can't, the sensor just tells you if there is sound or not. It does not provide you with any waveform audio.
@yavuzcan233
@yavuzcan233 2 жыл бұрын
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
@BasonTech
@BasonTech 2 жыл бұрын
Hi, that is not going to work on an Arduino. A Raspberry Pi for example should be more capable of such a task.
@belenavellana2101
@belenavellana2101 3 жыл бұрын
how far is the detection range of the sound sensor?
@BasonTech
@BasonTech 3 жыл бұрын
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
@majorchristopherkyle1077
@majorchristopherkyle1077 Жыл бұрын
Hey....can I know how /what position did you set the Screw/Potentiometer
@BasonTech
@BasonTech Жыл бұрын
The same as the thumbnail shows. Unfortunately my guess is that the position is not really comparable between devices.
@myintlwinhtoo6683
@myintlwinhtoo6683 2 жыл бұрын
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?
@BasonTech
@BasonTech 2 жыл бұрын
Hi, what do you want to achieve with the LED?
@wangyilu1910
@wangyilu1910 2 жыл бұрын
thank for the video and do u know how to detect the frequency of acoustic signal using this circuit?
@BasonTech
@BasonTech 2 жыл бұрын
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.
@drazenlastname254
@drazenlastname254 3 жыл бұрын
Very clear. 1 question. Is there a formula i can use to show the Sound waves in Db values?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@nurulnadhirah5836
@nurulnadhirah5836 3 жыл бұрын
Hi ! 1. Can I connect more than one sound sensor at one time? 2. Can the data transfer to a bluetooth serial transreciever?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@nonoali3156
@nonoali3156 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@ac4cars656
@ac4cars656 2 жыл бұрын
Excellent video, very well explained....
@BasonTech
@BasonTech 2 жыл бұрын
Thanks, appreciated! 😃
@diba2963
@diba2963 11 ай бұрын
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 !.
@BasonTech
@BasonTech 10 ай бұрын
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.
@frans0072
@frans0072 3 жыл бұрын
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??
@BasonTech
@BasonTech 3 жыл бұрын
Heel lastig te zeggen, heb je een linkje naar het component?
@case540
@case540 3 жыл бұрын
In part 2 you keep saying measuring sound amplitude but it isn't that right? Like, a constant whisper right about the threshold would have a higher value than a super sudden gunshot
@BasonTech
@BasonTech 3 жыл бұрын
Maybe amplitude wasn't the best word to pick. I calculate the time there was sound for a certain periode of time. I sample for the duration of SAMPLE_TIME to see how much time there was a sound.
@nurulnadhirah5836
@nurulnadhirah5836 2 жыл бұрын
May I know what is the unit reading of the output in serial plotter
@BasonTech
@BasonTech 2 жыл бұрын
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.
@ferrelmanafe9162
@ferrelmanafe9162 3 жыл бұрын
Your video is amazing, thank you so much
@BasonTech
@BasonTech 3 жыл бұрын
Hi, great to hear! Thanks! 😃
@delux37playsyt30
@delux37playsyt30 Жыл бұрын
Can we compare 2 different microphones (sound sensors) to see which one is louder and send an output on one? If yes, please tell me how
@BasonTech
@BasonTech Жыл бұрын
You can't. This sensor does not measure loudness. It measures if there is sound or not. So the answer of the sensor is either "yes" or "no". No such thing as volume, decibel, loudness, intensity etc. In this tutorial I sample sound for a certain period. The y-axis only tells you the sound intensity during the measured sampled period of time.
@delux37playsyt30
@delux37playsyt30 Жыл бұрын
@@BasonTech Thanks for the reply! Is there any sensor that can measure the volume, decibel level and etc... mentioned above?
@majorchristopherkyle1077
@majorchristopherkyle1077 Жыл бұрын
Hey what a coincidence.....I am trying something similar too... I am trying to compare the output of two mics kept on left and right and rotate servo motor to that direction.... Did you find anything more about this?....If so please share...highly appreciated....
@majorchristopherkyle1077
@majorchristopherkyle1077 Жыл бұрын
@@delux37playsyt30 I was planning to use a amplifer + Mic module like a MAX4466 and get the audio input and compare them etc etc....
@delux37playsyt30
@delux37playsyt30 Жыл бұрын
@majorchristopherkyle1077 I did a bit nore digging around and found that if your sound sensor has an AO (analog) pin, you can use it to monitor different levels of volume inputs. Hope this helps!
@dogrsbr
@dogrsbr 4 жыл бұрын
Congratulations was cool, but have you ever thought about making a spectrum analyzer using WS2818 led strip and the sound sensor?
@BasonTech
@BasonTech 4 жыл бұрын
Hi Luiz, yes I did! Unfortunately time is currently not on my side, but it is definitely something I want to look into 😃
@dogrsbr
@dogrsbr 4 жыл бұрын
@@BasonTech do you have the code ready?
@BasonTech
@BasonTech 4 жыл бұрын
Nope, I have the parts laying around, but not yet build anything
@jain28vaibhav
@jain28vaibhav Жыл бұрын
Can you please make a video for frequency vs amplitude
@BasonTech
@BasonTech Жыл бұрын
I'll write it down as a possible video topic, no guarantees though 😉
@jain28vaibhav
@jain28vaibhav Жыл бұрын
@@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
@BasonTech
@BasonTech Жыл бұрын
Then you have to search how to use a microphone on an Arduino and get the information you want from its data.
@ahmedal-farsi1038
@ahmedal-farsi1038 3 ай бұрын
clear and simple thanks
@BasonTech
@BasonTech 3 ай бұрын
You're welcome! 😃
@fantastique1369
@fantastique1369 3 жыл бұрын
Great tutorial ! Thank you !
@BasonTech
@BasonTech 3 жыл бұрын
You're welcome! 😃
@admharrr1038
@admharrr1038 3 жыл бұрын
Can you explain to me the logic behind the code?Im a beginner but im curious about the workings of this code.I do understand the functions and variables but i don’t understand the logic.Please explain😇😇
@BasonTech
@BasonTech 3 жыл бұрын
I explain the code in the video, what is the part you don't understand?
@makeit955
@makeit955 3 жыл бұрын
thanks this really helped
@BasonTech
@BasonTech 3 жыл бұрын
Great to hear! 😃
@MusabNawaz-ef5yd
@MusabNawaz-ef5yd 4 ай бұрын
How to utilize these value for perdition as i want send to ai model value which i build for perdition , as want to perdidict baby is crying or not?? Please anyone can help
@BasonTech
@BasonTech 3 ай бұрын
Unfortunately this is not possible with this sensor. It does not provide you with any frequency data or waveform.
@ismaelgarzonsaldana6368
@ismaelgarzonsaldana6368 2 жыл бұрын
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
@BasonTech
@BasonTech 2 жыл бұрын
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.
@eranfeit
@eranfeit 4 жыл бұрын
Nice demo
@BasonTech
@BasonTech 4 жыл бұрын
Thanks! 😃
@selmankirit6011
@selmankirit6011 Жыл бұрын
How can I reflect this kind of graph to the 5110 lcd.
@BasonTech
@BasonTech Жыл бұрын
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.
@avocadosnchocolates
@avocadosnchocolates 3 жыл бұрын
THANKS THIS HELPED ME A LOT!! may i know like where do i enter the code on
@BasonTech
@BasonTech 3 жыл бұрын
Hi, what do mean exactly?
@medb2322
@medb2322 2 жыл бұрын
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 .
@BasonTech
@BasonTech 2 жыл бұрын
The code should work on an ESP8266 😃
@prahar112
@prahar112 Жыл бұрын
How to know the sound values in terms of decibels?
@BasonTech
@BasonTech 11 ай бұрын
You can't with this sensor. It just gives you an prediction of the sound intensity.
@nemanjaasanin9975
@nemanjaasanin9975 3 жыл бұрын
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.
@nemanjaasanin9975
@nemanjaasanin9975 3 жыл бұрын
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
@BasonTech
@BasonTech 3 жыл бұрын
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)) {
@nemanjaasanin9975
@nemanjaasanin9975 3 жыл бұрын
@@BasonTech Perfect, that works great, thanks for the help!
@BasonTech
@BasonTech 3 жыл бұрын
Great to hear! 😃
@Icecoldvibez
@Icecoldvibez 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@mohamedalismacktalk382
@mohamedalismacktalk382 2 жыл бұрын
Thank you so much that helped me a lot
@BasonTech
@BasonTech 2 жыл бұрын
Great to hear! 😃
@Lgp2111
@Lgp2111 2 жыл бұрын
interesting video! i guess we can figured out the frequency of the sound based of the sampling? i hope u answer my question
@BasonTech
@BasonTech 2 жыл бұрын
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 😃
@viplovekanaujia3674
@viplovekanaujia3674 3 жыл бұрын
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
@BasonTech
@BasonTech 3 жыл бұрын
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
@bernardcorpinjr.8754
@bernardcorpinjr.8754 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
Hi, sure you can. Just add an if statement which monitors the current value. When it is larger you turn on the LED.
@jabujavi
@jabujavi 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@chamodya6503
@chamodya6503 2 жыл бұрын
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 ?
@BasonTech
@BasonTech 2 жыл бұрын
I can't think of anything why that wouldn't work 😃
@chamodya6503
@chamodya6503 2 жыл бұрын
@@BasonTech ok thank you sir ..😊
@kquirim4541
@kquirim4541 9 ай бұрын
"In this tutorial im going to show how to use the sound sensor on a serial plotter" **MM2 Roblox music starts playing**
@BasonTech
@BasonTech 7 ай бұрын
Lol, the tune was a free song in iMovie, 5 years ago 😄
@umairansar5415
@umairansar5415 4 жыл бұрын
Exactly what I was looking for.
@BasonTech
@BasonTech 4 жыл бұрын
Great to hear! If you have any questions, just ask 😃
@umairansar5415
@umairansar5415 4 жыл бұрын
@@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!
@BasonTech
@BasonTech 4 жыл бұрын
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
@justkez2359
@justkez2359 Жыл бұрын
How can i use the different decibel/sound values in my code
@BasonTech
@BasonTech Жыл бұрын
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.
@hyperrunner4589
@hyperrunner4589 4 жыл бұрын
How to use arduino, 16bit adc and Bluetooth module to transmit digital audio to bluetooth earphone?
@BasonTech
@BasonTech 4 жыл бұрын
Sorry I have no experience with these components. Maybe you can ask on the Arduino Reddit of on the Arduino forum?
@jesusitarodriguez2381
@jesusitarodriguez2381 3 жыл бұрын
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
@BasonTech
@BasonTech 3 жыл бұрын
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
@jesusitarodriguez2381
@jesusitarodriguez2381 3 жыл бұрын
@@BasonTech thanks
@TutosIngenieria
@TutosIngenieria 4 жыл бұрын
Really amazing video, thank you lots.
@BasonTech
@BasonTech 4 жыл бұрын
Glad you liked it! 😃
@keegancorey7750
@keegancorey7750 3 жыл бұрын
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
@peterhendrix8347
@peterhendrix8347 3 жыл бұрын
@Keegan Corey Yea, have been watching on InstaFlixxer for years myself :D
@samitabarde2122
@samitabarde2122 2 жыл бұрын
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?
@BasonTech
@BasonTech 2 жыл бұрын
Hi, this is not possible. The sensor just detects if there is sound or not. The highest achievable would be "clap detection".
@samitabarde2122
@samitabarde2122 2 жыл бұрын
@@BasonTech so can this be achieved using KY-037 or 038?
@samitabarde2122
@samitabarde2122 2 жыл бұрын
@@BasonTech I am trying to turn on the camera when the cry is detected using sound module..help me out please 😅
@BasonTech
@BasonTech 2 жыл бұрын
It could be, the biggest issue is to detect the characteristics of the waveform what we see as "cry" of "laugh".
@Nino-pp5hr
@Nino-pp5hr 3 жыл бұрын
can i ask if you know how to show the decibel equivalent of the sound? I've having a hard time with it .
@BasonTech
@BasonTech 3 жыл бұрын
You can't with this sensor. It does not measure decibel at all.
@shiro_leroy
@shiro_leroy 3 жыл бұрын
Can i use audio signal with RCA cables without microphone?
@BasonTech
@BasonTech 3 жыл бұрын
No you can't. For that you need a different circuit this is just a binary sound sensor.
@achmadarifmunaji3320
@achmadarifmunaji3320 3 жыл бұрын
very good video. roughly what sensor is suitable for measuring the number of dB?
@BasonTech
@BasonTech 3 жыл бұрын
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
@achmadarifmunaji3320
@achmadarifmunaji3320 3 жыл бұрын
@@BasonTech thanks
@mwaseemaslam3478
@mwaseemaslam3478 Ай бұрын
Can you help me to build a circuit for my University project?
@BasonTech
@BasonTech 29 күн бұрын
Hi, I am sorry I don't have time for helping with individual projects 😐
@therealmonkeys1
@therealmonkeys1 3 жыл бұрын
Hi any tips how to send this data over Bluetooth? I'm making a Bluetooth headset
@therealmonkeys1
@therealmonkeys1 3 жыл бұрын
I want to send it to my pc
@BasonTech
@BasonTech 3 жыл бұрын
this is no audio data, so there is no way to transmit this as audio. It purely sampled data from the sensor
@r15v2empires8
@r15v2empires8 2 жыл бұрын
Sir i want detect particular sound only. It can do Or not?
@BasonTech
@BasonTech 2 жыл бұрын
Unfortunately this sensor can't. You might want to look into a Raspberry Pi or Sony Spresense
@r15v2empires8
@r15v2empires8 2 жыл бұрын
@@BasonTech thank you bro
@automation4446
@automation4446 3 жыл бұрын
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!
@BasonTech
@BasonTech 3 жыл бұрын
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. 😃
@user-no9gw5xm6i
@user-no9gw5xm6i 3 ай бұрын
Explain this 0 is high and 1 is low?
@redabitar
@redabitar 3 жыл бұрын
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)?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@harshmirdhwal
@harshmirdhwal 3 жыл бұрын
can't we use earphone's mic to as a sound sensor if yes then please make a video on it
@BasonTech
@BasonTech 3 жыл бұрын
That should be possible, I have no clue how though 😄
@harshmirdhwal
@harshmirdhwal 3 жыл бұрын
@@BasonTech oh I tried just right now, but being a noob, didn't make it! 😅, hoped you would help, BTW thanks
@BasonTech
@BasonTech 3 жыл бұрын
My pleasure! 😃
@surajnair2315
@surajnair2315 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
The sensor just measures if there is sound or not. So there is no measurement of the intensity, decibel, frequency or whatsoever.
@surajnair2315
@surajnair2315 3 жыл бұрын
@@BasonTech so what's the solution for this?
@BasonTech
@BasonTech 3 жыл бұрын
Probably use a "real" decibel sensor. Unfortunately I have no experience with these
@surajnair2315
@surajnair2315 3 жыл бұрын
@@BasonTech no problem.. Thanks for replying
@vinhvo9177
@vinhvo9177 3 жыл бұрын
Really amazing video, thank you
@BasonTech
@BasonTech 3 жыл бұрын
Great to hear, thanks! 😃
@chouaibchouaib4880
@chouaibchouaib4880 5 ай бұрын
It's possible to stream the sound directly with the PC speakers??
@BasonTech
@BasonTech 5 ай бұрын
Not really because it is not a sound wave. It is just a representation of the amount of sound.
@chouaibchouaib4880
@chouaibchouaib4880 5 ай бұрын
@@BasonTech how can stream the sound using this microphone module??
@BasonTech
@BasonTech 4 ай бұрын
This module can't.
@abhyudaya98
@abhyudaya98 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
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.
@sohambhattacharya5630
@sohambhattacharya5630 3 жыл бұрын
How to display these types of spectrum anysis on a P10 led module
@BasonTech
@BasonTech 3 жыл бұрын
Then you have to translate the chart values to bar lengths, and show this on the P10 module
@anamixnetwork8446
@anamixnetwork8446 2 жыл бұрын
Is it possible to save the audio files as .wave? Using this sensor
@BasonTech
@BasonTech 2 жыл бұрын
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.
@wheresmycookie998
@wheresmycookie998 Жыл бұрын
Why is my serial plotter going so fast? Do you know how can I fix that?
@BasonTech
@BasonTech Жыл бұрын
Increase the value of SAMPLE_TIME it will then measure longer before plotting the buffer.
@jam1930
@jam1930 3 жыл бұрын
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?
@BasonTech
@BasonTech 3 жыл бұрын
Are you 100% sure you have the same sensor? I know there are sensors with analogue output as well 😃
@jam1930
@jam1930 3 жыл бұрын
@@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
@BasonTech
@BasonTech 3 жыл бұрын
Great you solved it! 😃
@Ferreira019760
@Ferreira019760 3 жыл бұрын
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.
@BasonTech
@BasonTech 3 жыл бұрын
Good question! You probably can do something with the millis() function to measure elapsed time? Although this is not super accurate.
@wilnil
@wilnil 4 жыл бұрын
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?
@BasonTech
@BasonTech 4 жыл бұрын
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 😃
@wilnil
@wilnil 4 жыл бұрын
@@BasonTech Thanks that worked! The potentiometer was so ridiculously sensitive though :D
How I Did The SELF BENDING Spoon 😱🥄 #shorts
00:19
Wian
Рет қаралды 35 МЛН
UNO!
00:18
БРУНО
Рет қаралды 4,5 МЛН
Fortunately, Ultraman protects me  #shorts #ultraman #ultramantiga #liveaction
00:10
How To Use Arduino's Serial Plotter
8:08
Elektor TV
Рет қаралды 46 М.
My Weekend Project: Audio Frequency Detector Using An Arduino
14:04
Clyde Lettsome, PhD, PE
Рет қаралды 57 М.
Lesson 20 - Sound Sensor Module KY-038
26:46
Ricardo Moreno
Рет қаралды 127 М.
You can learn Arduino in 15 minutes.
16:34
Afrotechmods
Рет қаралды 10 МЛН
Try these 16 Brilliant ESP32 projects!!!
11:18
ToP Projects Compilation
Рет қаралды 565 М.
Make your own Spy Bug (Arduino Voice Recorder)
7:18
GreatScott!
Рет қаралды 429 М.
Extracting Firmware from Embedded Devices (SPI NOR Flash) ⚡
18:41
Flashback Team
Рет қаралды 566 М.
How I Did The SELF BENDING Spoon 😱🥄 #shorts
00:19
Wian
Рет қаралды 35 МЛН