Тёмный
No video :(

Arduino Spectrum Analyzer with OLED Display 

Gadget Reboot
Подписаться 31 тыс.
Просмотров 25 тыс.
50% 1

Here I build an Arduino spectrum analyzer with a 128x64 OLED display showing 64 frequency bins and testing the limits of a 16 MHz Arduino Uno using the analogRead function (better performance is possible by directly controlling the ADC).
Using a signal generator and sweeping a test waveform, the functionality is validated, including observed limitations due to aliasing when the input frequency is too high for the sample rate.
Sketch and Schematic: github.com/Gad...
Similar project from cbm80amiga: • Arduino simple audio s...
Similar project from learnelectronics: • Video
Patreon: / gadgetreboot
Pinterest: www.pinterest....
Twitter: @GadgetReboot / gadgetreboot

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 62   
@pietrononame4945
@pietrononame4945 2 года назад
This is the best tutorial regarding FFT audio spectrum analysis for programmers.
@laszlovona
@laszlovona 3 года назад
Arduino is a tool, libraries are tools, not necessary to have a deep understanding of all tools we use.. This was a very good explanation, staying on a level without heavy math and more important the mind twisting abstraction an EE studies for at least 2-3 semester (and further if you go dsp or telco specialization): going back and forth between time and frequency domain, Fourier, Laplace, Z, plus all the inverse transformation and even sicker stuff when the above is combined stochastic processes.. This latter comes into play in telco a lot. 👍
@GadgetReboot
@GadgetReboot 3 года назад
Yes I'm working on a project right now trying to use the simple way of coming up with a bunch of RC filter component values (8 total cascaded) by using LT Spice to look at the Bode plot and build the filter up bit by bit visually to get the response needed instead of trying to figure out some big 20 page long transfer function to solve it...and I think I figured it out! But no idea how to calculate it...who cares though. I'm going to be making a video on it soon. It's a pink noise filter.
@laszlovona
@laszlovona 3 года назад
@@GadgetReboot very good! Now thats what I call a pragmatic approach 😀 and like it! Looking forward to receiveing the video notification on that👍
@GnuReligion
@GnuReligion 6 лет назад
This is one of your best videos. I have tears in my eyes right now. You have the perfect blend of intellectual honesty, and the drive to explain in plain, obvious terms.
@GadgetReboot
@GadgetReboot 6 лет назад
Thanks! I was actually quite frustrated trying to get this video done for the past four days ( I was targeting to release it two days ago) because I tend to have high expectations of what I should be able to accomplish and it’s a struggle to know when to just move on and get things done. I can always do a follow up with more information later but that’s not always obvious when I want to do everything all at once. I want to explore a bunch of projects for my own learning and amusement while at the same time passing on whatever I can to help others and my goal on here is to be part of it shared community where I can seek and source inspiration... kind of like sinking and sourcing current I suppose. I must have watched 30 videos and looked at 50 different webpages about how to understand FFT and I kept realizing that I find myself thinking, these people all seem to understand the subject but they don’t understand how to pass it on to me and I didn’t want to just perpetuate that situation so if I ever figure out how to understand it myself and how to pass it on, I’ll be back. Maybe I should have taken that DSP elective course 20 years ago. I took VLSI chip design instead. That reminds me, I need to dig out my FPGA kits soon.
@GnuReligion
@GnuReligion 6 лет назад
One on my primal teachers, Kendall Morris, now a PhD at USF in Neuroscience, once gave me a lesson in High School. "Now I will demonstrate, a person who does not possess the the skill to catch and throw in the left hand, how to juggle." No way. And yet, in a 30 minute session, in High School, he taught a girl to juggle more than 6 rounds, in less than half an hour. And at nearly 50, I still do not possess this ability to teach this skill. I want, what to this day, to learn is this magic? I love you people who know how to teach these smart skills. I want to be one.
@GadgetReboot
@GadgetReboot 6 лет назад
I never could learn to juggle. I wonder if there is a video out there that could teach me in a short while. That would be funny. But not with hot soldering irons and air guns. Maybe next year.
@GnuReligion
@GnuReligion 6 лет назад
Gadget Reboot Well, I know how to teach you, maybe not in 30 minutes, .... But don't live in Cananda. I must need some kind of bussport. "Oh Canada, our home and native land. God Save the Queen, her wish is our command." -- Well, that can't be right.
@GadgetReboot
@GadgetReboot 6 лет назад
Make an instructional video! Well those lyrics make me want to go listen to punk music now for some reason.
@fernyias
@fernyias 3 года назад
I can finally understand the sketch! Thank you 😊
@qzorn4440
@qzorn4440 3 года назад
wow, every time i get into this fft i learn a little more... very nice explanation... i would like to use this for looking 60 Hz dirty line power harmonics... thanks...:) 😊
@bobbunni8722
@bobbunni8722 5 лет назад
Your explanations are great. Thank you.
@electronic7979
@electronic7979 6 лет назад
Excellent project
@GadgetReboot
@GadgetReboot 6 лет назад
Thanks! This one was fun and educational for me.
@noggin73
@noggin73 6 лет назад
Pretty nice! Gonna try this.
@WilliamDeboer
@WilliamDeboer 6 лет назад
Great video cant wait to try this later.
@patrickfitzgerald6081
@patrickfitzgerald6081 4 года назад
Sketch worked very well. But I had to add two parameters: #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 Until I added these lines the display did not show the data properly. It seems to have defaulted to 64x32 mode.
@oscarilmio7148
@oscarilmio7148 5 лет назад
I really like the reasoning and the research you have done to carry out this project, unfortunately you have run into the usual problem concerning the sampling frequency and the machine cycles for the calculations related to our good and beloved old Arduino. Let me suggest one thing: don't give up and "try" with an ESP32, maybe you will also find many other interesting functions.
@gregvalvo7068
@gregvalvo7068 4 года назад
Nice project. But, your explanation of the "upper" 64 FFT samples is a little off. Those actually contain the FFT points at negative frequencies between -4480 and -70 Hz (based on 9 KHz sample rate and 128 samples). Because you're sampling a purely real signal, the magnitude of its FFT is an even function of frequency. Thus, those "upper" 64 samples contain no addition information and there's no need to consider them.
@HarshKumar66743
@HarshKumar66743 29 дней назад
How can we determine output from the spectrum generated? Someone Please Tell Me!
@browaruspierogus2182
@browaruspierogus2182 6 лет назад
For practical use - there are much faster and better analyzers on PC or you can even write software yourself much easier and it's more powerful. I've seen many amazing audio spectrum analyzers for PC. For higher frequencies much much faster MCU is needed
@GadgetReboot
@GadgetReboot 6 лет назад
It’s more of an experiment and introduction to the topic. I already knew there was an even better algorithm for Arduino but even using this algorithm I think I could get the sampling rate to do the full audio spectrum by directly controlling the ADC. But this gets things going.
@johncundiss9098
@johncundiss9098 Год назад
Just found the video. I do not fully understand what is going on in all of it. Here is what you helped me with. I was trying to make a band scope for ham radio. I could not figure out or understand what the ghosting was. I understand now what is happening, sort of. How to fix it though. Need lots and lots of samples, taken at a fast rate. Need a fast number cruncher. Now to find out how to get only relevant data to show up.
@jaimem1918
@jaimem1918 5 лет назад
Hey, great project, I was wondering how can I print in the IDE's serial monitor the value that the OLED is showing, I mean the process signal after the FFT?, I tried printing "DAT" but it only shows low values and I want for it to show me the signal frequency
@GadgetReboot
@GadgetReboot 5 лет назад
I don’t remember what the DAT magnitude number itself represents other than some sort of normalized level that will fit on the display to show some sort of presence at each frequency but to print out the actual frequency that a given DAT value refers to, in the loop where DAT is shown on the display, it cycles through array elements 0 through 63 and each of those DAT values represents the signal presence for a frequency that is at 70 Hz intervals between each array element, and 70 Hz would be the centre frequency. So going through the loop if you print out the DAT value on the serial monitor and if you also print out (70 * i+1), that should be the centre frequency for the DAT value. I=0: freq = 70 Hz I=1: freq = 140 Hz Etc That’s just off the top of my head so if I were going to implement that I would probably test by getting a signal generator with a specific frequency that I can try out and make sure the serial monitor prints the correct frequency.
@HazeAnderson
@HazeAnderson 5 лет назад
Very cool projects! Congrats! Nyquist's theorem is wonderful thing. Since you are only using the 1st 64 elements in your arrays to draw lines ... perhaps those arrays need only be 64 elements in size? 😏👉
@GadgetReboot
@GadgetReboot 5 лет назад
I can’t remember how the functions work now and whether or not they would complain if I changed the size of the array but of course if this were for something outside the workbench it would be optimized. Or if I knew more about programming. When it comes to software, I do it in a way equivalent to twisting stranded wires together and not even insulating them and then just tucking them all inside a box and hoping for the best!
@HazeAnderson
@HazeAnderson 5 лет назад
The most important quality of software is simply this: correctness. Everything else revolves around maintaining it and/or extended it and/or making it go faster and/or making it use less memory. Anyone can write software, but only a few trained folks can deploy software into production. In terms of this project, if it still works (for you) then it doesn't matter how you did it .. UNLESS others use your software as well. All of these methodologies that make software engineering so dang complicated stem from getting humans to work with each other. It's a whole lot easier to fake your results in software than in hardware ... and there are a LOT of dead ends around to waste your time when learning. I think it would be a fair assumption to say that many programmers liken compiling their code to working with a soldering iron, when this is the furthest thing from reality. Compiling code is more like plugging in a wall wart. Seriously. So you deal with some pretty ridiculous egos but all this complexity in learning really boils down to trying to find A PATH ... and then trying to learn how to NAVIGATE that path. Sadly, the hardest part about learning how to program/software engineering ... is getting past the massive amounts of BS out there ... it's quite incredible really.
@GadgetReboot
@GadgetReboot 5 лет назад
I think I will be learning a lot this year both hardware and software, for the projects I do on the hobby level. It’s 90% more fun and more progressive than if I had to do it to someone else’s standards or expectations in a work environment so I have that on my side. It’s good when tasks don’t feel like work but simply tasks. Right now I’m working on a PCB layout for myself and what a difference when I’m not doing it on a schedule or to fit in a pre-determined board space that may not even be realistic. So much more fun. “ The mechanicals for the enclosure plastics have already been set in stone and tooled so we have no choice “. “ The size of the plastics around the silicon die for this ic package are already tooled and set in stone, so I have no choice either. “ ( and the part does not come in a smaller package )
@Attilator
@Attilator 4 года назад
Thanks for the demo and the detailed explanation. I learned the basics and I plan to assemble this curcuit. I heard that the Fast Hartley Transform is faster and less "resource" demanding. Any chance to try this approach and compare the results? This way it might capture a wider frequency range, too. Keep up the good work.
@GadgetReboot
@GadgetReboot 4 года назад
I’m going to look into that, thanks for pointing it out!
@Attilator
@Attilator 4 года назад
@@GadgetReboot maybe one more idea, which I also plan to use, is to replace Arduino with STM32F103C8T6 Dev. Board. It has 72Mhz and higher SRAM and Flash - so might have the horsepower to do the spectrum analysis for even higher frequencieswithout any change.
@Attilator
@Attilator 4 года назад
@@GadgetReboot I found a very interesting code for 32 band spectrum analyzer, which captures a band of 100-19000Hz! It was written for LED Matrix, so I changed it for my small OLED. Here is my first watchable result: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-abc_B-N8WJo.html
@Attilator
@Attilator 4 года назад
I managed to capture 20Hz - 19kHz range with Nano. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gTwVPn7Fx1A.html
@zkljaja
@zkljaja 4 года назад
I just can't get the visuals youre getting on the OLED with using copy-paste code...i get a line here and there, and baseline seems to be "under" the screen
@medb2322
@medb2322 2 года назад
hi everyone in my case i don't have an OLED what can I change in the code to display it on serial plotter ?? need your help, please
@waynepryce34
@waynepryce34 3 года назад
What voltage lipo battery do you think i can use with this
@zkljaja
@zkljaja 5 лет назад
If I added "low" pass filter up to 5KHz or band pass filter up to 4 KHz...could I increase the resolution? If I had 9KHz sample rate, but only 0-4.5 KHz to fit in 128 bins, would that give me 35 Hz wide bins?
@DavidMsg
@DavidMsg 3 года назад
How do you solve the folding issue? Use a low pass filter on the audio input?
@GadgetReboot
@GadgetReboot 3 года назад
Limiting the input max freq. would eliminate the ghosting (whatever is shown would be real) but otherwise to be able to use the whole frequency range, a faster sample rate (faster ADC read capability) would be needed to meet Nyquist criteria (sample rate > 2x input max freq.)
@martynko6692
@martynko6692 4 года назад
Try use SPI display, it woutd be more faster FPS on display, I2C slowing all procedure...
@wheresblxckstar
@wheresblxckstar 2 года назад
hello, im a newbie can u show me how to setup the analyzer and arduino
@titangamers7111
@titangamers7111 4 года назад
Kindly show how to deploy this spectrum on led strips.
@donaldhenke2750
@donaldhenke2750 4 года назад
HELP i did what you said but all i get is 2 freq. showing on display . thats with the gain on microphone turned all the way up. the mic is a max4466. can you tell me whats not right please?
@GadgetReboot
@GadgetReboot 4 года назад
Does the max4466 work on its own if you plug that into some other amplifier to rule that out as a fault? Do you have some sort of signal generator, even a simple 555 or logic gate oscillator that can generate some frequency that can be checked as an input signal source? Then the problem could be isolated between the audio source or the spectrum analyzer.
@donaldhenke2750
@donaldhenke2750 4 года назад
@@GadgetReboot yes i used one that is on another project an was good. i even tryed 3 other max4466. ill try the 555 timer if that is what your talking about?
@GadgetReboot
@GadgetReboot 4 года назад
@@donaldhenke2750 yeah a 555 timer circuit with a frequency no more than a couple of kHz should be detectable.
@Electronieks
@Electronieks 3 года назад
How to fix the aliasig from4500 and up?
@GadgetReboot
@GadgetReboot 3 года назад
Need to sample at a higher rate using nyquist theorem, I think sample rate should be at least 2.2 times higher than measured frequency. So that's why Arduino Uno can only measure 4.5K with the speed it's running. It can be tweaked with better code but realistically just a faster chip or dedicated ADC external hardware are needed.
@Electronieks
@Electronieks 3 года назад
@@GadgetReboot i changed to esp now...these is a lot faster . thx for your reply
Далее
#313 Useful? Cheap Spectrum Analyzer LTDZ 35-4400M
21:26
НЕ ИГРАЙ В ЭТУ ИГРУ! 😂 #Shorts
00:28
Просмотров 287 тыс.
مسبح السرير #قصير
00:19
Просмотров 2,1 млн
OLED Displays with Arduino - I2C & SPI OLEDs
41:41
Просмотров 1,1 млн
ESP Spectrum Analyzer Code Review Part 1
22:22
Просмотров 19 тыс.
Arduino Projects - 12 GREAT Ideas for you!!!
9:00
Просмотров 362 тыс.
Audio Spectrum Analyzer on the Cheap (032 )
17:01
Просмотров 19 тыс.
EEVblog #1109 - Spectrum Analyser Design Walk-through
25:41
Introduction to TDR Prism and TDR Special Filters
41:55
НЕ ИГРАЙ В ЭТУ ИГРУ! 😂 #Shorts
00:28
Просмотров 287 тыс.