Issue with connection and NodeMCU V3

no - seeking clarification of why you need to SO MANY samples?

what are you going to do with them? will the human mind be able to notice the thing that you do with them, or are you sampling for no gains?

Wait so who was right??? Sorry for the confusion. I appreciate all of the help, you were the one that led me to a link clicking sequence that led me to the final answer!

What were you saying about sampling the audio at too high of frequency? Should I change my coding?

oh? you really want to know?

here’s some fun: analogRead - divide by 1023 or 1024? - Programming Questions - Arduino Forum[quote=“bmoe24x, post:43, topic:10697”]
What were you saying about sampling the audio at too high of frequency? Should I change my coding?
[/quote]

sorry, i double posted, my bad… (it’s 40 degrees here, and i have only just cracked my first beer…)

I am very confused… That code was directly from Adafruit as setup for this microphone. If it is wrong I would be happy to hear the justification, but to me it looks like it is being kept in the range 0-1023 (1024 steps).

Still no hint at the sampling rate?

dont worry, the code is OK for your purpose.

i don’t know why you need so many samples. what will your sketch do with these in real life?

Okay haha.

I am sampling audio, the general purpose is that when there is a loud signal coming in (bass hit, drum beat, etc) that the lights will brighten up temporarily

1 Like

but have you ever heard music that is 60’000bpm? (1000Hz x 60 seconds)

the music i listen to is around 140bpm… so i expect it will brighten/darken at that rate… and get brighter the more sound there is, and go darker the quieter the music is…

or am i missing something? are you averaging the 1000 samples or something?

or are there individual colours for the different frequencies? (spectrum analyser?)

The code I posted is the extent of the sampling and output. The colors come from a zeRGBa widget.
1000 was just an arbitrary number that was lower than the threshold for the disconnect issue really.

Within a 50 ms window it checks to make sure it hasnt sampled in the last millisecond, sets a max and min, then after the 50ms window it computes the amplitude which is then converted to volts. If the voltage is over my set threshold, the output is brightened.

Are you suggesting I change it to something much smaller? For efficiency reasons? Power reasons?

so it is kinda like only 20 samples per second?

sure, why not have a SLIDER that changes the sampling rate?

see what practical effect it has on the experience you are trying to achieve?

well, as long as it is working, all good, but i personally deal with environment variables, so sampling something even 10 times per minute is usually a waste of processor time and battery life…

EDIT: and if you didn’t want annoying questions, next time dont post this:

:stuck_out_tongue_winking_eye:

Yes kind of. I believe it is set at 50ms intervals because 1000 / 50 = 20 Hz which is a general limit of human hearing.

I could I suppose, I am not looking for crazy accuracy or anything, just enough to detect a large note and a low enough rate so that the NodeMCU doesn’t disconnect from wifi. I will have a slider for threshold to change the light output though!

Not annoying! Just a bit confused on some of them as my knowledge on things like this is so low I can’t yet comprehend what you are hinting at so if you have any extra reasoning or specifics to change that would help clear things up tremendously

generally unless you need high accuracy, you should slow things down… that is really all i am hinting at :slight_smile:

make sure you post up a “things i made with blynk” once you have finished!

Will do. If I can get all the bugs fixed and the whole thing working I might make an instructable to help others with all the weird issues I’ve had. I will be sure to credit your advice! Thanks again

1 Like