Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

Laser Harp (Open Source) !

ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
We've been discussing about Laser HArps...
I thought maybe its time to post a tutorial about it here.

Thanks to the effort of a lot of members of this forum it is now almost complete.

Have a preview of what is coming up here:



Cheers to internet worldwide colab thinking! :wave:
 
Last edited:





ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
Hey kiyoukan!
No I am NOT using galvos!
ANd you;re right I use only ONE step motor. No need for 2!
It is a simple and very cheap way to do it!
I am using a simple laser pointer at this time!
Soon I will post all plans and schematics freee Open source!
Stay tuned!
Cheers for internet World Wide Colab my friend!
 
Joined
Oct 24, 2009
Messages
2,555
Points
48
okay well a stepper motor would work too.
are you using it like a true stepper motor or charging one coil as a holding coil and then driving the other coil to vibrate it?
Cant wait to see.
 

ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
OK Its a 8 wire step motor..

It was a lot difficult to wire...

Anyway since I stepped up as an open source project lets get it going...

I'll let everybody see what I have already:

Here it is:
2djqfdv.jpg



I know Harp Lasers like this sell for US$1200 at least...
But this is open source.
Have fun!
Help us too!

Substitute the 4.5 volt laser feed power supply with 5volt power supply 1A.

See details at our discussion:
http://laserpointerforums.com/f67/how-drive-green-laser-using-arduino-70770-2.html

Using 2N2222

Here is the Arduino Programing I have (2 codes):

Code #1: Blink countdown test (it works)

Code:
int delaytime = 50; 
int delaytime2 = 300; 

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  Serial.begin(9600);
  pinMode(13, OUTPUT);    
  pinMode(7, OUTPUT);  
}

void loop() {

  Serial.print(delaytime);
  Serial.print(" , " );


  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second
  
  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second

  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second
  
  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second

  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second
  
  digitalWrite(13, HIGH);   // set the LED on
  digitalWrite(7, HIGH);   // set the LED on
  delay(delaytime);              // wait for a second

  digitalWrite(13, LOW);    // set the LED off
  digitalWrite(7, LOW);    // set the LED off
  delay(delaytime);              // wait for a second


  delay(delaytime2);              // wait for a second

  if (delaytime >6 )  //se delay>6

  { 
    // faça A -------------
    delaytime=delaytime - 1; 
  }
  else delaytime=50;

}


Code #2: Arduino Laser Harp Code (not working properly = laser is dim - needs a fix for code to work properly...)

Code:
 // Circuito MIDI:
 // * digital in 1 conectado ao MIDI jack pin 5 (DO MIDI JACK)
 // * MIDI jack pin 2 conectado ao ground (DO ARDUINO)
 // * MIDI jack pin 4 (DO MIDI JACK) conectado ao +5V (DO ARDUINO) por um resistor de 220-ohm 
 
int buttonPresses = 0; // quantas vezes a nota foi tocada

int LaserState = LOW; // laser "off"
long previousMillis = 0; // guarda ultima vez que o laser foi atualizado
const int LaserPin =  7; // define pin do arduino para o laser
long timer = 100; // intervalo que o laser vai pisca em milisegundos

int val = 100;

// define os pins do motor no arduino
int motorPin1 = 8;
int motorPin2 = 9;
int motorPin3 = 10;
int motorPin4 = 11;

int delayTime = 5;

int note1 = 0x33;   
int note2 = 0x32;    
int note3 = 0x30;  
int note4 = 0x2E;  
int note5 = 0x2C;  
int note6 = 0x2B;  
int note7 = 0x29;  
int note8 = 0x24;  
int note9 = 0x2C; 

// setup ------------------------------------------------------------
void setup() 
{
  
  
  // do motor:
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  
  // do laser:
  pinMode(LaserPin, OUTPUT);	 
    
  // do led:
  pinMode(13, OUTPUT);

  //  ativa frequencia MIDI (baud rate):
  Serial.begin(31250);
}

void noteOn(int cmd, int pitch, int velocity)
  {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
  }
  
