A Behavioural Chamber to Evaluate Rodent Forelimb Grasping

Rodent behavioural test equipment is key for biological research yet expensive - our team is developing a low-cost alternative

BeginnerWork in progress10 hours1,583
A Behavioural Chamber to Evaluate Rodent Forelimb Grasping

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×1
Open Smart I2C LCD 1602 Display Module
×1
Open Smart light sensor with GL5528 photoresistor
×1
GoPro Hero 7 Black
×1
Dustless Precision pellets, 45mg, chocolate flavoured
×1
Acrylic glue - RS 144406
×1
Tygon S3 E-3603 tubing 4mm ID, food-grade - RS 4189882
×1
HALJIA 5V 4-Phase Stepper Motor + Driver Board ULN2003 for Arduino
×1
Clear Acrylic sheets, 500x300x3mm - RS 434295
×5
Red laser pointer - Onecall LA04887
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D printer - Asiga max x 27
Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

Pinion_gear_pellet_dispenser

Part of the pellet dispenser system

Gear_rack_pellet_dispenser

Part of the pellet dispenser system

Loading_tube_pellet_dispenser

Part of the pellet dispenser system

Schematics

Pellet dispenser

Diagram of pellet dispenser design

Chamber schematics

Dimensions of various acrylic parts used to build the chamber

Code

2019-09-25_Wishaw_chamber.ino

Arduino
Code running the behavioural box in Wishaw test mode. With few small additions, code can be adapted to operate the box in other behavioural tasks (such as skinner box or grip strength)
/*Script to run behaviour chamber
 *  Runs n trials (default 30), during which when laser tripwire
 *    is cut both the led (used to sync camera) and ephys hardware are pulsed
 *  Trial ticking is done when second tripwire at back of chamber is cut
 *  Beginning the trial also starts 240fps recording in gopro camera (wireless)
*/

//Parameters
  int n = 30; //number of trials(pellets) done per rat
  float halfperiod_ms = 25;  //duration of pulses sent to LED (for camera sync) and ephys (in ms). Default should be 25 (6 frames on, 6 frames off, at 240fps).

  int LightsensorThreshold = 200; //threshold below which light sensor activates. To be calibrated if necessary. Between 0 and 1023.

  int LightsensorValue_1 = 10; //variable onto which light sensor writes
  int LightsensorValue_2 = 10; //variable onto which light sensor writes

  int Switch = 0; //variable for switch (controlling chamber ON/OFF).

//Output pins
  const int EphysPin = 8;    // pin which will produce the output voltage and power LED for camera sync (red)
  const int LEDPin = 12;     // pin which will power LED when pulses are over (green)

  const int TripwirePin_1 = 2;  // pin hooked up to laser pointer used as tripwire 
  const int TripwirePin_2 = 4;  // pin hooked up to laser pointer used as tripwire

  const int StepmotorPin = 7; // pin hooked up to step motor to push pellets out

//Input pins  
  const int LightsensorPin_1 = A0;  // analog pin reading from light sensor
  const int LightsensorPin_2 = A1;  // analog pin reading from light sensor

  const int SwitchPin = A2;    // digital pin for switch (on input mode)

//Clock
  int nn=1;                     // set clock to 1



////////////////Here on down is lcd screen preamble

//load libraries
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

//Define variables 

#define I2C_ADDR          0x38        //Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN      3
#define En_pin             2
#define Rw_pin             1
#define Rs_pin             0
#define D4_pin             4
#define D5_pin             5
#define D6_pin             6
#define D7_pin             7

//Initialise the LCD
LiquidCrystal_I2C      lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
  

  
  
void setup() {
  // put your setup code here, to run once:

  //open output pins
    pinMode(EphysPin, OUTPUT);
    pinMode(LEDPin, OUTPUT);  
    pinMode(TripwirePin_1, OUTPUT);   
    pinMode(TripwirePin_2, OUTPUT);   
    pinMode(StepmotorPin, OUTPUT);
  //turn on input switch
 //   pinMode(SwitchPin, INPUT);            

  //analog pins open as inputs by default

  //Turn on laser pointers
    digitalWrite(TripwirePin_1, HIGH);
    digitalWrite(TripwirePin_2, HIGH);     

  //push first pellet out
    digitalWrite(StepmotorPin, HIGH); //push first pellet out
       delay(halfperiod_ms);             
       digitalWrite(StepmotorPin, LOW); 





       
  //turn on gopro  

  //analog print on pc
  Serial.begin(9600);

  //Open lcd display
    //Define the LCD as 16 column by 2 rows 
    lcd.begin (16,2);
    //Switch on the backlight
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);



}

void loop() {
  // put your main code here, to run repeatedly:
//Outside loop defined to reset chamber if switch is off



Switch=analogRead(SwitchPin);       //read from switch

//Finish while loop of switch. Below defines reset of chamber on switch OFF
while (Switch <200) {


   //Print out on lcd screen
//Also use lcd display for same purpose
    lcd.setCursor(0,0);
    lcd.print("Chamber reset"); lcd.print("                          ");
    lcd.setCursor(0,1);
    lcd.print("                            ");
    
     //analog print on pc
       Serial.print(LightsensorValue_1);
       Serial.print("\t");
       Serial.print(LightsensorValue_2);
       Serial.print("\t");
       Serial.print(Switch);
       Serial.print("\t");
       Serial.println(nn);    

      nn=1;  //reset chamber cycle
  
    Switch=analogRead(SwitchPin);       //read from switch

}
  
    //Default screen
    lcd.setCursor(0,0);
    lcd.print("Wishaw test"); lcd.print("                          ");
    lcd.setCursor(0,1);
    lcd.print("Cycle n: "); lcd.print(nn); lcd.print("/"); lcd.print(n); lcd.print("                          ");

  
while (Switch >200) { 
  
//Loop of Wishaw test operation 



Switch=analogRead(SwitchPin);       //read from switch

  if (nn <= n) {
    
  LightsensorValue_1 = 0;
  LightsensorValue_2 = analogRead(LightsensorPin_2);
  
    if (LightsensorValue_2 > LightsensorThreshold) {              // check that back sensor is cut 
       LightsensorValue_1 = analogRead(LightsensorPin_1);          // turn on front sensor

         //Print out on lcd screen
         //Also use lcd display for same purpose
          lcd.setCursor(0,0);
          lcd.print("Wishaw test"); lcd.print("                          ");
          lcd.setCursor(0,1);
          lcd.print("Cycle n: "); lcd.print(nn); lcd.print("/"); lcd.print(n); lcd.print("                          ");

       digitalWrite(StepmotorPin, HIGH);         // pulse motor, 
       delay(halfperiod_ms);             
       digitalWrite(StepmotorPin, LOW);          
       delay(halfperiod_ms);           
       
       while (LightsensorValue_1 < LightsensorThreshold){         // hold code until front sensor is hit
         LightsensorValue_1 = analogRead(LightsensorPin_1);       // during that time open front sensor
         }
    
       digitalWrite(EphysPin, HIGH);         // turn the output voltage on (HIGH is the voltage level, default is 5V)
       delay(halfperiod_ms);               // wait for half the period
       digitalWrite(EphysPin, LOW);          // turn the LED off 
       delay(halfperiod_ms);               // wait for half of the period

       digitalWrite(EphysPin, HIGH);         // pulse LED/ephys once again, 
       delay(halfperiod_ms);             
       digitalWrite(EphysPin, LOW);          
       delay(halfperiod_ms);

     //analog print on pc
       Serial.print(LightsensorValue_1);
       Serial.print("\t");
       Serial.print(LightsensorValue_2);
       Serial.print("\t");
       Serial.print(Switch);
       Serial.print("\t");
       Serial.println(nn);

                      


       nn += 1;
          }


    }
     




  else {                                      
    digitalWrite(LEDPin, HIGH);     //turn on LED when the all pellets have been done have finished being delivered
    digitalWrite(StepmotorPin, LOW);   // reset step motor position


     

    //Also use lcd display for same purpose
    lcd.setCursor(0,0);
    lcd.print("Task finished"); lcd.print("                          ");
    lcd.setCursor(0,1);
    lcd.print("                                           ");

     //analog print on pc
       Serial.print(LightsensorValue_1);
       Serial.print("\t");
       Serial.print(LightsensorValue_2);
       Serial.print("\t");
       Serial.print(Switch);
       Serial.print("\t");
       Serial.println(nn);
    
  }
}


}

2019-10-02_Calibration_sensors.ino

Arduino
Code to calibrate light sensors used in tripwires of chamber
  
  int LightsensorValue_1 = 10; //variable onto which light sensor writes
  int LightsensorValue_2 = 10; //variable onto which light sensor writes
  int switchStatus = 0;

  const int LightsensorPin_1 = A0;  // analog pin reading from light sensor
  const int LightsensorPin_2 = A1;  // analog pin reading from light sensor
  const int switchPin = A2;  // analog pin reading from switch

////////////////Here on down is lcd screen preamble

//load libraries
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

//Define variables 

#define I2C_ADDR          0x38        //Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN      3
#define En_pin             2
#define Rw_pin             1
#define Rs_pin             0
#define D4_pin             4
#define D5_pin             5
#define D6_pin             6
#define D7_pin             7

//Initialise the LCD
LiquidCrystal_I2C      lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
  


void setup() {
  // put your setup code here, to run once:

//Open serial data port

  Serial.begin(9600); 

//Also use lcd display for same purpose

    //Define the LCD as 16 column by 2 rows 
    lcd.begin (16,2);
    //Switch on the backlight
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);


}

void loop() {
  // put your main code here, to run repeatedly:

  LightsensorValue_1 = analogRead(LightsensorPin_1);
  LightsensorValue_2 = analogRead(LightsensorPin_2);
//  switchStatus = analogRead(switchPin);

//Print out on serial port
  Serial.print(LightsensorValue_1);
  Serial.print("\t");
  Serial.println(LightsensorValue_2);

//Print out on lcd screen
//Also use lcd display for same purpose
    lcd.setCursor(0,0);
    lcd.print("Front s: "); lcd.print(LightsensorValue_1); lcd.print("                       ");
    lcd.setCursor(0,1);
    lcd.print("Back s: "); lcd.print(LightsensorValue_2); lcd.print("                       ");
    //delay(200);





}

Credits

Alejandro Carnicer

Alejandro Carnicer

1 project • 2 followers
anastashs polyravas

anastashs polyravas

0 projects • 1 follower
Dr D.G. Barone

Dr D.G. Barone

0 projects • 1 follower

Comments