diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d6bd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/arduino_motor_shield_drive/arduino_motor_shield_drive.ino b/arduino_motor_shield_drive/arduino_motor_shield_drive.ino new file mode 100644 index 0000000..e46c49c --- /dev/null +++ b/arduino_motor_shield_drive/arduino_motor_shield_drive.ino @@ -0,0 +1,43 @@ +// Amber Fechko, quick and dirty motor/button solution for peristaltic pump driver. +// amber@kelpforest.org + +int buttonPin = 5; // which pin is the button switch connected to? +int pinI1 = 8; // motor shield interface I1 +int pinI2 = 11; // motor shield interface I2 +int speedpinA=9; // enable motor A +int pwmSpeed = 1000; // define the pwmSpeed of motor +int buttonState = 0; // tracking whether button is pressed or not + +void setup() { + pinMode(pinI1,OUTPUT); // configure pinI1 as output + pinMode(pinI2,OUTPUT); // configure pinI2 as output + pinMode(speedpinA,OUTPUT); // enable motor pin as output + pinMode(buttonPin, INPUT); // enable buttonPin as input +} + +void forward() { + analogWrite(speedpinA,pwmSpeed); // input a simulation value to set the speed + digitalWrite(pinI2,LOW); // turn DC Motor clockwise + digitalWrite(pinI1,HIGH); +} +void backward() { + analogWrite(speedpinA,pwmSpeed); // input a simulation value to set the speed + digitalWrite(pinI2,HIGH); // turn DC Motor counterclockwise + digitalWrite(pinI1,LOW); +} +void stop() { + digitalWrite(speedpinA,LOW); // disable the pin to stop the motor -- this should be done to avid damaging the motor. + delay(1000); +} + +void loop() { + buttonState = digitalRead(buttonPin); // check button pin for pressed button + if (buttonState == HIGH) { // if button is being pressed.. + forward(); // move forward for ... + delay(6000); // .. six seconds .. + stop(); // .. then stop the motor... + delay(500); // .. and hold everything for a half second. + } else { + delay(500); + } +} diff --git a/ps pump equipment list and notes.txt b/ps pump equipment list and notes.txt new file mode 100644 index 0000000..014c382 --- /dev/null +++ b/ps pump equipment list and notes.txt @@ -0,0 +1,62 @@ +Most commercial water/fluid reward systems used in research settings cost a few hundred dollars (or more) and aren't easily modified. This is a fairly quick hack, but it does the job well and won't cost you >$100.. much less if you already have some of the components sitting around. Using a peristaltic pump is preferred, as the motor never actually comes into contact with the fluid itself. + +--------------------------------------------- +---------------EQUIPMENT--------------------- +--------------------------------------------- +Common Equipment (All Versions): +- Peristaltic Liquid Pump (12VDC / 300mA) with Silicone Tubing (max flow 100mL/min) [ http://www.adafruit.com/products/1150 ] +- 12VDC Adapter (old D-Link wall adapter in my case) to power the motor +- Momentary Push Button/Switch for manual fluid delivery (optional) + +Equipment Used for Raspberry Pi Version: +- Raspberry Pi Model B [ http://www.newark.com/jsp/search/productdetail.jsp?sku=43W5302 ] +- Gertboard [ http://www.newark.com/jsp/search/productdetail.jsp?sku=46W9829 ] + +Equipment Used for Arduino Version: +- Arduino Duemilanova w/ATMEGA328 [ http://arduino.cc/en/Main/arduinoBoardDuemilanove ] +- Seeed Studio Motor Shield [ http://www.seeedstudio.com/depot/motor-shield-p-913.html ] + +*** If you're not using a gertboard or motor shield of some sort, you'll need either a power transistor (basic on/off) or a motor driver chip such as the L293D to work with the DC motor which drives the peristaltic pump. [ http://www.ti.com/lit/ds/symlink/l293d.pdf ] + + + +--------------------------------------------- +------------ARDUINO VERSION------------------ +--------------------------------------------- +I used an older arduino (duemilanova) I had sitting around, but any version should be fine. If you use the Seeed motor shield you'll need a compatible pinout -- the duemilanova or the uno both work well. I wouldn't specifically recommend the motor shield, it's overkill for this, but it's cheap/simple and if you have one laying around it works fine. If you do go for this particular motor shield, the wiki has good information: [ http://www.seeedstudio.com/wiki/Motor_Shield_V1.0 ]. + +Connect your DC power adapter to the motor shield Vs / Gnd pins, and connect the motor to the M1+ / M1- pins. Connect the motor shield to the arduino. Upload arduino code via USB. If you leave the J6 jumper connected, you don't need to provide a separate power source to the arduino -- it will pull power from the motor shield. If you want a manual "push button to dispense fluid" feature, you can pick up a button module from Seeed and connect it via their Grove system to make life easy, but I used a 10kOhm resistor and an old button switch I had laying around. + + Switch + | + |------------ + | | + | | + | / \ + 5V / \ + 10kOhm Arduino Pin #5 + Resistor + | + | + Gnd + +The physical assembly was done using odd metal pieces I had laying around. I'm not particularly proud of it, but it works fine (it doesn't really need a physical assembly to be functional). + +--------------------------------------------- +-----------RASPBERRY PI VERSION-------------- +--------------------------------------------- +A gertboard is overkill for this, but again, I already had it sitting around. :) I used a raspberry pi model B, with a pre-assembled gertboard to drive the motor. If you go the gertboard route, their manual is valuable: [ ]. + + + +--------------------------------------------- +--------------GENERAL NOTES------------------ +--------------------------------------------- +You can use pulse width modulation w/the motor to speed up or slow down the flow rate; if you connect the motor the other way it will move fluid the other direction. It uses 3/16″ (4.7mm) outer diameter silicone tubing, which connects nicely to a metal drinking tube pulled out of a rodent water bottle. + + + + + + +