//-------------------------------------------------------------------------------------------
// inicio do loop ---------------------------------------------------------------------------
void loop()
{
  
// movimento horario ----------------------------------------------------------  

digitalWrite(LaserPin, HIGH);	// liga laser 1
//**********************************************************************************************************************************  
if ( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note1, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note1, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
 digitalWrite(LaserPin, LOW);	// desliga laser 1


//-------------------------------------------------------------------  
  digitalWrite(motorPin1, HIGH); // comanda o motor para mexer para 2
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);  

  delay(delayTime); // espera o motor chegar em 2
 
  digitalWrite(LaserPin, HIGH);	// liga laser 2
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note2, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note2, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 2

//-------------------------------------------------------------------
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 3
  digitalWrite(motorPin2, HIGH);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 3
    
  digitalWrite(LaserPin, HIGH);	// liga laser 3
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note3, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note3, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 3

//------------------------------------------------------------------ 
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 4
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, HIGH);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 4
 
  digitalWrite(LaserPin, HIGH);	// liga laser 4
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note4, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note4, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 4

//-----------------------------------------------------------------
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 5
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
  
  delay(delayTime); // espera o motor chegar em 5
    
  digitalWrite(LaserPin, HIGH);	// liga laser 5
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note5, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note5, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 5

//-------------------------------------------------------------------
  digitalWrite(motorPin1, HIGH); // comanda o motor para mexer para 6
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 6
    
  digitalWrite(LaserPin, HIGH);	// liga laser 6
 //**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note6, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note6, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 6

//------------------------------------------------------------------  
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 7
  digitalWrite(motorPin2, HIGH);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 7
    
  digitalWrite(LaserPin, HIGH);	// liga laser 7
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note7, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note7, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 7

//------------------------------------------------------------------
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 8
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, HIGH);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 8
    
  digitalWrite(LaserPin, HIGH);	// liga laser 8
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note8, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note8, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 8
 
//------------------------------------------------------------------
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 9
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
  
  delay(delayTime); // espera o motor chegar em 9
    
  digitalWrite(LaserPin, HIGH);	// liga laser 9
//**********************************************************************************************************************************  **  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note9, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note9, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************


  digitalWrite(LaserPin, LOW);	// desliga laser 9 
 
//----------------------------------------------------------------------------- 
// movimento anti-horario -----------------------------------------------------  

//------------------------------------------------------------------ 
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 8
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, HIGH);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 8
    
  digitalWrite(LaserPin, HIGH);	// liga laser 8
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note8, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note8, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 8
  
//------------------------------------------------------------------ 
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 7
  digitalWrite(motorPin2, HIGH);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 7
    
  digitalWrite(LaserPin, HIGH);	// liga laser 7
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note7, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note7, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 7
  
//------------------------------------------------------------------ 
  digitalWrite(motorPin1, HIGH); // comanda o motor para mexer para 6
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 6
    
  digitalWrite(LaserPin, HIGH);	// liga laser 6
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note6, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note6, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 6
  
//------------------------------------------------------------------
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 5
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
  
  delay(delayTime); // espera o motor chegar em 5
    
  digitalWrite(LaserPin, HIGH);	// liga laser 5
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note5, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note5, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 5

//------------------------------------------------------------------  
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 4
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, HIGH);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 4
    
  digitalWrite(LaserPin, HIGH);	// liga laser 4
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note4, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note4, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 4

//------------------------------------------------------------------ 
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 3
  digitalWrite(motorPin2, HIGH);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 3
    
  digitalWrite(LaserPin, HIGH);	// liga laser 3
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note3, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note3, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 3

//------------------------------------------------------------------- 
  digitalWrite(motorPin1, HIGH); // comanda o motor para mexer para 2
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  delay(delayTime); // espera o motor chegar em 2
    
  digitalWrite(LaserPin, HIGH);	// liga laser 2
