Tell us about yourself!

Complete Your Profile
  • Huray! Today I managed to make a stepper motor move, when a specific audio frequency in a audiosignal reaches a specific level. // See a video here: https://www.youtube.com/watch?v=u0zMcRt ... e=youtu.beI added a stepper motor code into my previous code. I declared two Variables BAND and LEVEL. With BAND i will tell the stepper shield, which frequency band to read.With LEVEL i tell the stepper shield, what level in that specific frequency band must be reached, until the loop starts.If the LEVEL reaches a value under LEVEL, then the stepper will stop.Find the new code here:Code: Select all/****************************************************************************** Sketch by Alex Rexbased on:SparkFun Spectrum Shield PWM DemoToni Klopfenstein @ SparkFun ElectronicsFebruary 2015https:/...

    see more »

    Huray! Today I managed to make a stepper motor move, when a specific audio frequency in a audiosignal reaches a specific level. // See a video here: https://www.youtube.com/watch?v=u0zMcRt ... e=youtu.beI added a stepper motor code into my previous code. I declared two Variables BAND and LEVEL. With BAND i will tell the stepper shield, which frequency band to read.With LEVEL i tell the stepper shield, what level in that specific frequency band must be reached, until the loop starts.If the LEVEL reaches a value under LEVEL, then the stepper will stop.Find the new code here:Code: Select all/****************************************************************************** Sketch by Alex Rexbased on:SparkFun Spectrum Shield PWM DemoToni Klopfenstein @ SparkFun ElectronicsFebruary 2015https://github.com/sparkfun/Spectrum_Shield*********************************************************************************///Declare Spectrum Shield pin connections#define STROBE 4 /* #define constantName value */#define RESET 5 /* #define constantName value */#define DC_One A0 /* Analog Pin A0 with the name DC_one */#define DC_Two A1 /* Analog Pin A1 with the name DC_Two *///Define LED connections on the shieldint LED[] = {3, 6, 7, 9, 10, 11, 12}; /* for the seven LED's *///Define spectrum variablesint freq_amp; /* variable for the 7 Frequency-Bands of the MSGEQ7 */int Frequencies_One[7]; int Frequencies_Two[7]; int i; int level = 125; /*minimum level of sound to trigger LED or STEPPER*/ /* ~110 for piano songs, 175 - 340 for pop-songs (songs with a beat)*/int band = 3; /*7 frequency bands, choose: 0,1,2,3,4,5,6*/ /*0 = ~63Hz , 1 = ~160Hz , 2 = ~400Hz , 3 = ~1000Hz , 4 = ~2500Hz , 5 = 6250Hz , 6 = 16000Hz */ //Stepper Motor Shield pin connections#define STEPPER_PIN_1 0 /*IN1*/#define STEPPER_PIN_2 1 /*IN2*/#define STEPPER_PIN_3 2 /*IN3*/#define STEPPER_PIN_4 8 /*IN4*/int step_number = 0;/********************Setup Loop*************************/void setup() { //Set LED pin configurations for(i=0; i<7; i++) { pinMode(LED[i], OUTPUT); digitalWrite(LED[i], LOW); } //Set Spectrum Shield pin configurations pinMode(STROBE, OUTPUT); pinMode(RESET, OUTPUT); pinMode(DC_One, INPUT); /* Input from MSGEQ7 to arduino */ pinMode(DC_Two, INPUT); /* Input from MSGEQ7 to arduino */ digitalWrite(STROBE, HIGH); digitalWrite(RESET, HIGH); //Initialize Spectrum Analyzers digitalWrite(STROBE, LOW); delay(1); digitalWrite(RESET, HIGH); delay(1); digitalWrite(STROBE, HIGH); delay(1); digitalWrite(STROBE, LOW); delay(1); digitalWrite(RESET, LOW); //Set Stepper Shield pin configurations pinMode(STEPPER_PIN_1, OUTPUT); pinMode(STEPPER_PIN_2, OUTPUT); pinMode(STEPPER_PIN_3, OUTPUT); pinMode(STEPPER_PIN_4, OUTPUT);}/**************************Main Function Loop*****************************/void loop() { Read_Frequencies(); Graph_Frequencies(); delay(25); OneStep(false); delay(2); }/*******************Pull frequencies from Spectrum Shield********************/void Read_Frequencies(){ /* Read volume value for each band */ for (freq_amp = 0; freq_amp<7; freq_amp++) { Frequencies_One[freq_amp] = analogRead(DC_One); Frequencies_Two[freq_amp] = analogRead(DC_Two); digitalWrite(STROBE, HIGH); digitalWrite(STROBE, LOW); }}/*******************Light LEDs based on Frequencies Output Value*************/void Graph_Frequencies(){ for( i= 0; i<7; i++) { if(Frequencies_One[i] >= level) { digitalWrite(LED[i], HIGH); } else{ digitalWrite(LED[i], LOW); } }}/**************Stepper Motor Moving to Level Value of one Band from EQ*************/void OneStep(bool dir){ if(Frequencies_One[band] >= level){switch(step_number){ case 0: digitalWrite(STEPPER_PIN_1, HIGH); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 1: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, HIGH); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 2: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, HIGH); digitalWrite(STEPPER_PIN_4, LOW); break; case 3: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, HIGH); break;} }else{ switch(step_number){ case 0: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); /*HIGH*/ break; case 1: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); /*HIGH*/ digitalWrite(STEPPER_PIN_4, LOW); break; case 2: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); /*HIGH*/ digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 3: digitalWrite(STEPPER_PIN_1, LOW); /*HIGH*/ digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW);} }step_number++; if(step_number > 3){ step_number = 0; }} LED-STEPPER-Sound-reactive-alex-rex.jpg (79.88 KiB) Not viewed yet Thats pretty cool!But now i wanna use one stepper motor for each frequency band (7 Bands = 7 Motors).I thougt about to use some I²C - Motor Shields. Someone can recomand anything, that will work?WHY ALL THAT?In the End of the project i would like to visualize Audio in material form. (Not as LED's, Beamer or Displays!)The Motors (Rotors, or Actuators) should move some structure (or similar objects), that will interpret the Audio into moving material. I'm still in the beginning with that project. As for now.

    View Topic »
  • I've made some progress with my project.I wrote my first small code! With this code i can light up LED's to the 7 Frequency-Bands, when the volume level of each freq-band reaches a specific value.Find a small video here:https://www.youtube.com/watch?v=al5oVSO ... e=youtu.behere is the small code: (mostly i changed the last few lines of code from the original demo)Code: Sketch by Alex Rex, 24.07.2019based on:SparkFun Spectrum Shield PWM DemoToni Klopfenstein @ SparkFun ElectronicsFebruary 2015https://github.com/sparkfun/Spectrum_Shield*********************************************************************************///Declare Spectrum Shield pin connections#define STROBE 4 /* #define constantName value */#define RESET 5 /* #define constantName value */#define DC_One A0 ...

    see more »

    I've made some progress with my project.I wrote my first small code! With this code i can light up LED's to the 7 Frequency-Bands, when the volume level of each freq-band reaches a specific value.Find a small video here:https://www.youtube.com/watch?v=al5oVSO ... e=youtu.behere is the small code: (mostly i changed the last few lines of code from the original demo)Code: Sketch by Alex Rex, 24.07.2019based on:SparkFun Spectrum Shield PWM DemoToni Klopfenstein @ SparkFun ElectronicsFebruary 2015https://github.com/sparkfun/Spectrum_Shield*********************************************************************************///Declare Spectrum Shield pin connections#define STROBE 4 /* #define constantName value */#define RESET 5 /* #define constantName value */#define DC_One A0 /* Analog Pin A0 with the name DC_one */#define DC_Two A1 /* Analog Pin A1 with the name DC_Two *///Define LED connections on the shieldint LED[] = {3, 6, 7, 9, 10, 11, 12}; /* for the seven LED's *///Define spectrum variablesint freq_amp; /* variable for the 7 Frequency-Bands of the MSGEQ7 */int Frequencies_One[7]; int Frequencies_Two[7]; int i; /********************Setup Loop*************************/void setup() { //Set LED pin configurations for(i=0; i<7; i++) { pinMode(LED[i], OUTPUT); digitalWrite(LED[i], LOW); } //Set Spectrum Shield pin configurations pinMode(STROBE, OUTPUT); pinMode(RESET, OUTPUT); pinMode(DC_One, INPUT); /* Input from MSGEQ7 to arduino */ pinMode(DC_Two, INPUT); /* Input from MSGEQ7 to arduino */ digitalWrite(STROBE, HIGH); digitalWrite(RESET, HIGH); //Initialize Spectrum Analyzers digitalWrite(STROBE, LOW); delay(1); digitalWrite(RESET, HIGH); delay(1); digitalWrite(STROBE, HIGH); delay(1); digitalWrite(STROBE, LOW); delay(1); digitalWrite(RESET, LOW);}/**************************Main Function Loop*****************************/void loop() { Read_Frequencies(); Graph_Frequencies(); delay(25); }/*******************Pull frequencies from Spectrum Shield********************/void Read_Frequencies(){ /* Read volume value for each band */ for (freq_amp = 0; freq_amp<7; freq_amp++) { Frequencies_One[freq_amp] = analogRead(DC_One); Frequencies_Two[freq_amp] = analogRead(DC_Two); digitalWrite(STROBE, HIGH); digitalWrite(STROBE, LOW); }}/*******************Light LEDs based on Frequencies Output Value*************/void Graph_Frequencies(){ for( i= 0; i<7; i++) { if(Frequencies_One[i] >= 220) /* ~110 for piano songs, 175 - 340 for pop-songs (songs with a beat)*/ { digitalWrite(LED[i], HIGH); } else{ digitalWrite(LED[i], LOW); } }}What's next for my project?:Now I would like 7 stepper motors to be switched on/off instead of the 7 LEDs. I think it would be best if the >digitalOut< of the Spectrum-shield go to a programmable Stepper-Shield and start / interrupt a loop program there.Can someone give me a hint which stepper shields can do this? Does anyone have a hint for the right code for the Spectrum Analyzer Shield to do something like this?The exact movement of the motors has not yet been determined. I would just say: turn clockwise at constant speed. Maybe I would extend the movement of the motor later: e.g. gently starting and gently stopping of the motor ... or something similar. But i will come to this later on .. I would be very happy about an answer / thoughts / hints.cheers, Alex

    View Topic »
  • _Alex_Rex_ followed _Alex_Rex_2 months ago