Go Down

Topic: hi every one need help  (Read 968 times) previous topic - next topic

alikut99

hi everyone I want make spectrum analyzer  meter led with arduino uon
with switch to change type display
 

more difficulty from this   code
any one help me plzzzzzz :o  :o  :o  :o








int tempo=10; //regolare a piacere
int soglia = 10  ;
int valore  = 0 ;
void setup() {
  for (int i=2;i<=13;i++)
  {
  pinMode (i, OUTPUT);
  }
  Serial.begin(9600);
}

void loop() {
  delay(tempo);
    valore = analogRead(A0);
    //Serial.print("Valore audio: "); //l'output sulla seriale rallenta i led
     //Serial.println(valore);
    if ( (soglia *1)  <valore) {digitalWrite (13 ,HIGH);} else {digitalWrite (13 ,LOW);}
    if ( (soglia *2)  <valore) {digitalWrite (12 ,HIGH);} else {digitalWrite (12 ,LOW);}
    if ( (soglia *3)  <valore) {digitalWrite (11 ,HIGH);} else {digitalWrite (11 ,LOW);}
    if ( (soglia *4)  <valore) {digitalWrite (10 ,HIGH);} else {digitalWrite (10 ,LOW);}
    if ( (soglia *5)  <valore) {digitalWrite (9  ,HIGH);} else {digitalWrite (9  ,LOW);}
    if ( (soglia *6)  <valore) {digitalWrite (8  ,HIGH);} else {digitalWrite (8  ,LOW);}
    if ( (soglia *7)  <valore) {digitalWrite (7  ,HIGH);} else {digitalWrite (7  ,LOW);}
    if ( (soglia *8)  <valore) {digitalWrite (6  ,HIGH);} else {digitalWrite (6  ,LOW);}
    if ( (soglia *9)  <valore) {digitalWrite (5  ,HIGH);} else {digitalWrite (5  ,LOW);}
    if ( (soglia *10) <valore) {digitalWrite (4  ,HIGH);} else {digitalWrite (4  ,LOW);}
    if ( (soglia *11) <valore) {digitalWrite (3  ,HIGH);} else {digitalWrite (3  ,LOW);}
    if ( (soglia *12) <valore) {digitalWrite (2  ,HIGH);} else {digitalWrite (2  ,LOW);}
  }.

AWOL

#1
Apr 26, 2016, 09:06 pm Last Edit: Apr 26, 2016, 09:06 pm by AWOL
Apart from there's too much code (and no code tags), what's the problem?

alikut99

i need more effect (dote or Chang type to anther one )
like this
https://www.youtube.com/watch?v=FEAdiEzz7ho

but i want use ardion uon

AWOL

Nope.
Didn't get any of that.

alikut99


AWOL

I don't know what "dote or Chang type" means.

alikut99

sorry !!!

if i use this( arduino, LOL shield )  to make one or make any suggestion to use anther one  (like video)

DVDdoug

I can't watch the video 'cause I'm at work...   But, I know what a spectrum analyzer is and I've seen it done with the Arduino.

Do you understand how your current code works or did you just copy it from somewhere?  ...It can be very frustrating if you try to copy someone else's project and you don't understand how it works.

What are you doing about the negative half of the AC audio waveform?    The Arduino can't (directly) read negative voltages and in fact it can be damaged by negative voltages.     If you simply clip-off the (or ignore) the negative half of the waveform that will introduce severe distortion and that will mess-up your frequency analysis (spectrum analyzer).

There are a couple of ways to make a spectrum analyzer -

There is a chip called the MSGEQ7 that takes an audio signal as input and puts-out 7 time-multiplexed DC voltages.    The timing is critical and the MSGEQ7 needs a (software generated) clock, so the code isn't super-simple, but it's the simplest way to make a 7-band spectrum analyzer effect.

Another popular approach is to use FFT (or DFT/FHT) to do the frequency analysis in software.   The code is quite a bit more complicated, but there are libraries so you don't have to write it all from scratch.

And, you'll need some additional hardware (and software) and way to address & drive many LEDs.

polymorph

Please read "How to use this forum" and pay special attention to rule number 6:

http://forum.arduino.cc/index.php/topic,148850.0.html
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

pjrc

This example I published implements a 60 band by 32 level (1920 addressable LEDs) spectrum display, based on 1024 point FFT.  It won't run on Uno, but if you can step up to a more powerful board... maybe it'll help?

https://github.com/PaulStoffregen/OctoWS2811/blob/master/examples/SpectrumAnalyzer/SpectrumAnalyzer.ino

el_supremo

@alikut99: What you say you want is a spectrum analyzer. But the code you posted is a simple attempt at a VU meter. The youtube video also shows a VU meter.
A VU meter is not a spectrum analyzer.
Which do you want?

Pete
Don't send me technical questions via Private Message.

alikut99

like this
or more complex


https://www.youtube.com/watch?v=0UIsyPAJ4hI

polymorph

#12
Jul 15, 2016, 09:10 pm Last Edit: Jul 15, 2016, 09:11 pm by polymorph
OK... in the description of the video you linked to:

Quote
Published on Jun 22, 2016
making dancing audio spectrum with arduino
code download link
http://q.gs/6999428/audio-spectrum-code
diagram download link
http://q.gs/6999428/audio-spectrum-image
Also, that is merely a VU meter, not a spectrum display.

And I reiterate:

Please read "How to use this forum" and pay special attention to rule number 6:

http://forum.arduino.cc/index.php/topic,148850.0.html
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up