Difference between revisions of "Electronic Esophagus"

From MagnetoWiki
Jump to navigation Jump to search
(removed details in case my own writing flags me as plagiarizing myself)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Raspberry PI Lickometer=
 
  
==Parts==
+
=Parts=
  
===Electronics===
+
==Electronics==
 +
 
 +
Arduino- compatible microcontroller (Teensy-LC)
 
[https://www.pjrc.com/teensy/teensyLC.html Teensy-LC]
 
[https://www.pjrc.com/teensy/teensyLC.html Teensy-LC]
  
 +
A capacitive touch sensor (Adafruit MPR121)
 
[https://www.adafruit.com/product/1982 MPR121 Capacitive Touch Sensor]
 
[https://www.adafruit.com/product/1982 MPR121 Capacitive Touch Sensor]
  
 +
stepper motor driver (Pololu DRV8825)
 
[https://www.pololu.com/product/2133/ DRV8825 Stepper Motor Driver]
 
[https://www.pololu.com/product/2133/ DRV8825 Stepper Motor Driver]
  
 +
stepper motor (NEMA-17, 200 steps/rev, 12V, 350mA)
 
[https://www.adafruit.com/product/324 Stepper motor, NEMA-17, 200 steps/rev, 12V 350mA]
 
[https://www.adafruit.com/product/324 Stepper motor, NEMA-17, 200 steps/rev, 12V 350mA]
  
===Hardware===
+
==Hardware==
 +
1 [https://www.adafruit.com/product/1176 Aluminum Flex Shaft Coupler - 5mm to 8mm]
  
===3D Printed Parts===
+
1 [https://www.adafruit.com/product/1181 Linear Ball Bearing - 8mm diameter]
 +
 
 +
1 M8 x 250mm Fully Threaded Rod, 304 Stainless Steel, Right Hand Threads [https://www.amazon.com/dp/B078H2ZM3C?ref=ppx_yo2_dt_b_product_details&th=1 like this one]
 +
 
 +
1 Linear Motion Rod 8mmx 250mm [https://www.amazon.com/dp/B08JFZQG2H?ref=ppx_yo2_dt_b_product_details&th=1 like these]
 +
 
 +
1 M8-1.25 Hex Nut [https://www.amazon.com/Persberg-M8-1-25-Height-Stainless-120153/dp/B089PR8DVP/ref=sr_1_1_sspa?crid=29DW29A9AWQEP&keywords=m8+hex+nut&qid=1642699078&s=industrial&sprefix=m8+he%2Cindustrial%2C87&sr=1-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEyUEtNOVlXSlkyR00wJmVuY3J5cHRlZElkPUEwMzc5MzU5MjJSWVcyRDg5MDY4TSZlbmNyeXB0ZWRBZElkPUEwNzUzNTQ3M0Q4TEZKWTJZRDdCViZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU= like these]
 +
 
 +
==3D Printed Parts==
 +
The 4 parts are currently available as STL and 3MF files.
 +
[https://drive.google.com/drive/folders/1_GCll42MNhbK981q99WKfd3auBnq7ENU?usp=sharing Download here]
  
===Software===
+
==Software==
 
[https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial/wiring Adafruit Tutorial]
 
[https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial/wiring Adafruit Tutorial]
  
Line 25: Line 40:
 
[https://circuitjournal.com/arduino-serial-to-spreadsheet ArduSpreadsheet add-on]
 
[https://circuitjournal.com/arduino-serial-to-spreadsheet ArduSpreadsheet add-on]
  
===Code===
+
=Assembly=
 +
 
 +
==Electronics==
 +
[https://drive.google.com/drive/folders/1_GCll42MNhbK981q99WKfd3auBnq7ENU Fritzing schematic.]
 +
 
 +
==3D Printed Parts and Hardware==
 +
 
 +
===3D Printed Parts===
 +
[https://drive.google.com/drive/folders/1WG1S4pQOFqJO8LHcBtilgX4-BnkKr9EW 3D printed parts] 4 parts ("NemaMount," "MidBody," 20mLbody" and "Plunger").
 +
 
 +
=Code=
 +
Arduino code is written in C/C++
  
 
  //include relevant libraries  
 
  //include relevant libraries  
 
 
  #include <Wire.h>
 
  #include <Wire.h>
 
  #include "Adafruit_MPR121.h"
 
  #include "Adafruit_MPR121.h"
Line 37: Line 62:
 
  #define _BV(bit) (1 << (bit))  
 
  #define _BV(bit) (1 << (bit))  
 
  #endif
 
  #endif
 
 
  Adafruit_MPR121 cap = Adafruit_MPR121();
 
  Adafruit_MPR121 cap = Adafruit_MPR121();
 
  uint16_t lasttouched = 0;
 
  uint16_t lasttouched = 0;
Line 80: Line 104:
 
       // set the position to 0:
 
       // set the position to 0:
 
       stepper.setCurrentPosition(0);
 
       stepper.setCurrentPosition(0);
         // Run the motor forward at 400 steps/second until the motor reaches 24 steps (~0.125 revolutions):
+
         // Run the motor forward at 400 steps/second until the motor reaches 12 steps (~0.125 revolutions):
 
         while(stepper.currentPosition() != 12)
 
         while(stepper.currentPosition() != 12)
 
         {
 
         {
Line 118: Line 142:
 
  }
 
  }
  
==People==
+
=References=
 +
Dr. D-Flo. (2017, Feb 20). DIY Syringe Pump (Food 3D Printer - Part 1) [Video]. YouTube. [https://www.youtube.com/watch?v=UHa-OKb_CiM&t=212s]
 +
 
 +
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. [https://pubmed.ncbi.nlm.nih.gov/2109327/]
 +
 
 +
Longley M et al. An open source device for operant licking in rats. PeerJ 5:e2981, 2017. [https://peerj.com/articles/2981/]
 +
 
 +
Wijen B et al. Open-source syringe pump library. PLOS ONE 9(9): e107216, 2014. [https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0107216]
 +
 
 +
=People=
 
Marena Bass
 
Marena Bass
  
 
[[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)

Latest revision as of 21:22, 24 September 2024

Parts

Electronics

Arduino- compatible microcontroller (Teensy-LC) Teensy-LC

A capacitive touch sensor (Adafruit MPR121) MPR121 Capacitive Touch Sensor

stepper motor driver (Pololu DRV8825) DRV8825 Stepper Motor Driver

stepper motor (NEMA-17, 200 steps/rev, 12V, 350mA) 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

Fritzing schematic.

3D Printed Parts and Hardware

3D Printed Parts

3D printed parts 4 parts ("NemaMount," "MidBody," 20mLbody" and "Plunger").

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)