Backyard Brains Logo

Neuroscience for Everyone!

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


items ()

[Summer’16 Internship] Arduino, EEG, and Free Will: Three Channels!

It took a lot of tinkering, but I’ve finally performed the free will experiment using multiple electrodes on the scalp.

The hardware setup was fairly simple. Take two more Heart/Brain shields, switch C7 for a 47µF cap on both, and stack them on top of the existing setup using headers. Make sure each shield has a different channel selected by shorting a different pair of pins on the analog out. These BYB shields are like legos for neurophysiology!

Modifying my MATLAB code to accommodate for three channels wasn’t terribly hard. I’ve updated github.

By Patrick Glover


[Summer’16 Internship] The Dragonfly: next steps

The next steps of the project are…

1) set up a coordinate system in Matlab so by inputing the change in degrees of the servos, I can know the change in position on the screen.

2) Using Matlab, create figures that relate the neural activity to the position and direction of the laser beam.

3) Test with dragonfly using entire set-up (new laser light show, Spikerbox pro double events recorder, etc)

By Patricia Aguilar


[Summer’16 Internship] The Dragonfly: Manipulating the code for the laser set-up

In order to replicate Paloma Gonzalez-Bellido’s experiment, I need to be able to manipulate the direction and position of the laser beam. In Paloma Gonzalez- Bellido’s 2012 paper she publish these results:

Gonzalez-Bellido, P. T., H. Peng, J. Yang, A. P. Georgopoulos, and R. M. Olberg. “Cozzarelli Prize Winner: Eight Pairs of Descending Visual Neurons in the Dragonfly Give Wing Motor Centers Accurate Population Vector of Prey Direction.” Proceedings of the National Academy of Sciences 110.2 (2012): 696-701. Web.

The diagrams on the left column plot the preferred direction of a certain neuron (labeled DIT.., MD… etc). Imagine that in the centers of the circles are the dragonflies, and that each color represents a position the target could be moving in. The red arrow points to the position that is preferred. The next column represents the flattened out screen. Each colored dot represents a pixel that the target has either started or passed through, and each color represents the direction. By looking at the left column, we can determine the direction the target was moving. The last column represents the firing rate- yellow being the greatest and black being the weakest.

I wrote a first draft of code, using Arduino, to mimic the experiment. Using the data collected about the preferred direction and the preferred starting location of the target, I designed code that would move the laser beam from each of the preferred starting locations for each of the neurons and travel in each of the neurons preferred directions.

For example, I wrote code for the neuron MDT3:

#include <Servo.h>
  
  const int servo = 10;       // The servo motor pin
  const int servo2 = 11;
  int laserPin = 12;
  Servo myservo;  // create servo object to control a servo
  Servo myservo2;
  int servoAngle= 0;
  
  void setup() {
  
    // Servo  
  pinMode(laserPin, OUTPUT); // set up the laser pin
  
    myservo.attach(servo);  // X servo
    myservo2.attach(servo2); // Y servo
  

  }
  
  
  void loop(){
    
    for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j < 5; j ++)
    {
      
    digitalWrite(laserPin, LOW);
     
      myservo.write(30); // X servo starting point
      myservo2.write(60 - i*(2.5)); // Y starting point - moves with i
      delay(100); // 100 millisecond delay
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 30; servoAngle < 55 ; servoAngle ++)
    {    
      myservo.write(servoAngle); // X servo moves

       delay(50);
    
    }
    }
    
    delay(1000);
    }
  
  
  }
 

The result is:

Here is the first draft of the code for the final testing:

#include <Servo.h>
  
  const int servo = 10;       // The servo motor pin
  const int servo2 = 11;
  int laserPin = 12;
  Servo myservo;  // create servo object to control a servo
  Servo myservo2;
  int servoAngle=0;
  
  
  void setup() {
  
    // Servo  
  pinMode(laserPin, OUTPUT); // set up the laser pin
  
    myservo.attach(servo);  // attaches the servo to the servo pin
    myservo2.attach(servo2);
  
    // Inizialize Serial

  }
  
  void loop(){
    
    //DIT1
    
    for (int i = 8; i < 11; i ++)
    {
    
    for (int j = 0; j < 5; j ++)
    {
     
     
      myservo.write(55);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 30; servoAngle >10 ; servoAngle --)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
    digitalWrite(laserPin, LOW);
    delay(2000);
    }
    delay(10000);
    }
    
    //DIT3
        for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      

     
      myservo.write(55);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 45; servoAngle >20 ; servoAngle --)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }

    
    delay(10000);
    }
    
    //MDT1
        for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      
  
     
      myservo.write(55);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 55; servoAngle >20 ; servoAngle --)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }

    
    delay(10000);
    }
    //MDT5
    
        
    for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      
 
     
      myservo.write(20);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 20; servoAngle < 55 ; servoAngle ++)
    {    
      myservo.write(servoAngle);

       delay(50);
        
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }
    
    delay(10000);
    }
    //MDT3
        for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      
      myservo.write(30);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 30; servoAngle < 55 ; servoAngle ++)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }
    
    delay(10000);
    }
    
    //DIT2
        
    for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      
      myservo.write(30);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 30; servoAngle < 55 ; servoAngle ++)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }
    
    delay(10000);
    }
    
    //MDT2
        
    for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {

      myservo.write(30);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 30; servoAngle < 45 ; servoAngle ++)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }

    
    delay(10000);
    }
    
    //MDT4
        
    for (int i = 0; i < 11; i ++)
    {
    
    for (int j =0; j <5; j ++)
    {
      
      myservo.write(50);
      myservo2.write(60 - i*(2.5));
      delay(100);
      digitalWrite(laserPin, HIGH); // turns the laser on
      for(servoAngle = 50; servoAngle > 20 ; servoAngle --)
    {    
      myservo.write(servoAngle);

       delay(50);
    
    }
       digitalWrite(laserPin, LOW);
    delay(2000);
    }

    
    delay(10000);
    
    }
  }

By Patricia Aguilar