Arduino Subsystem - BrendonWatsonLab/Digital-Homecage GitHub Wiki
Arduino Subsystem
Name: Arduino Subsystem
Shortname: ArduinoSubsyst
Description: Composed of the Arduino and the Motorshield Subsystem. Modified from I.Cerda Thesis: The Arduino and motorshield subsystem consists of a Motor Shield Assembly mounted to an Arduino Mega 2560. Power delivery to the subsystem consists of 12 V for the Arduino, and 9 V for the stepper motor output of the mounted Adafruit Motor Shield v2. The motorshield also uses 5V (drawn from the Arduino) to power its logic on-board. The construct is tasked with the transduction of signals generated by nose pokes at the food and water dispensing ports into mechanisms ensuring food and water are dispensed. The arduino relays information to the Labjack T7 data acquisition device via an IDC parallel cable.
Ordering Link:
Subcomponents:
Connectors:
Question: Clarify this. The arduino tells the labjack of both beambreaks and dispenses, but dispenses aren't an actual thing. We don't measure that a pellet dispensed or water dispensed or that the motor or solenoid turned or was in use. We just assume that a dispense occured. But if this is true, why do we have different numbers of beambreaks and dispenses?
Response (Pho Hale): The difference is that after a dispense event, another dispense event isn't permitted until the specified post-dispense timeout elapses. On the other hand, during this timeout period the animal can still be rapidly triggering the beambreak (by nosepoking, withdrawing the nose, then poking again, etc) which will result in a beambreak event being sent for each. The motivation for this was initially a hypothesis that I had about how the ratio of number of beambreaks to pellets received would approximately track with the amount of hedonistic value they're attributed to the food/water reward. This is just speculation on my part, but the intuition being that If you're really excited you might check frequently to see whether it's time to get another treat but if you don't really care it feels like too much effort to keep poking and waiting and you just give up.
This motor shield assembly performs the information encoded in the Arduino Mega 2564. The white, red and green wires of 6 female 3-pin connectors are soldered onto their corresponding inputs in the digital I/O rail, power rail, and ground rail of an Adafruit Motor Shield V2, respectively. Four of these connectors interface with the 4 different Beambreak Assemblies (sucrose and regular water, fatty and regular food). When a digital input is received at the I/O pins corresponding to either water Beambreak Assembly, the Motor Shield uses one of the 2 remaining female 3-pin connectors to relay a digital signal and 5V of power to the Water Solenoid Valve Driving Circuit to activate the corresponding solenoid valves controlling water dispense. If instead the digital input is received at either of the food I/O pins, the Motor Shield provides 500 mA of current to one of the corresponding 2 stepper motors, driving the dispensing of regular and fatty food pellets.
Assembly: Marks: Using Red, Blue, and Black sharpie, label the white wires coming off of the motorshield in two places: once near the top by the black connector, and once near the bottom near where it connects to the board.
Conventions:
| Color | Meaning |
|---|---|
| Red | Food |
| Blue | Water |
| Black | Solenoid Power |
| Number of Bands | Meaning |
|---|---|
| 1 Band | System 1 |
| 2 Bands | System 2 |
Signal Ports: When a beambreak state changes, or a value is supposed to be written out to one of the the solenoids, a signal port is used.
| White Wire Pin | Mark Color, Pattern | Meaning | I/O |
|---|---|---|---|
| D5 | 1 Red Band | Food 1 | Boolean Input |
| D7 | 2 Red Bands | Food 2 | Boolean Input |
| D3 | 1 Blue Band | Water 1 | Boolean Input |
| D6 | 2 Blue Bands | Water 2 | Boolean Input |
| D8 | 1 Black Band | Solenoid Power 1 | Boolean Output |
| D11 | 2 Black Bands | Solenoid Power 2 | Boolean Output |
Relayed Current State Ports: When an Arduino event occurs (such as a beambreak detection event, or a dispense event) the Arduino outputs this signal to another output pin to be read by the Labjack. The Motorshield Subsystem and the Labjack are connected by the flat, grey IDC Parallel Cable. The IDC Parallel Cable (Arduino Mega) has a 2 x 18 pin female socket that the IDC Parallel Cable sockets onto.
| Event Type | Output Signal | Arduino Output | Pin Ribbon Cable Wire Number | Labjack Input Port |
|---|---|---|---|---|
| Beambreak | Water 1 | D22 | 6 | EIO0 |
| Water 2 | D24 | 8 | EIO1 | |
| Food 1 | D26 | 1 | 0 EIO2 | |
| Food 2 | D28 | 12 | EIO3 | |
| Dispense | Water 1 | D23 | 5 | EIO4 |
| Water 2 | D25 | 7 | EIO5 | |
| Food 1 | D27 | 9 | EIO6 | |
| Food 2 | D29 | 11 | EIO7 |
"Ribbon Cable Wire Number": The pin 1 is defined as the one nearest the edge of the cable marked with the red line.
IDC Parallel Cable
IDC CABLE - MPL36K/MC37G/MPL36K
Order through Digikey: https://www.digikey.com/product-detail/en/3m/M3WWK-3636J/M3WWK-3636J-ND/6601
Connections The first pin is defined as the one nearest the edge of the cable marked with the red line. The Arduino Subsystem (Arduino Mega) has a 2 x 18 pin female socket that the Arduino Subsystem sockets onto.
| Arduino Mega Digital Pin Number | Ribbon Cable Wire Number | Labjack Port |
|---|---|---|
| - | 1 | - |
| - | 2 | - |
| - | 3 | - |
| - | 4 | - |
| 23 | 5 | EIO4 |
| 22 | 6 | EIO0 |
| 25 | 7 | EIO5 |
| 24 | 8 | EIO1 |
| 27 | 9 | EIO6 |
| 26 | 10 | EIO2 |
| 29 | 11 | EIO7 |
| 28 | 12 | EIO3 |
| - | 13 | - |
| - | 14 | - |
| - | 15 | - |
| - | 16 | - |
| - | 17 | - |
| - | 18 | - |
| - | 19 | - |
| - | 20 | - |
Leur-Lock Connectors
Describe when someone would need this information. For example "when connecting to wi-fi for the first time".
Solenoid
Name: Solenoid
Ordering Link: https://www.theleeco.com/products/electro-fluidic-systems/solenoid-valves/control-valves/lhd-series/3-port/ported/
Manufacturer: Lee Company Model Number: LHDA0533215H Subcomponents:
Connectors:
| Water | Port | Location Purpose |
|---|---|---|
| 1 | Closest to the outside of the solenoid | Water input |
| 2 | Middle | Water output |
| 3 | Closest to the power pins | blocked, not in use |
| Electrical | Pin | Location Purpose |
|---|---|---|
| 1 | On the same side as the red "Lee" logo | 5V Power In |
| 2 | On the side opposite the red "Lee" logo | Ground (GND) |
Description: A 5V Solenoid that can be electronically opened and closed to control whether water is able to pass through the connected tubes.
| MODEL | PART NUMBER (click for drawing) | COIL VOLTAGE (vdc) | LOHM RATE1 ON AIR AT 70°F (21°C) | OPERATING PRESSURE | POWER CONSUMPTION2 AT 70°F (21°C) (mW) | WETTED MATERIALS3 |
|---|---|---|---|---|---|---|
| SEAL | PLUNGER HEAD | ARMATURE/PLUNGER STOP | ||||
| Conventional | LHDA0533215H | 5 | 1500 Lohms(8 SLPM @30 psid; Ref. Cv = 0.013) | Supply Vac - 45 psig Differential 30 psid (max.) | 750 | FKM |
Notes: