# Lorenz/Opalko

We, Brandon Lorenz and Andrew Opalko, created our project called the Laser Light Show.

Description:

Basically we took the part of a CD player that controls where the lens reader moves; this part would normally be used to read CDs and moves up and down inside of the case. We grabbed a mirror and a wire and glued these parts to the mechanism which we stripped from the CD player. After, we took a laser and pointed it at the mirror from an angle which reflects back upon the wall. We have programed which ways we want the lens head to move which will ultimately move the mirror and cause the laser on the wall to create a design. Our project idea can be found at http://www.instructables.com/id/Micro-LASER-Show-with-a-CD-Lens-Mechanism/.

How the Program Works:

First off we selected pins 6, 9, 10, and 11 because our program requires that we needed PWM pins (and those four pins are PWM pins.) The CD lens is programmed to move in a certain pattern based upon how we set up the code in the Arduino. The Arduino sends signals to direct which way the lens will move. The Physics behind this is explained further below. Since the CD lens is moving, and thus moving the mirror, the laser pointer which is stationary will be shining a laser at the mirror and reflecting back on a wall. It is basically the same thing as moving the laser pointer. A design is created on the wall dependent of how the program is set. There are many different kind of shapes we can create and cool designs.

Pictures:

Circuit Diagram: The above diagram is a brief sketch of how our project works. Pins 6, 9, 10, and 11 are connected to the Arduino board as PWM pins. Pin6 and Pin9 control vertical movement while Pin10 and Pin11 control horizontal movement. A pulse of electricity is sent from the Arduino board through these pins and go in one direction or another (upon how you tell the Arduino to send it in the programming) through a coil. Next to these coils are magnets. When sending this pulse of electricity we are either sending it in one direction and out the opposite or vice versa (for example, the pulse could start from Pin6 and travel through the coil and go out through Pin9.) With the way this pulse is sent it will make the magnets move because they will repel or attract and move up/down or left/right.

Arduino Program:

Below is the original code we used for our project:

/*

LASER TAGS - CD LENS MICRO LASERSHOW

(Copyleft) 2006 by linefeed @ Ljudmila.org GRL

*/

int t=0; // sets t=0

int inc=4; // sets inc=4

int pause=1000; // sets pause=1 second

int x,y,x0,y0,x1,y1; // sets x,y,x0,y0,xl,yl

int pt,phase,loopcnt; // sets pt,phase,loopcnt

int nshapes=6;

int shape=0;

int shapes={0,4,7,9,11,20, 24};

int ptsx={-250,250,250,-250, -250,250,0, -250,250, -250,250,

-230, -230 ,-15, -11, 220, -17, -17, -15, 150, -250,250,-250,250 };

int ptsy={-250,-250,250,250, -250,-250,250, -250,250, 250,-250,

-220, 200, 200, -200, -200, -210, -210, -35, -40, -250,-250,250,250 };

//pins

// 6,9 - vertical // which pins control vertical movement

// 10,11-horizontal // which pins control horizontal movement

void setup(void) {

// initialize inputs/outputs

pinMode(6,OUTPUT); // sets pin 8 as an output

pinMode(9,OUTPUT); // sets pin 9 as an output

pinMode(10,OUTPUT); // sets pin 10 as an output

pinMode(11,OUTPUT); // sets pin 11 as an output

digitalWrite(8,LOW); // sets pin 8 as "off"

digitalWrite(10,LOW); // sets pin 10 as "off"

}

void setPos(int x, int y) {

if (x>=0) {

digitalWrite(10,LOW); // sets 10 to ground

analogWrite(11,x); // set 11 as x

} else {

digitalWrite(11,LOW); // sets 11 to ground

analogWrite(10,-x); // sets 10 as -x

}

if (y>=0) {

digitalWrite(6,LOW); // sets 6 to ground

analogWrite(9,y); // sets 9 as y

} else {

digitalWrite(6,HIGH); // sets 6 as start

analogWrite(9,255+y); // sets 9 as 255+y

}

}

void loop(void) {

//next shape

if (loopcnt>100) {

shape=(shape+1)%nshapes;

loopcnt=0;

}

//tick phase

phase+=inc;

//next point

if (phase>=100) {

phase=0;

pt=pt++;

//loop points in shape

if (pt>shapes[shape+1]) {

pt=shapes[shape];

t=pt*100;

loopcnt++;

}

x0=x1;

y0=y1;

x1=ptsx[pt];

y1=ptsy[pt];

}

//current coordinate

x=((x0*(100-phase))+(x1*phase))/100;

y=((y0*(100-phase))+(y1*phase))/100;

setPos(x,y);

delayMicroseconds(pause);

}

This is the coding we actually used that was not as complicated. This basically makes it move up and down.

digitalWrite (pin6, LOW); // sets pin6 to ground

digitalWrite (pin9, HIGH); // sets pin9 to turn on

delay (10); // sets delay

digitalWrite (pin9, LOW); // sets pin9 to ground

digitalWrite (pin6, HIGH); // sets pin6 to on

delay (10); // sets delay

This coding was much easier to manipulate and is what we used to make simple shapes such as a box or circle. We also added a for loop so that we could change shapes.

for(int x=1; x<10; x++)

This would run the above coding 10 times then go onto another for loop for 10 times that would show a different shape.

Problems Encountered:

Over the period of time that we were working on this project, we encountered a few minors problems that were easy to overcome. Some problems were simple to fix such as using finding the mirror that will reflect best, and re-gluing the mirror that fell off. There were although other problems that we encountered that were much more difficult to solve. Our first major problem was getting the lens reader to move. When we first uploaded the Arduino program to the board, nothing happened. It turns out that we did not solder the wires neatly and some of the wires were overlapping and causing the program to short circuit. We had to rip apart the lens mechanism because we had glued it to the side of the box and clean up everything. The second major problem we encountered was figuring out what the code meant in the Arduino program and reformatting it to get the mirror moving the way we wanted. This part took time and patience. Aside from these roadblocks the overall project wasn't extremely difficult to do given the fact that the physical building was easy to accomplish and the instructions provided a step by step guide. Every time the mechanism would vibrate the whole box would move because we did not secure it enough, and a straight line would become a squiggle.