Backyard Brains Logo

Neuroscience for Everyone!

+1 (855) GET-SPIKES (855-438-7745)


items ()

[Summer’16 Internship] The Dragonfly: Laser show first prototype

Today I started working on the first prototype for the laser set-up. Previously, I had tried to make a laser show out of bass speakers. However, I found that the bass speakers that I had did not allow me the range of motion that I wanted.

A picture of the bass speaker set up that I chose not to use:

So, I instead decided to rig up a laser show out of servos. Starting simple, I only used one servo, meaning only one degree of freedom.

My laser set up:

Using a servo motor (I started with the continuous rotation, then moved on to the stepper) and an Arduino Uno, I connected the two so that the servo moved in an angle of about 40 degrees, paused for a second, then returned. I found that the stepper motor was best for this (not the continuous rotation) because it allowed me to plug the desired angle right into the code. By connecting a mirror onto the servo, I could shine a laser onto the servo, reflect it onto a screen, and move the laser beam by controlling the movement of the servo. Additionally, through the Arduino, I could turn on and off the laser easily.

Below is a picture of the set up:

The servo and the laser are both connected to the breadboard, and then to the Arduino.

Here is the code I used to power the laser and servo:

  #include <Servo.h>
  
  const int servo = 10;       // The servo motor pin
  int laserPin = 12;
  Servo myservo;  // create servo object to control a servo
  int servoAngle = 0;   // servo position in degrees
  
  
  void setup() {
  
    // Servo  
  pinMode(laserPin, OUTPUT); // set up the laser pin
  
    myservo.attach(servo);  // attaches the servo to the servo pin
  
    // Inizialize Serial
    Serial.begin(9600);
    myservo.write(servoAngle); 
    delay(1000);
  
  }
  
  
  void loop(){
   
  
  
    
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 0; servoAngle < 40; servoAngle++)  //move the micro servo from 0 degrees to 40 degrees
    {    
      myservo.write(servoAngle); 
      delay(50); 
   
    }
    
    digitalWrite(laserPin, LOW); // turn the laser off
    myservo.write(0); // return to zero degrees
  
    delay(1000); // pause for one second
    
}

This moves the servo in a 40 degree wedge and turns off the laser once the servo has hit the 40 degree mark and has moved back to 0. I connected the laser by removing the batteries, connecting an alligator clip to the spring in the center of the laser (ground) and connecting another alligator clip to the metal surrounding it. Connect the ground to ground on the Arduino and the other to the 12 pin.

After I got the servo and laser working, it looked like this:

The problems with this set up are that the servo is a little unstable, meaning the laser beam is quite jerky when it moves. Maybe this does not matter to the dragonfly TSDNs. I will see. The next step, trying to find some way to record on the computer when the laser turns on and when it turns off!

By Patricia Aguilar


No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.