//**********************************************************************************************************************************  
if( (analogRead(0) >15 ) && (buttonPresses == 0) ) //se o sensor esta ativado E  ainda nao começou a tocar entao toca a nota++++++++++++
          
             { 
             // faça A -----------------------------------------------------------------------------------------------------------
             digitalWrite(13, HIGH);       // acende o led  
             noteOn(0x90, note2, 0x45);    // toca a nota no: channel 1 = (0x90), nota = (note), volume = (0x45)
             buttonPresses++;              // aumenta o valor do buttonPresses (para avisar que a nota ja comecou a tocar)
             } 
           
// --------------------------------------------------------------------------------------------------------------------   
else if(analogRead(0) <15 ) // e se o sensor esta desativado +++++++++++++++++++++++++++++++++++++++++++++++++++++++
          
                  { // //  faça B = silencia a nota
                  digitalWrite(13, LOW);        // desliga o led   
                  noteOn(0x90, note2, 0x00);     // silencia a nota no: channel 1 (0x90), nota = (note), volume de silencio = (0x00)
                  buttonPresses = 0;            // zera o "buttonPresses"
                  }        
//**********************************************************************************************************************************
  digitalWrite(LaserPin, LOW);	// desliga laser 2

//------------------------------------------------------------------ 
  digitalWrite(motorPin1, LOW); // comanda o motor para mexer para 1
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
  
  delay(delayTime); // espera o motor chegar em 1
     
}
// final do loop para mexer o motor e ligar/desligar laser (volta para o começo do loop)-----
//-------------------------------------------------------------------------------------------

Ok, open source my friends!

P.s. Comments and suggested improvements/upgrades are welcome.
 
Last edited:

ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
@ARGLaser: I was just kidding... but you are right... so I take that back...
 

ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
@csshih:
1W 565nm laser.

....wat

Its a 532nm, but since I could not find the actual green laser 532nm picture inside Fritzing I posted the picture of a green LED (565nm) instead.
 

ar1999

0
Joined
Jan 20, 2012
Messages
45
Points
0
ONe more note: there is a 4007 diode after the 2N2222. Originally it would be a 4001, but that is what I had in my box...
I will try to post updated schematics including that soon.
 
Last edited:
Joined
Oct 26, 2007
Messages
5,438
Points
83
Yo dude, can you go up there and put your code within [code ][/code] blocks:
Code:
Like this.

It makes things much easier to read.
 
Joined
Sep 20, 2008
Messages
17,622
Points
113
2djqfdv.jpg


It seems you haven't thought this through....

There is no way that you will control a 1 Watt 532nm Laser
with that 2N2222 transistor. And you are still driving it without
regard to the current on the base.

BTW that is a representative drawing... It is not a schematic.
It would be nice to see a Parts List and true Schematic...


Jerry
 

Things

0
Joined
May 1, 2007
Messages
7,517
Points
0
Indeed Jerry. Also, if the laser has a modulation input, you don't even need that transistor. Just simply connect it to the microcontroller pin. They can source 20mA, which is more than enough for the kind of impedance.

You might also want to add a pull down resistor on the laser modulation pin, just in case the microcontroller gets disconnected, it'll shoot a static beam otherwise!
 

Johnyz

0
Joined
Jul 19, 2010
Messages
421
Points
0
1 Watt 532nm Laser
with that 2N2222 transistor. And you are still driving it without
regard to the current on the base.
Jerry

It's not a 1W green, it is a "1W" green. He measured the current in the other thread to be 400mA-ish, and about the current to the base... I'd reccomend sticking 1K or so resistor there, but the arduino can do only up to 20mA from a pin anyway...
 
Joined
Sep 20, 2008
Messages
17,622
Points
113
It's not a 1W green, it is a "1W" green. He measured the current in the other thread to be 400mA-ish, and about the current to the base... I'd reccomend sticking 1K or so resistor there, but the arduino can do only up to 20mA from a pin anyway...

I don't see the difference between a 1Watt Green Laser and a
"1W" Green Laser.... I'm going by the parts description on the
drawing...:thinking:

You have me at a loss...:yabbem:

Perhaps it's because it is a 535nm Green Laser....:rolleyes:


Jerry
 
Last edited:




Top