Anda di halaman 1dari 12

https://www.arduinolibraries.

info/libraries/fix_fft

https://github.com/kosme/arduinoFFT
/*

* Arduino Spectrum Analizer

* learnelectronics

* 27 April 2017

* black magic stolen from CBM80Amiga

* www.youtube.com/c/learnelectronics

* arduino1069@gmail.com

* Fix_FFT library available @ https://github.com/kosme/arduinoFFT

*/

#include "fix_fft.h" //library to perfom the Fast Fourier Transform

#include <SPI.h> //SPI library


#include <Wire.h> //I2C library for OLED

#include <Adafruit_GFX.h> //graphics library for OLED

#include <Adafruit_SSD1306.h> //OLED driver

#define OLED_RESET 4 //OLED reset, not hooked up but required by library

Adafruit_SSD1306 display(OLED_RESET); //declare instance of OLED library called display

char im[128], data[128]; //variables for the FFT

char x = 0, ylim = 60; //variables for drawing the graphics

int i = 0, val; //counters

void setup()

Serial.begin(9600); //serial comms for debuging

display.begin(SSD1306_SWITCHCAPVCC,0x3C); //begin OLED @ hex addy 0x3C

display.setTextSize(1); //set OLED text size to 1 (1-6)

display.setTextColor(WHITE); //set text color to white

display.clearDisplay(); //clear display

analogReference(DEFAULT); // Use default (5v) aref voltage.

};

void loop()

int min=1024, max=0; //set minumum & maximum ADC values

for (i = 0; i < 128; i++) { //take 128 samples

val = analogRead(A0); //get audio from Analog 0

data[i] = val / 4 - 128; //each element of array is val/4-128

im[i] = 0; //

if(val>max) max=val; //capture maximum level

if(val<min) min=val; //capture minimum level

};
fix_fft(data, im, 7, 0); //perform the FFT on data

display.clearDisplay(); //clear display

for (i = 1; i < 64; i++) { // In the current design, 60Hz and noise

int dat = sqrt(data[i] * data[i] + im[i] * im[i]);//filter out noise and hum

display.drawLine(i*2 + x, ylim, i*2 + x, ylim - dat, WHITE); // draw bar graphics for freqs above
500Hz to buffer

};

display.setCursor(0,0); //set cursor to top of screen

display.print("->Spectrum Analizer<-"); //print title to buffer

display.display(); //show the buffer

};
23 desember 2019

https://www.youtube.com/watch?v=EnvhEgjrHsw

https://drive.google.com/drive/folders/0B_jncvz2HAYCfnhENzcxekxiTURWaGdxQzlaOV9qRE1IdTlWa
zNFSWJLYUFVZmt1THZQRmc

Coba rangkaian Spectrum analyzer ini !

1. Resistor 100k (1) , 10 k (2)


2. Kapasitor 0,1 uF 16V(2)
3. 2N3904 (1)
4. Electra Micrphone
24 desember 2019

1. Potensiometer 10 K
2. Kapasitor 10 uF 16 V
3. Kapasitor 220 – 470 uF (250 uF ** rekoemndasi) 16 V
4. Resistor 10 ohm
5. 0.05 uF (rekoemndasi) atau 0.47 uF
6. 10 uF 16 V
7. 47 – 100uF 16 V
8. Resistor 100k (1) , 10 k (2)
9. Kapasitor 0,1 uF 16V(2)
10. 2N3904 (1)
11. Electra Micrphone
Gain

A= 200

B= 50

C= manikkan level 5 dB

https://www.electroschematics.com/lm386-audio-amplifier/

https://www.instructables.com/id/Pre-amp-to-electret-mic/
1. Potensiometer 10 K
2. Kapasitor 10 uF 16 V (2)
3. Kapasitor 250 uF 16 V
4. Kapasitor 0,1 uF 16V (2)
5. 0.05 uF (rekoemndasi) atau 0.47 uF
6. 47 – 100uF 16 V (100 uF)
7. Resistor 100k , 10 k (10), 10 ohm , 4,7 k (8)
8. 2N3904
9. Electra Micrphone
10. IC LM386 (DIP) + soket IC
25 Desember 2019

1. Analisis sound speaker


Lapiran dapat dilihat pada file hardware

26 Desember 2019

1. Percobaan spektrum analyzer dengan penguatan


Power Suplay (4,9 Volt
&1A) SDA
O
SCL
LE
D

FG A0 Arduino

100uF
27 Desember 2019