TITLE: Freely moving recording: Chronic recoverable Neuropixels in mice
AUTHORS: Emily A Aery Jones

[DESCRIPTION]
This protocol collection explains how to build a low-cost, lightweight system to implant Neuropixels 1.0 probes into mice, record during freely moving behavior, then recover the probe for future use. This protocol enables recording from mice after following the Assembly and Implant surgery protocols, or after any chronic electrode implantation. This protocol first explains how to build enclosures for spatial tasks, construct a frame to mount the enclosures and related hardware, and wire and code an Arduino to operate poke detectors, pinch valves to dispense reward, and floor-mounted doors. Second, it explains how these procedures can be used specifically to build an X-maze for mice. Third, it explains how to integrate recording by building a headfixation apparatus for easy headstage attachment and a pulley-operated counterweight to counteract the headstage weight and enable easier running.

The X-maze is derived from the H maze, originally published in Seigle & Wilson, 2014 (https://elifesciences.org/articles/03061) with a detailed protocol published in Wirtshafter, Quan, & Wilson, 2021 (https://bio-protocol.org/e3947).

[BEFORE_START]
Get familiar with the basics of soldering (https://learn.sparkfun.com/tutorials/how-to-solder-through-hole-soldering) and Arduino coding (https://learn.sparkfun.com/tutorials/installing-arduino-ide).

[GUIDELINES]
All build files available at https://github.com/emilyasterjones/X_maze/tree/main/Build
X-maze based off of H-maze from (Wirtshafter, Quan, & Wilson, 2021) https://bio-protocol.org/e3947

[STEPS]
SECTION: Design the enclosure
1. Consider what acrylic to use (e.g. 1/4" P95 matte black acrylic).
Use black if you're planning to track LEDs in the dark or white if you're planning to track a Black6 mouse based on center of mass.
Use matte finish to reduce reflections from LEDs and overhead lights.
Thicker material makes for more robust joints, but can be too heavy to lift if enclosures need to be swapped regularly.
SECTION: Design the enclosure
2. Decide on the dimensions of the enclosure (e.g. 1.5m linear track, 50 x 30cm X-maze, 75cm open field, 15cm rest box)
For linear mazes, longer means more distinct neural sequences but also fewer trials.
For 2D boxes, larger means easier to detect grid coding and large place fields but also takes longer for the mouse to cover.
Higher walls means the mouse is less likely to escape, but also makes it harder to retrieve the mouse and might occlude visualization if you have interior walls (i.e. not just a box). On motivated tracks, where mice aren't likely to escape, 20cm walls are enough. In unmotivated boxes, where mice will look to escape (perhaps to get back to the motivated track), 30cm walls are enough.

 


SECTION: Design the enclosure
3. Add holes to mount nosepokes, servo motors, or other components. In the instructions below, nosepokes are mounted to the walls and servo motors are mounted through the floor to operate doors. These pieces can be mounted using the holes described in the poke_walls and maze_floor files at https://github.com/emilyasterjones/X_maze/tree/main/Build.
 

SECTION: Design the enclosure
4. Draw your enclosure in CAD software (e.g. Fusion360) or Illustrator. Make a list of the dimensions of all the rectangular parts and send to your local plastics supplier (e.g. Tap Plastics) for them to cut to size.

 
  

SECTION: Design the enclosure
5. For pieces that aren't rectangular or have specifically sized holes, use a laser cutter. Create an Illustrator or CAD canvas the same size as what your local laser cutter can use and draw your enclosure in thin red lines.
SECTION: Build the enclosure
6. Spray pieces with anti-ESD spray.

 

 

SECTION: Build the enclosure
7. Assemble the enclosure and secure the outsides of all joints with matte black duct tape.
SECTION: Build the enclosure
8. Weld the joints with Weld-on. Fill the squeeze bottle with Weld-On using the funnel, attach the needle, then run a thin line of Weld-On into the joint. Let rest for 30 minutes.
 

SECTION: Build the enclosure
9. Further secure larger joints (e.g. wall to floor) with Epoxy. Be sure to seal any gaps with Epoxy to prevent mouse toes from getting stuck. Note that this is not matte.
SECTION: Build the enclosure
10. Fill joints that aren't at 90 degrees with Sil-Pruf.
SECTION: Build the enclosure
11. Secure the outsides of joints by welding or supergluing them to joint support pieces: https://github.com/emilyasterjones/X_maze/blob/main/Build/Joint_supports.pdf
SECTION: Design the 80/20 frame
12. Use this software to design your frame: https://www.framexpert.com/products/framedesigner/download/. Design a box tall enough for your camera and pulley mount and wide enough for your enclosures.
 

SECTION: Design the 80/20 frame
13. Design considerations:
What are the dimensions of the room and your enclosures? 
Where and how will the camera and counterweight pulley be mounted? Aim to put these as high as possible.
At what height can the enclosure sit such that the camera can capture it entirely but you can still comfortably pick up animals from it? 
Do you need storage underneath the enclosure? Or for the enclosure level to be high enough that you can reach the camera mount by standing on it?
Do you need additional mounts (e.g. for a side camera or headfixation)?

  

SECTION: Design the 80/20 frame
14. Bracket considerations:
Standard L brackets are cheapest, but larger brackets may be needed for securing important exterior joints and heavier items.
Standard brackets come with end-feed nuts, meaning you have to pre-load each t-slot piece with all the bracket you need before attaching the ends to anything. Drop-in nuts are extra but allow addition of accessories to existing builds.
 
  

SECTION: Design the 80/20 frame
15. Consider other useful accessories: cable holders, grounding terminals, leveling feet, and trays.
SECTION: Build the 80/20 frame
16. Plan your build before you start, since end-feed nuts need to be placed inside the T-slot before assembly. Hold them in place with putty until you need them. Otherwise, use drop-in nuts.
SECTION: Build the 80/20 frame
17. Each piece needs to be secured either with larger brackets (i.e. that have 2 screws on each side) or at 2 locations on each end, otherwise they will rotate.
SECTION: Build the 80/20 frame
18. Optional: Add curtains to cover any sides not facing a wall. This prevents the mouse from using changing stimuli (e.g. you, your computer screen, the door to the room) as cues. Add distal visual cues like posters to tether the mouse's representation of its orientation.
SECTION: Build the 80/20 frame
19. Optional: Add storage. Build shelves to store mouse cages and bins of building supplies, enrichment, rewards, and other supplies.
SECTION: Build the 80/20 frame
20. Optional: Add diffused lighting pointed at the ceiling with a dimmer switch. This will prevent glare on the track (problematic for position tracking) and will allow you to darken the room to encourage activity in your nocturnal subjects.
SECTION: Wire LEDs for nosepokes
21. Cut and arrange the following wires:
Cut: yellow 6.5cm, black 4cm + 2x5cm, red 3x4cm. Strip 1/2" off the end of each side of the wire.
Yellow dot (LED emitter): short pin (on top) goes to black 5cm wire, long pin (on bottom) goes to 330 Ohm resistor (orange band towards LED, black band towards wire) which goes to red wire
Red dot (LED detector): short pin (on bottom) goes to black 5cm wire, long pin (on top) goes to 10k Ohm resistor (black band towards LED, orange band towards wire) which goes to red wire AND goes to yellow wire (before resistor)

 
SECTION: Wire LEDs for nosepokes
22. Best way to connect is to fold both wire ends into hooks, pinch hooks closed, then solder over so that connection is physically secured.
  
 

SECTION: Wire LEDs for nosepokes
23. Heatshrink to cover completely
SECTION: Wire LEDs for nosepokes
24. Hook red wires together with red 4cm wire and black wires together with black 4cm wire
SECTION: Wire LEDs for nosepokes
25. Add female pin connectors to ends of yellow wire + red/black extension wires. Be sure to test that the wire isn't inserted too far into the female connector, or else you will not be able to plug the male connector fully in. Heatshrink to cover completely, including the full body of the female pin.
  

SECTION: Assemble nosepokes
26. Print the face mount and the electronics mount, one each per poke: https://github.com/emilyasterjones/X_maze/tree/main/Build. Low resolution is sufficient.
SECTION: Assemble nosepokes
27. Tap screw holes by clamping and drilling them clear with a 4/40 drill bit.
SECTION: Assemble nosepokes
28. Cut 4cm segments of stainless steel tube. Mark with a lab marker, clamp, and cut with dremmel.

 

SECTION: Assemble nosepokes
29. File edges smooth with a metal file. File around the outside rim to soften the spout, and thread a small drill bit into the inside to clear any metal shavings.
SECTION: Assemble nosepokes
30. Thread the spout so it just barely enters the poke, about 0.5cm. Epoxy around the back to secure it to the poke.
SECTION: Assemble nosepokes
31. Thread the LED detector & emitter through and align them with the cutouts near the front of the poke. Check that you can see the detector & emitter bubbles from inside the poke. Secure with tape.
SECTION: Assemble nosepokes
32. Place a very small amount of epoxy along the edges of the detector/emitter and over the wires, bleeding into the valley that runs along the back of the poke. Check that the detector/emitter is lying completely flush with the edges of the poke and that you can still see the detector/emitter bubbles from inside the poke. Allow to cure, checking that no large globs of epoxy are drying anywhere.
SECTION: Assemble nosepokes
33. Apply epoxy to where the wires exit the back of the poke to provide additional security.
SECTION: Assemble nosepokes
34. Once the epoxy is completely cured, thread the front plate over the back plate. Some epoxy may chip off in the process. If too much epoxy was applied, use a flathead screwdriver to detach the detector/emitter from the poke, remove all dried epoxy, and try again. Alternatively, you can try to secure the detector/emitter with electrical tape, but this may move around unexpectedly.
SECTION: Assemble nosepokes
35. Secure the front plate with a screw.
  
  

SECTION: Solder MOSFETs for solenoids
36. Build MOSFET: 2-prong tab on 2-holed edge with female pin receivers facing outwards, 3-prong tab on 3-holed edge with female pin receivers facing outwards, resistor between 2 most spaced apart holes, "brain" tab with 3 thick prongs in 3 holes in center with bare metal piece facing resistor & 2-prong tab; top face is the one with C/+/- on it while bottom face is the one with 2 symbols on it

 

SECTION: Solder MOSFETs for solenoids
37. Insert all but "brain" chip, then rest upside-down on table to solder. Grip with clip to solder the "brain" chip last.
    
  

SECTION: Solder MOSFETs for solenoids
38. Clip all wires as close as possible and epoxy or cover with electrical tape to prevent shorting. Cover ends with epoxy.
 

SECTION: Wire components to power and Arduino
39. Build long doublet wires from green/white twisted wire to connect the components to the Arduino. End one side with soldered male pin connectors (for solenoids and pokes) or male jumper wires (for servo motors). End the other side with male jumper wires. Green wire is ground, white wire is I/O.

 

 


SECTION: Wire components to power and Arduino
40. Split the ground by building a forked wire: 1 end with a male pin/jumper, 2 ends with female pins/jumpers, and in the center all 3 wires hooked together, soldered, and then all covered with black heat-shrink tubing. The male end will plug into the component ground and the female ends will plug into the Arduino and power supply grounds.
  
 


SECTION: Wire components to power and Arduino
41. Build a power octopus: Take a long section of as many twisted pairs as you will need power to (eg 4 for X-maze solenoids). Twist all green wires together, then hook around a short section of black wire, solder, and heatshrink. Repeat with white wires and a section of red wire. Hook the black wire around the center loop of a power barrel and the red wire around the back loop of a power barrel, solder, and heatshrink. Plug the power supply into the in-line switch and then into this octopus.
 
  

 

SECTION: Wire components to power and Arduino
42. Connect wires to components. Each component will have 2 twisted pairs: 1 from I/O and the ground splitter and 1 from power and the ground splitter.
  

SECTION: Mount pokes and motors to track
43. Poke should fit snugly into cutout in enclosure. Mount so that flat surface of back plate is facing up. Secure with 2 screws.
  
SECTION: Mount pokes and motors to track
44. Using zip ties, attach the solenoid to the flat surface of the back plate so that the tubing can flow straight down through the pinch valve into the back of the spout.
  

 

SECTION: Mount pokes and motors to track
45. Attach each 10mL syringe to a 3-way stopcock. Plug the end pointing sideways with a stopper and attach the luer to 1/16" piece to the end pointing away from the syringe.
SECTION: Mount pokes and motors to track
46. Mount the syringes to the 80/20 above the enclosure using velcro. Connect the syringe to the poke spout with a length of tubing, keeping it short to allow gravity to efficiently pull down reward but not too short as to put tension on the tubing.
  

SECTION: Mount pokes and motors to track
47. Load the wash bottles with reward, tap water, and 70% ethanol. Keep the reward bottle refrigerated. At the end of each day of use, release all the remaining reward, then flush the syringe and tubing with tap water and push air through with the syringe plunger to dry. At least once a week, fill the line with ethanol and leave overnight to prevent mold growth. Replace lines between recording cohorts also for this reason.
SECTION: Mount pokes and motors to track
48. Mount the servo motor beneath the floor by threading the plastic screws through the top of the floor into the 4 servo motor holes and securing with the nut pieces included with the servo motor kit.
  
 

SECTION: Mount pokes and motors to track
49. Attach the arm to the servo motor. Superglue the rudders to the servo motor arms so that the screw is not covered. Superglue or acrylic weld the rudder to the base of the door so that the door is centered in the arm. For example dimensions, see "Tap Plastics" tab of parts list.
  

SECTION: Mount pokes and motors to track
50. Secure wires to the underside of the 80/20 using the cable ties.
 

SECTION: Wire and code Arduino
51. Solder the BNC to bare ends connection to a length of twisted wire, then to jumper wires. This will allow the Arduino to send TTL pulses to the BNC breakout board for synchronizing with neural data. Skip this step if you are only acquiring behavioral data; modify the output (BNC) depending on what your system uses if not using NIDAQ system.
SECTION: Wire and code Arduino
52. Plug jumper wire ends into screw terminal breakout. Plug TTL output into A0. Plug inputs and outputs into any digital pin. All inputs and outputs must be grounded to their power source and grounded to the Arduino. For an example pinout, see https://github.com/GiocomoLab/Yggdrasil/blob/main/Yggdrasil/Capture/Arduino/linear_track/linear_track_pinout.txt
  

SECTION: Wire and code Arduino
53. Install Arduino IDE and PuTTy on your computer. Connect the computer to the Arduino via the USB cable. 
SECTION: Wire and code Arduino
54. Write a script to operate the track. See pseudocode below and example script at https://github.com/GiocomoLab/Yggdrasil/blob/main/Yggdrasil/Capture/Arduino/linear_track/linear_track.ino

 

SECTION: Wire and code Arduino
55. Send script to Arduino, which will run indefinitely. Restart the script by sending it again, pressing the reset button, or opening the Serial Monitor. Test to confirm it works.
SECTION: Wire and code Arduino
56. Note what port your Arduino is on (e.g. COM3). If you have multiple Arduinos, they will use different ports, even if the use the same USB cable swapped between them.
Open PuTTy. Set:
Serial line = this port
Speed = the speed you set your Serial as (see Serial.begin() line in your code, this value is usually 9600)
Connection type = Serial
Save this setting so you can load it later.
SECTION: Wire and code Arduino
57. Open Logging (left menu). Click Browse to create a new file. Click Open to start the session. This will restart the Arduino script and store the Serial output to a file while displaying it on your screen. Close the screen to end the session. Note that this just ends saving to a file; the Arduino is still running the script indefinitely.
SECTION: Wire and code Arduino
58. If dispensing reward, calibrate the duration required to dispense the volume needed. Run a simple script which opens and closes solenoids by a certain duration in the setup() (e.g. see calibration scripts at https://github.com/emilyasterjones/X_maze/tree/main/Capture/Arduino), measure how much reward was dispensed, and adjust the amount of time each solenoid is open accordingly. Several short durations will dispense less than one long duration of the same total length, so repeat opening and closing solenoids for a short duration many times (e.g. 10us x 50 times). Run this every time you change syringe height, tubing length, track position, solenoids, pokes, or anything else that might affect how the reward flows from the syringe to the poke.
SECTION: Building an X-maze
59. Following the instructions above, the parts list, and the build files, build the enclosures for a 130cm X-maze,  150cm linear track, a 75cm open field, and a 15cm rest box.

  
SECTION: Building an X-maze
60. Wire 2 pokes and 2 solenoids and mount on the linear track. Wire the solenoids to a single power source and switch and the pokes to a single power source and switch. Connect to an Arduino. Repeat for X-maze, making 4 pokes, 4 solenoids, and 4 servo motors, again wiring each type of component all to a single power source and switch and connecting to a second Arduino.
SECTION: Building an X-maze
61. Add local cues. Print ~15cm tall visually distinct cues (e.g. blue circle, red heart). Laminate and mount with Scotch extreme fasteners to the outside of the ends each arm of the X-maze, above the poke.
SECTION: Building an X-maze
62. Test the linear track and X-maze scripts at https://github.com/emilyasterjones/X_maze/tree/main/Capture/Arduino.
In the X-maze, the mouse learns to run from the open arm on the left to the correct choice on the right. There are 3 X-maze configurations:
training: 1 left door and 1 right door closed, switching between top and bottom trajectories, so mouse effectively runs 2 alternating linear tracks
probe: 1 left door closed, switching between top and bottom trajectories, both right doors open, mouse must choose the same arm as they sampled on the left (top or bottom, eg top left->top right)
reversal: same as probe, except the mouse must choose the opposite arm from what they sampled (e.g. top left->bottom right)
  

SECTION: Building an X-maze
63. Train and record mice according to the protocol at https://github.com/emilyasterjones/X_maze/blob/main/Capture/protocol.md. 
 
 
Example of mouse completing a few trials of the double forced track:
 
 

SECTION: Build counterweight pulley
64. The goal of the pulley counterweight is to (1) lift the data cable off of the mouse and towards data acquisition system and (2) reduce weight on the animals' head. First, attach a pulley, facing parallel with the main travel direction (e.g. along a linear track), as high as possible above the center of the enclosure. Using the parts list as a guide, thread the screw through an L-bracket attached to overhead 80/20 and secure with the nut piece.
  

 

SECTION: Build counterweight pulley
65. Mount a second pulley along the side of the 80/20 frame, far enough away that it won't ever be above the mouse.
  

SECTION: Build counterweight pulley
66. Tie one end of the nylon line to a 15mL conical tube, just below the cap. Thread the line up the second pulley, over the center pulley, and down to the headstage holder. Loop it into the headstage holder and secure with a knot. Make the line long enough so that the 15mL conical tube is at a height you can reach.
SECTION: Build counterweight pulley
67. Run the data cable along the center nylon line, as far up as you can, loosely attaching the data cable to the line using small knots of more nylon line. Leave some slack so that the data cable can twist itself around the line as the mouse rotates.
  
SECTION: Build counterweight pulley
68. Secure the other end of the data cable to a wall above the acquisition system. Affix using loops of folded over tape, so that the data cable stays running down the wall but can easily be pulled up or down.
  

SECTION: Build counterweight pulley
69. Add water to the conical tube, testing how mice move with different amounts of water. Too little water and the counterweight won't alleviate enough weight, causing mice to tilt their heads under the weight. Too much water and the counterweight will pull the mice towards the center pulley, causing mice to be unable to reach far corners of the enclosure. If the 15mL conical tube is too much weight, you can add a third pulley or swap for an Eppendorf tube.
SECTION: Build counterweight pulley
70. Monitor the data cable, making sure it doesn't get too twisted around the pulley line, which could prevent the mice from reaching far corners of the enclosure. Keeping the data cable taut between the pulley line and the wall reduces this twisting, as instead the cable along the line will twist on itself. Between epochs of recording, rotate the mouse in your hands to alleviate any twisting, as once twisting begins it can quickly get worse.
SECTION: Build headfixation apparatus
71. This attachment to the 80/20 frame allows you to briefly headfix mice so you can plug their headstage in easily, able to use both hands and move away to check the neural signal or get supplies during the process. First, machine standard headfork, or machine custom headfork if using chronic Neuropixels build: https://github.com/emilyasterjones/chronic_NPX_mouse/tree/main/headforks
SECTION: Build headfixation apparatus
72. Cut a 3 inch slice of the foam roll to create a wheel. Paint with black spray paint (to make the surface easier to clean) and anti-ESD spray.
SECTION: Build headfixation apparatus
73. Drill a 6mm hole through the center of the wheel. Thread the metal rod through the center hole and center the wheel on the rod. Epoxy to secure.
SECTION: Build headfixation apparatus
74. Attach the 8 inch 80/20 pieces to the outside edge of one of the levels of your 80/20 frame, making a box. Secure with L-brackets along the inside of each of the 4 joints. You will have 4 sides of your box: 1 from the main 80/20 frame (referred to as Side 1), 2 extruding out from it (referred to as Sides 2 and 3 for left and right), and 1 connecting the 2 extruding pieces (referred to as Side 4).
SECTION: Build headfixation apparatus
75. Attach the mounting post to the post base, then place that on Side 1, next to Side 2. Place the 1/4"-20 drop-in nuts in the 80/20, then thread the accompanying screws through the post base into the nuts and screw in. The post will be positioned in a later step.

 

SECTION: Build headfixation apparatus
76. Attach the post bracket (large black piece) to the post. Position the bracket so it is parallel to Side 1 and pointed towards Side 3. Place the mounting base (small flat black piece) pointed towards the interior of the box, perpendicular to the post bracket. Affix this to the top of the post bracket using 2 1/2" screws each threaded through a washer, then affix the headfork to the underside of this mounting base using the 2 1" screws each threaded into a nut.
SECTION: Build headfixation apparatus
77. Thread the 0.5" posts into the post bases, attach to pedestal adapters, then place those on Sides 2 and 3. Place a clamping fork around the base of each and secure each with 2 1/4"-20 screws and drop-in nuts. These posts will be positioned in a later step.
SECTION: Build headfixation apparatus
78. Thread the rod holding the wheel through the thin holes of the right-angle clamps, one on each side, then thread the posts through the larger holes and tighten bolts to secure. Adjust the posts so that the wheel is parallel to the box, then adjust the right-angle clamps so that the wheel is centered over the box with the rod parallel to the floor.
 
  

SECTION: Build headfixation apparatus
79. Adjust the position of each of the parts:
left/right position of mounting post: center over wheel
distance between wheel posts and Side 1: make headfork end about 1.25cm in front of the center of the wheel
height of wheel and headfork: make distance between base of headfork and top of wheel 3cm

 

SECTION: Build headfixation apparatus
80. Place magnetic hex key and magnetic headbar screws in a tray attached to the inside of the 80/20 box. Place a weigh boat on Side 1 behind the wheel to catch poop. Keep the headstage holder next to the wheel by taping to the 80/20 frame.
  
  
 
      

SECTION: Record
81. If using the chronic Neuropixels implant described in the other protocols in this collection, refer tohttps://github.com/emilyasterjones/X_maze/blob/main/Capture/protocol.md for how to record using the completed system. With handling and acclimatization, mice reach the same running speeds and trials per minute as before surgery within 3-5 days. See video below for a tour of the completed system, including a linear track and open field.