Difference between revisions of "Electronic Esophagus"

From MagnetoWiki
Jump to navigation Jump to search
(added research funding)
Line 160: Line 160:
  
 
[[Category:Flavor Preference]]
 
[[Category:Flavor Preference]]
 +
 +
=Research Support=
 +
T32 DC000044, National Institutes of Health (NIH/NIDCD) Bass, Marena N
 +
Florida State University (FSU) Chemical Senses Training Program (CTP) Grant Award
 +
Role: Trainee (08/07/2019 - 08/06/2021)

Revision as of 08:53, 3 May 2024

Selection, construction and programming of the apparatus hardware was modified from open-source syringe pump manuscripts by Longley et al (2017) and Wijen et al (2014). A capacitive touch sensor (Adafruit MPR121) is connected to the rats’ sipper tubes and programmed to detect each lick from the spout with millisecond accuracy. The capacitive touch sensor relays its information to an Arduino- compatible microcontroller (Teensy-LC) which subsequently signals a stepper motor driver (Pololu DRV8825) to turn a stepper motor (NEMA-17, 200 steps/rev, 12V, 350mA), resulting in the release of 4–8 μl liquid per lick from a 20 ml syringe connected to the stepper motor (Figure 4). The syringe pumps liquid into the rat’s chronic gastric catheter at a rate of 1 ml/min over 10 min. This infusion rate is slow enough that the stomach easily accommodates the fill and allows for gastric emptying into the intestine at a normal rate.

Using a protocol adapted from Elizalde & Sclafani (1990), unconditioned stimuli (glucose or saline) will be infused intragastrically as the animals orally sample distinct flavored solutions. With this "Electronic Esophagus" preparation utilized by Sclafani and others, animals form robust and persistent preferences for the flavored solution that is paired with glucose infusions.

Parts

Electronics

Teensy-LC

MPR121 Capacitive Touch Sensor

DRV8825 Stepper Motor Driver

Stepper motor, NEMA-17, 200 steps/rev, 12V 350mA

Hardware

1 Aluminum Flex Shaft Coupler - 5mm to 8mm

1 Linear Ball Bearing - 8mm diameter

1 M8 x 250mm Fully Threaded Rod, 304 Stainless Steel, Right Hand Threads like this one

1 Linear Motion Rod 8mmx 250mm like these

1 M8-1.25 Hex Nut like these

3D Printed Parts

The 4 parts are currently available as STL and 3MF files. Download here

Software

Adafruit Tutorial

Arduino IDE

Teensyduino add-on

ArduSpreadsheet add-on

Assembly

Electronics

The MPR121 capacitive touch sensor can be connected to up to 12 capacitive electrodes (e.g., 12 sipper tubes). Its GND, 3.3V, SCL and SDA pins are connected to the corresponding Teensy-LC pins. The 5V and GND Teensy-LC pins provide the logic power supply to the DRV8825 motor driver, which is connected to a 12V DC power supply with a 100 uF decoupling capacitor to power to the stepper motor. The direction (DIR), step (STP) and enable (ENA) pins of the motor driver receive signals from the Teensy-LC digital pins D0, D1 and D2 respectively. Because the reset (RES) and sleep (SLP) motor driver pins are active low pins, they are connected to the logic power supply to ensure they remain inactive. Fritzing schematic of electronic esophagus circuit.

3D Printed Parts and Hardware

3D Printed Parts

Three of the four 3D printed parts ("NemaMount," "MidBody" and 20mLbody") are attached together with super glue to form the body of the apparatus.

The "Plunger" will house some of the hardware, including the M8-1.25 Hex Nut and the linear ball bearing.

Hardware

The M8-1.25 Hex Nut can be inserted into the hexagonal cutaway in the 3D-printed "Plunger" and subsequently positioned so that the hole in the Hex Nut is in line with the continuous hole of the "Plunger."

The linear ball bearing fits snugly into the larger diameter continuous hole below the hex nut.

Code

Arduino code is written in C/C++

//include relevant libraries 
#include <Wire.h>
#include "Adafruit_MPR121.h"
#include <AccelStepper.h>
//define MPR121 info
#ifndef _BV
#define _BV(bit) (1 << (bit)) 
#endif
Adafruit_MPR121 cap = Adafruit_MPR121();
uint16_t lasttouched = 0;
uint16_t currtouched = 0;
//define DRV8825 stuff:
#define dirPin 2
#define stepPin 3
#define motorInterfaceType 1
// Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);
//setup code here, to run once:
void setup() {
  stepper.setMaxSpeed(1000); //set max stepper speed in steps per second
  Serial.begin(9600); //start serial monitor
  while (!Serial) { // needed to keep from starting too fast!
    delay(10);
  } 
  Serial.println("Electronic Esophagus test start");  
  // Default address is 0x5A, if tied to 3.3V its 0x5B
  // If tied to SDA its 0x5C and if SCL then 0x5D
  if (!cap.begin(0x5A)) {
    Serial.println("MPR121 not found, check wiring?");
    while (1);
  }
  Serial.println("MPR121 found!");
  // to change threshold sensitivites (touched, released). Defaults are (12,6). Valuess from 0-255 = less-more sensitive. 
  cap.setThresholds(24, 12);
}
// main code here, to run repeatedly:
void loop() {
  // Get the currently touched pads
  currtouched = cap.touched();
 
  for (uint8_t i=0; i<12; i++) {
    // it if *is* touched and *wasnt* touched before, alert!
    if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.print('\t'); Serial.println(" touched");
      // set the position to 0:
      stepper.setCurrentPosition(0);
       // Run the motor forward at 400 steps/second until the motor reaches 12 steps (~0.125 revolutions):
       while(stepper.currentPosition() != 12)
       {
        stepper.setSpeed(400);
        stepper.runSpeed();
        }
        delayMicroseconds(500);
    }
   
    // if it *was* touched and now *isnt*, alert!
    if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.print('\t'); Serial.println(" released");
      stepper.setCurrentPosition(0);
      stepper.stop(); // Stop as fast as possible: sets new target
      stepper.runToPosition(); // Now stopped after quickstop
      delayMicroseconds(500);
    }
  }
  // reset our state
  lasttouched = currtouched;
  // comment out "return" line for detailed data from the sensor!
  return;
  // debugging info, what
  Serial.print("\t\t\t\t\t\t\t\t\t\t\t\t\t 0x"); Serial.println(cap.touched(), HEX);
  Serial.print("Filt: ");
  for (uint8_t i=0; i<12; i++) {
    Serial.print(cap.filteredData(i)); Serial.print("\t");
  }
  Serial.println();
  Serial.print("Base: ");
  for (uint8_t i=0; i<12; i++) {
    Serial.print(cap.baselineData(i)); Serial.print("\t");
  }
  Serial.println(); 
  // put a delay so it isn't overwhelming
  delay(100);
}

References

Dr. D-Flo. (2017, Feb 20). DIY Syringe Pump (Food 3D Printer - Part 1) [Video]. YouTube. [1]

Elizalde G & Sclafani A, Flavor preferences conditioned by intragastric polycose infusions: A detailed analysis using an electronic esophagus preparation, Physiology & Behavior 47: 63-67, 1990. [2]

Longley M et al. An open source device for operant licking in rats. PeerJ 5:e2981, 2017. [3]

Wijen B et al. Open-source syringe pump library. PLOS ONE 9(9): e107216, 2014. [4]

People

Marena Bass

Research Support

T32 DC000044, National Institutes of Health (NIH/NIDCD) Bass, Marena N Florida State University (FSU) Chemical Senses Training Program (CTP) Grant Award Role: Trainee (08/07/2019 - 08/06/2021)