An open-source platform for head-fixed operant and consummatory behavior

Head-fixed behavioral experiments in rodents permit unparalleled experimental control, precise measurement of behavior, and concurrent modulation and measurement of neural activity. Here, we present OHRBETS (Open-Source Head-fixed Rodent Behavioral Experimental Training System; pronounced ‘Orbitz’), a low-cost, open-source platform of hardware and software to flexibly pursue the neural basis of a variety of motivated behaviors. Head-fixed mice tested with OHRBETS displayed operant conditioning for caloric reward that replicates core behavioral phenotypes observed during freely moving conditions. OHRBETS also permits optogenetic intracranial self-stimulation under positive or negative operant conditioning procedures and real-time place preference behavior, like that observed in freely moving assays. In a multi-spout brief-access consumption task, mice displayed licking as a function of concentration of sucrose, quinine, and sodium chloride, with licking modulated by homeostatic or circadian influences. Finally, to highlight the functionality of OHRBETS, we measured mesolimbic dopamine signals during the multi-spout brief-access task that display strong correlations with relative solution value and magnitude of consumption. All designs, programs, and instructions are provided freely online. This customizable platform enables replicable operant and consummatory behaviors and can be incorporated with methods to perturb and record neural dynamics in vivo.


Abstract: 26
Head-fixed behavioral experiments in rodents permit unparalleled experimental control, precise 27 measurement of behavior, and concurrent modulation and measurement of neural activity. Here we 28 present OHRBETS (Open-Source Head-fixed Rodent Behavioral Experimental Training System;29 pronounced 'Orbitz'), a low-cost, open-source platform of hardware and software to flexibly pursue the 30 neural basis of a variety of motivated behaviors. Head-fixed mice tested with OHRBETS displayed 31 operant conditioning for caloric reward that replicates core behavioral phenotypes observed during 32 freely moving conditions. OHRBETS also permits optogenetic intracranial self-stimulation under 33 positive or negative operant conditioning procedures and real-time place preference behavior, like that 34 observed in freely moving assays. In a multi-spout brief-access consumption task, mice displayed 35 licking as a function of concentration of sucrose, quinine, and sodium chloride, with licking modulated 36 by homeostatic or circadian influences. Finally, to highlight the functionality of OHRBETS, we measured 37 mesolimbic dopamine signals during the multi-spout brief-access task that display strong correlations 38 with relative solution value and magnitude of consumption. All designs, programs, and instructions are 39 provided freely online. This customizable platform enables replicable operant and consummatory 40 behaviors and can be incorporated with methods to perturb and record neural dynamics in vivo. 41

Impact Statement: 42
A customizable open-source hardware and software platform for conducting diverse head-fixed 43 behavioral experiments in mice. 44 45 stages: 1) free-access lick training, 2) retractable spout training, and 3) operant conditioning (Methods). 146 To measure the reproducibility of OHRBETS, all experiments were conducted using 4 independent 147 Operant-Stage assemblies (referred to as box ID, data shown in supplements). To assess the potential 148 differences between subsets of mice, we compared behaviors across each independent OHRBETS 149 setup (box ID), sex, cohort (order of head-fixed and freely moving behavior). We compared the 150 behaviors measured across box ID to determine if each setup was consistent enough to produce 151 quantitatively similar behaviors despite the inherent variability associated with independent behavioral 152 setups. 153 We trained mice on a single session of free-access lick training to facilitate licking from the 154 spout and reduce stress associated with head-fixation (Figure 2-figure supplement 1). Free-access 155 lick training consisted of a 10 min session where each lick immediately triggered a delivery of ~1.5 µL 156 of 10% sucrose which approximates free-access consumption from a standard lick spout ( To measure the relationship between cost and active response rate, after completing 1 session with a 209 fixed-ratio of 1/4 turn and 5 sessions of a fixed-ratio of 1/2 turn ( Figure 2G-I), we increased the fixed-210 ratio to 1 turn and measured operant responding for 4 sessions. As observed in freely moving rodents 211 (Figure 2-figure supplement 4B), when we increased the cost of reward, mice significantly increased 212 responding in the active direction but not the inactive direction ( Figure 2J, all sessions shown in Figure  213 2-figure supplement 4A) indicating that they show flexible response rates as a function of reward cost 9 LHA Glut neurons, we expressed cre-dependent channelrhodopsin-2 (ChR2) or cre-dependent mCherry 250 in the LHA of Slc32a1 Cre (Vgat-Cre) or Slc17a6 Cre (Vglut2-Cre) mice (Vong et al., 2011) and implanted 251 bilateral optic fibers with a head-ring to facilitate head-fixation ( Figure 3A, fiber placements depicted in 252 supplement 1A ). Vgat-Cre and Vglut2-cre mice expressing mCherry were pooled and used as a 314 single control group after observing no statistical differences in behavior between the two genotypes. In 315 the standard RTPT, freely moving mice traverse a two-chamber arena in which they receive 316 optogenetic stimulation when the mouse is located in one of the two chambers ( Figure 4B, top). In of the wheel, one of which was paired with optogenetic stimulation (Figure 4B, bottom). To enhance 319 the mouse's ability to determine their position on the wheel, we included two auditory tones of different 320 frequencies (5 and 10kHz, 80dB) that indicated the mouse's position in the two zones. The two 321 chamber RTPT and WTP assays offers a distinct advantage for comparing behavior across different 322 versions of the assay because throughout the entire session duration the subject is in one of two states 323 (stimulated or not), allowing for a one-to-one comparison of the amount of time stimulated over the 324 duration of the fixed session duration. For both tasks, mice were initially habituated without stimulation 325 for 1 session and then underwent RTPT/WTP over 6 sessions with frequency and chamber/wheel-zone 326 pairing counterbalanced ( Figure 4C). For the WTP, mice were initially trained without an auditory tone 327 indicating the wheel zone. After initial training, we paired the wheel zones with auditory tones and found 328 that mice exhibited more obvious preference/avoidance (Figure 4-figure supplement 3A), so in 329 subsequent sessions these zone cues were added to the task design. Using this approach, we 330 measured the similarity in preference/avoidance behavior with a range of rewarding and aversive 331 stimulation magnitudes across freely moving RTPT and head-fixed WTP. 332 Mice expressed similar preference/avoidance behaviors during freely moving RTPT and head-333 fixed WTP procedures ( Figure 4D-E, Figure 4-figure supplement 1). Specifically, mice expressing 334 mCherry (LHA:Control mice) did not show preference nor aversion for the stimulation paired 335 chamber/zone across all stimulation frequencies in both the freely moving and head-fixed procedures 336 ( Figure 4D, E). On the contrary, LHA GABA :ChR2 mice showed strong place preference while 337 LHA Glut :ChR2 mice showed strong place aversion for the paired chamber/zone with higher stimulation 338 frequencies compared to lower stimulation frequencies (Figure 4D, E). There was no statistical 339 difference between the amount of time in the paired chamber/zone in the freely moving and head-fixed 340 versions of the task (Figure 4D, E). Furthermore, the time In the paired chamber/zone was correlated 341 across freely moving RTPT and head-fixed WTP for LHA GABA :ChR2 and LHA Glut :ChR2 mice, but not 342 LHA:Control mice (Figure 4-figure supplement 2). Together, these results indicate that the WTP task 343 conducted with OHRBETS measures preference/avoidance behavior similar to freely moving 344 procedures and provides a useful experimental approach for measuring the valence of stimuli. 345 346 OHRBETS trained mice display consummatory behaviors dependent on the concentration of 347 appetitive and aversive solutions 348 Exposure to appetitive and aversive taste solutions provides an approach to measure neuronal 349 correlates of appetitive and aversive events in addition to operant responding. Within-session 350 consumption of unpredictable tastants allows for measuring a range of behavioral and neuronal 351 responses to gradations in solution valence. We adapted OHRBETS to include a retractable, radial 352 multi-spout consisting of 5 spouts ( Figure 5A, Video 3). Using this system, we provided discrete 353 access periods to one of five solutions with different concentrations in the same session with a task 354 design adapted from the Davis Rig (Davis, 1973;Smith, 2001). Each behavioral session consisted of 355 100 trials with 3 s of free-access consumption separated by 5 -10 s inter-trial intervals during which all 356 spouts were in the retracted position ( Figure 5B). Mice were given access to each of the solutions in 357 pseudorandom order such that each solution was available 2 times every 10 trials. To control for 358 modest spout effects (Figure 5-figure supplement 1 M-O) and reduce prediction of the solution prior 359 to tasting the solution (Figure 5-figure supplement 4 A-C), we conducted the experiment 360 counterbalanced over 5 sessions such that each spout was paired with each concentration (Figure 5C, 361 J, Q). Using this approach, we measured within-session consumption of gradations in concentration of 362 an appetitive solution (sucrose) and two aversive solutions (quinine and hypertonic sodium chloride 363 (NaCl)). 364 Prior to behavioral training, mice were water-restricted to 80-90% baseline bodyweight (Guo et 365 al., 2014). However, during behavioral sessions, multiple mice were able to consume enough fluid to 366 maintain weight above 90% baseline body weight. Separate groups of mice were used for sucrose, 367 quinine, and sodium chloride solution sets to control for training history. All groups of mice were initially 368 conditioned on free-access licking in 1 -2 sessions and then conditioned with the multi-spout procedure 369 for 3 -7 sessions prior to 5 sessions of counterbalanced spout pairing (summarized in Figure 5). The 370 licks measured using this approach approximate consumption, as total number of licks during each 371 session is strongly correlated with weight in fluid consumed during the session (  To determine if OHRBETS multi-spout assay could detect shifts in consumption behavior 418 following behavioral challenges, we measured consumption of a gradient of sucrose concentrations across homeostatic demand states. We trained mice in the multi-spout brief-access task for 5 sessions 420 under water-restriction, then 5 sessions under food-restriction, and ending with 5 sessions under no 421 restriction (ad-libitum) ( Figure 6A). We observed strong effects of restriction state on consumption 422 behavior across sucrose concentrations ( Figure 6B notably, mice showed a substantially larger range of licking behavior under food-restriction compared to 424 water-restriction and ad-libitum ( Figure 6B). Mice showed vastly different levels of total number of licks 425 with the greatest number of licks for all concentrations under water-restriction, then food-restriction, 426 then ad-libitum (Figure 6B, C). Mice also displayed differences in licking rate throughout the session 427 ( Figure 6C, D). The minor scaling in licking across sucrose concentrations under water-restriction 428 compared to food-restriction could indicate that the water component of the solutions is strongly 429 appetitive under water-restriction. Using OHRBETS, we measured changes in the relative consumption 430 of concentrations of sucrose across homeostatic demand states that closely parallels the effect of 431 homeostatic demand on sucrose consumption described in freely moving rodents (Glendinning et al., 432 2002;Smith et al., 1992;Spector et al., 1998). 433 To determine if our head-fixed multi-spout assay could detect shifts in consumption of NaCl, we 434 measured consumption of a gradient of NaCl concentrations across sodium demand states. We first 435 trained mice under water-restriction ( Figure 5) before allowing mice to return to ad-libitum water. Next, 436 we manipulated sodium appetite using furosemide injections followed by access to sodium depleted 437 chow (sodium-deplete) or standard chow (sodium-replete) and then measured consumption of a 438 gradient of NaCl concentrations in our multi-spout assay over 2 sessions (counterbalanced order of 439 sodium appetite state) ( Figure 6E). Mice displayed greater licking under the sodium-deplete state 440 compared to the sodium-replete state ( Figure 6F-H, Figure 6-figure supplement 1F-J). Specifically, 441 mice when sodium-deplete showed higher levels of licking for both water and 0.25M NaCl. Mice 442 displayed more licking throughout the session when sodium-deplete, indicating a heightened demand 443 ( Figure 6G-H). The increased licking for water when sodium-deplete can potentially be attributed to 444 higher levels of thirst, as previously described (Jalowiec, 1974 To characterize behavior across the circadian light/dark cycle, we measured consumption of a 451 gradient of sucrose concentrations under food-restriction during the dark cycle or light cycle in separate groups of mice ( Figure 7A). During 2 sessions of free-access consumption, mice tested in the dark 453 cycle consumed significantly more 10% sucrose compared to mice tested in the light cycle ( Figure 7B) 454 (Bainier et al., 2017;Smith, 2000;Tõnissaar et al., 2006). Across 8 sessions of the multi-spout assay, 455 mice tested in the dark cycle licked more compared to mice tested in the light cycle (Figure 7C left); 456 however, over sessions 4 -8 there was no effect of light cycle on licking (Figure 7C right). Despite 457 similar overall licking in the multi-spout assay, we found that experiments conducted during the light 458 and dark cycle resulted in distinct licking across sucrose concentrations ( Figure 7E) (Bainier et al., 459 2017;Tõnissaar et al., 2006). Furthermore, compared to mice tested in the light cycle, mice tested 460 during the dark cycle showed higher levels of consumption early in the session (Figure 7F, G). 461 Together, these results indicate that the light/dark cycle affects sucrose consumption and testing mice 462 in the light cycle leads to pronounced reductions in consumption in early training sessions. 463

464
Comparing the reproducibility of the multi-spout brief-access task across independent 465 laboratories 466 To determine if our system produces quantitatively similar consumption across labs, we 467 compared behavior of food-restricted mice tested in the dark cycle trained on the multi-spout brief-468 access to a gradient of sucrose concentrations obtained with our head-fixed system across 469 independent labs and geographic locations ( Stuber lab is shown in Figure 6, and data collected in the Roitman lab is shown in Figure 7). We 471 observed qualitative differences in the binned licking rate over the 3 s access period (Figure 7-figure  472 supplement 1B), with higher licking rate in mice tested in the Roitman lab near the onset of the 473 access-period. We also found that mice tested in the Roitman lab exhibited a small, but significant, 474 reduction in inter-lick intervals compared to the Stuber lab (Figure 7-figure supplement 1). The 475 source of these differences is not clear but could potentially be the product of differences in 476 experimenter positioning of the spout resulting in subtle differences in licking patterns. However, 477 despite these nominal differences, there were no statistical differences in the mean licking for each 478 concentration of sucrose across labs (Figure 7-figure supplement 1D). These data indicate that our 479 system produces similar consumption behavior when run in different labs, geographic locations, and 480 experimenters. To demonstrate the utility of the multi-spout assay run on OHRBETS, we performed 485 simultaneous dual fiber-photometry in the mesolimbic dopamine system during the multi-spout assay. 486 The activity of ventral tegmental area dopamine neurons and the release of dopamine in the nucleus 487 accumbens are well known to scale with relative reward value such that the most rewarding stimuli 488 produces increases in dopamine release and the least rewarding stimuli produces modest decreases in 489 dopamine release (Eshel et al., 2015;Hajnal et al., 2004;Tobler et al., 2005). We used multi-spout 490 brief-access to a gradient of an appetitive solution (sucrose) and an aversive solution (NaCl) to elicit a 491 range of consummatory responses (Figure 5, 6      Furthermore, these data indicate that OHRBETS is highly compatible with neural recording and 540 manipulation techniques that would be challenging with freely moving behavioral designs. 541

Discussion: 542
OHRBETS is a customizable, inexpensive system for head-fixed behavior in mice that enables 543 a variety of behavioral experiments, including operant conditioning, real-time place testing, and multi-544 solution brief-access consumption, accurately replicating behaviors in freely moving. These data 545 demonstrate that a diverse set of operant and consummatory behaviors are compatible with head-fixed 546 procedures run with a single hardware setup and will serve as a resource for future investigations into 547 these behaviors using neuroscience approaches that rely on head-fixation. The ability to conduct operant reinforcement and WTP with a single setup is particularly useful in 556 measures of valence-related neural circuits, but these results also imply that the head-fixed WTP 557 procedure could be used to test the appetitive and aversive quality of other stimuli that are challenging 558 to test in freely moving conditions including discrete somatosensory stimuli. Taken together, our results 559 establish that our behavioral system produces robust, reproducible operant behavior consistent with the 560 commonly employed freely moving counterparts. 561 Despite the quantitatively similar preference and aversion we measured between the head-fixed 562 WTP assay and freely moving RTPT assay, there exists multiple differences between these assays that 563 could influence behavioral results and their interpretation. Similar to the RTPT assay, the WTP assay 564 assesses valence through the use of two mutually exclusive states (e.g. optogenetic stimulation vs non-565 stimulation). However, the WTP assay does not replicate the spatial components of the RTPT assay 566 (Gordon-Fennell & Stuber, 2021). The head-fixed and freely moving assays almost certainly rely on 567 different neuronal circuits for completing the task, as the head-fixed WTP does not contain the spatial 568 contextual cues that are inherent to freely moving RTPT and instead relies on discrete auditory cues in 569 addition to the internal state of the subject. Due in part to this distinct difference, we do not expect that 570 all circuit manipulations will produce comparable behavior across the head-fixed WTP and freely 571 moving RTPT even though optogenetic stimulation of LHA GABA and LHA Glut produced similar preference 572 and avoidance behaviors within these two assays. Therefore, while WTP conducted using OHRBETS 573 offers the ability for new and exciting experiments to assess valence of stimuli in head-fixed mice, the 574 relation of these results to the results of RTPT should be interpreted with caution. 575 In addition to the operant conditioning experiments, our system can facilitate multi-solution brief-576 access experiments for studying consummatory behavior. In our task, mice show consumption of a 577 gradient of sucrose, quinine, and NaCl concentrations that closely matches behavior with the freely 578 1998). However, homeostatic demand states produced pronounced differences in the range of 583 consumption behavior across sucrose concentration, as food-restriction produced a substantially larger 584 range of licking behavior compared to water-restriction. One unexpected finding was that mice showed 585 vastly different behavior when licking for the aversive tastants quinine and hypertonic NaCl. When 586 licking for quinine, mice abruptly ceased consumption for all concentrations mid-way through the concentrations of NaCl throughout the entire session. These results may be explained by an additive 589 effect of quinine that builds in aversion over trials and results in a lingering bitter taste (Leach and 590 Noble, 1986) that attenuates motivation to initiate consumption. During the NaCl sessions, NaCl may 591 stimulate thirst (Kraly et al., 1995;O'Kelly, 1954;Stricker et al., 2002) resulting in enhanced motivation 592 to consume water. Thus, the multi-spout brief access task with gradients of NaCl can be a uniquely 593 advantageous approach for eliciting a high number of strongly aversive events in response to the 594 highest concentrations of NaCl (1.0 and 1.5M) while continuing to sustain behavioral engagement. 595 Changes in task design could improve performance during the quinine task, such as including water 596 rinse trials between each quinine trial (Loney and Meyer, 2018). In addition to using a gradient of 597 solution concentrations, any number of combinations of tastants could be used to study a whole host of 598 behavioral phenomena including innate and conditioned consumption behaviors. 599 One potential confound of the radial head design for the multi-spout brief-access experiments is 600 that subjects may be able to learn the relationship between the rotational position of the radial head and 601 the solution in order to use this information to predict solutions before tasting them. We Eliminating locomotion improves compatibility with many standard neuroscience approaches 644 including optogenetics, fiber-photometry, electrophysiology, and calcium imaging. To prevent twisting of 645 tethers, each of these approaches requires a commutator in freely moving conditions, but with head-646 fixation the need for a commutator is eliminated. This facilitates multiplexed experiments with 647 simultaneous use of multiple approaches that each rely on independent tethers without the risk of 648 weighing down the animal, tangling, or twisting to the point of affecting task performance. The OHRBETS platform presented here was designed to be scalable, flexible, and compatible 677 with external hardware. By using low-cost, open-source, and 3D printed components and publishing 678 extensive instructions for assembly, our system is affordable and scalable across labs of all sizes and 679 budgets. Despite the use of low-cost and 3D printed components, our system is remarkably consistent 680 and reliable across hundreds of behavioral sessions. Our hardware and software are modular, as all 681 hardware components can be easily swapped, and all behavioral programs are written to produce data 682 with a uniform format. Using different combinations of components will facilitate conducting a wide 683 variety of behavioral experiments including all the experiments presented in this manuscript and many 684 more. By using an Arduino Mega case as a microprocessor mounted within a 3D printed enclosure, one 685 can integrate many different forms of connectivity to interface with external hardware. In the online 686 models, we have options for communication via BNC, Cat6, and DB25 that can be easily combined to 687 suit the user's needs. Altogether, OHRBETS is a complete platform for diverse behavioral experiments 688 in head-fixed animals that can be easily adapted by the broader scientific community to conduct an 689 even wider range of procedures that are compatible with monitoring and manipulating neural dynamics 690 in vivo. 691

Declaration of interests: 693
The authors declare no competing interests. 694

Key Resources
Hardware 712 3D printed components designed and available via the web-based cad software TinkerCAD 713 (Autodesk) and printed using a filament printer (Ultimaker S3) using PLA or resin printer (Form3) using 714 Clear Resin. 3D printed components with 0.15mm layer height require approximately 52 hours of print 715 time. Components can also be ordered in batch through online 3D printing services to reduce printing 716 demand locally. The micropositioner design was based on one created by Backyard Brains (Backyard 717 Brains, 2013) and the retractable spout design was based on one created by an independent designer 718 (Buehler, 2016b). 719 All behavioral hardware was controlled using an Arduino Mega 2560 REV3 (Arduino). The 720 timing of events was recorded via serial communication from the Arduino to the computer (PC, running 721 Windows10) by USB. Lick spouts were made by smoothing 23 gauge blunt fill needles using a Dremel 722 with a sanding disk. Liquid delivery was controlled by solenoids (Parker 003-0257-900) gated by the 723 Arduino, using a 24V transistor. The retractable spout, radial spout, and wheel brake utilized micro 724 servos (Tower Pro SG92R). Licks on each spout were detected individually using a capacitive touch 725 sensor (Adafruit MPR121) attached to each metal spout. Importantly, the baseline capacitance of each 726 sensor was kept to a minimum and touch thresholds were reduced from standard values (see GitHub 727 for detailed instructions). The MPR121 is compatible with optical experiments but may not be 728 compatible with all electrophysiology approaches and may therefore need to be replaced with other 729 appoaches for measuring licks. Micropositioners were assembled from 3D printed components, Super 730 Glue (Loctite Super Glue ULTRA Liquid Control), screws, and nuts. 731

Hardware Validation 732
We measured the consistency of the retractable spout extension latency and terminal positions 733 using video recording. We recorded 1,000 extension/retractions in 5 separate retractable spouts using 734 a high-speed video camera (Basler, acA800-510um, 200 fps). We then estimated the position of the  Mice were anesthetized using isoflurane (5% induction, 1.5-2% maintenance), shaved using 770 electric clippers, injected with analgesic (carprofen, 10 mg/kg, s.c.), and then mounted in a stereotaxic frame (Kopf) with heat support. Skin overlying the skull was injected with a local anesthetic (lidocaine, 772 2%, s.c.) and then sterilized using ethanol and betadine. Next, an incision was made using a scalpel, 773 and the skull was cleared of tissue and scored using the sharp point of a scalpel. The skull was leveled, 774 2 burr holes were drilled in the lateral portion of the occipital bone, and 2 micro screws were turned into 775 the bone. We then coated the bottom of a stainless-steel head-ring (custom machined, see GitHub for 776 design) with Super Glue, placed it onto the skull of the mouse, and then encased the head-ring and 777 skull screws with dental cement making sure the underside of the ring remained intact. After the dental 778 cement had time to fully dry, the mouse was removed from the stereotaxic frame and allowed to 779 recover with heat support before being returned to their home cage. Mice were allowed to recover for at 780 least 1 week prior to dietary restriction. 781 Mice used for optogenetic or fiber-photometry experiments underwent the same procedure as 782 above with the addition of a viral injection and fiber implantation. Following implantation of skull screws, 783 we drilled a burr hole overlaying the brain region target. We then lowered a glass injection pipette into 784 the target brain region and injected the virus at a rate of 1nL/s using a Nanoject III (Drummond), waited 785 5 min for diffusion, and then slowly retracted the pipette. For optogenetic experiments, we injected 786 300nL of AAV5-EF1a-DIO-hChR2(H134R)-eYFP (titer: 3.2e12) or AAV5-Ef1a-DIO-mCherry (titer: 787 3.3e12), and for fiber-photometry experiments, we injected 400nL of AAV9-hSyn-GRAB-DA1h (titer: 788 2.7e13) or AAV9-hSyn-GRAB-DA2m (titer: 2.4e13). The following stereotaxic coordinates (relative to Doric) 0.2 mm dorsal to the injection site and then encased the fiber extending from the brain, metal 795 ferrule, and head-ring with Super Glue and dental cement. Mice were allowed to recover for at least 2 796 weeks prior to behavior or dietary restriction. 797 Behavior 798

Habituation to Head-Fixation and Free-Access Lick Training 799
Prior to head-fixed behavior, mice were habituated to the experimenter and head-fixation stage 800 over 4 sessions. In the first session, mice were brought into the behavioral room and allowed to explore 801 the head-fixed apparatus to become acquainted with the sights, smells, and sounds of the behavioral 802 box. On the second session, mice were brought into the behavior room and scruffed twice. In the third and hind paws placed in a 50 mL conical twice. After each habituation session, the mouse was 805 immediately provided food or water depending on their deprivation status. Mice undergoing head-fixed 806 operant conditioning for sucrose or head-fixed multi-spout consumption were habituated to head 807 fixation and trained to lick for sucrose in a single 10 min session. During this session, mice were given 808 free-access to water (mice used for quinine and NaCl multi-spout experiments Figure  increased fixed-ratio, and then 5-6 sessions of progressive-ratio. Throughout operant conditioning, one 822 direction of rotation was assigned as the active direction and the opposite direction was assigned as 823 inactive (counterbalanced across mice). Rotation in the active direction earned sucrose delivery. Each 824 sucrose delivery consisted of wheel brake engagement, followed by spout extension and 5 pulses of 825 ~1.5 µL of 10% sucrose with an inter pulse interval of 200ms. During the 3 s access period, the spout 826 remained extended, a 5 kHz auditory tone was presented, and the brake was left engaged. Rotation in 827 the inactive direction led to wheel brake engagement for the same length of time as the total brake time 828 with active rotation, but the spout did not extend, and sucrose was not delivered. During initial training, 829 the fixed-ratio of reward was 1/4 turn in the first session and 1/2 turn during the next 5 sessions. During 830 increased cost sessions, the fixed-ratio was increased to 1 turn. A total of 3 mice that underwent initial 831 training were removed from progressive ratio training, 2 for not learning the task and 1 that lost their 832 headcap during behavior. During progressive ratio, the wheel turn cost of reward was increased either 833 semilogarithmic (0.25, 0.5, 0.81, 1.21, 1.71, 2.3, 3.1, 4.1, etc., approximating (Richardson and Roberts, 834 1996) or linearly by 0.5 rotation (0.5, 1.0, 1.5, 2.0, 2.5, 3.0, etc.) each time a reward was earned. The 835 session duration was 1h, or 15 min without earning a reinforcer, whichever comes first. 836 Reversal training was performed in a naive cohort of mice using an identical procedure to initial 837 operant conditioning training, except in session 6 the direction of the wheel rotation that was reinforced 838 was inverted (right turn reinforced → left turn reinforced). Following reversal, the mice were trained on 839 the task for an additional 7 sessions of operant conditioning. During habituation, mice were habituated to head-fixation as outlined above but without sucrose 859 provided. Over the next 12 sessions, mice underwent daily 20 min WTP sessions with stimulation 860 paired to one half of the wheel. Throughout WTP, mice were head-fixed, an optic fiber was connected 861 and covered using blackout tape, and the start of the session was indicated when the wheel brake was 862 For experiments with alterations in the homeostatic demand for sucrose solution, mice were 936 trained on the multi-spout assay under 3 homeostatic states in series (water-restricted, food-restricted, 937 then ad-libitum). First, mice under water-restriction were trained in the multi-spout assay for different 938 concentrations of sucrose over 8 sessions. Mice were then removed from water-restriction and 939 maintained on food-restriction for 1 week prior to being run through the multi-spout assay for 5 940 sessions. Finally, mice were removed from all restrictions and maintained with ad-libitum access to food 941 and water for 3 sessions prior to being run through the multi-spout assay for 8 sessions. The final 5 942 sessions from each homeostatic demand state were used for analysis. Mice that went through the fiber-943 photometry recording experiment were run through the same procedure except the order of water-944 restriction and food-restriction was counterbalanced across mice, and they were run for 3 sessions of 945 free-access spout training. 946 For experiments with alterations in the homeostatic demand for sodium chloride, mice were 947 trained under water-restriction and were then run under two homeostatic states in counterbalanced 948 order (sodium-deplete, sodium-replete). First, mice under water-restriction were trained in the multi-949 spout assay with different concentrations of sodium chloride over 10 sessions. Mice were removed from 950 water-restriction and given ad-libitum access to water for 48h prior to manipulations of sodium demand. 951 To generate sodium demand, we used 2 injections of diuretic furosemide (50mg/kg) over 2 days (Jarvie 952 and Palmiter, 2017). Mice were weighed, injected with furosemide, and then placed into a clean cage 953 with bedding for 2 hours before being weighed again to confirm diuretic effect (~5% weight loss). Mice 954 were then returned to a clean home cage with ad-libitum access water and sodium free chow (Envigo, 955 TD.90228) (sodium-deplete) or a novel sodium-balanced chow (Envigo, TD.90229) (sodium-replete). 956 Mice underwent the same procedure a second time 24h later and then were tested for behavior after an 957 additional 24h. Mice were tested in the multi-spout assay under either sodium-deplete or sodium-958 replete states in a single session. Following 48h of ad-libitum access to water and standard laboratory 959 chow, mice went through the furosemide treatment and behavioral testing again with the opposite 960 homeostatic state. 961

Fiber-Photometry 962
Wild-type mice underwent surgery for expression of dopamine sensors and fiber implantation as 963 outlined above (see Surgeries) before undergoing multi-spout consumption of sucrose under different 964 homeostatic demand states (see Homeostatic Demand Multi-Spout Experiments). We recorded 965 dopamine dynamics in the NAc medial shell and lateral shell simultaneously during behavior in the 966 multi-spout assay over 3 consecutive sessions in each homeostatic demand state. After head-fixation, 967 we connected to the mouse's fiber implant, patch cables (Doric, 400 µm, 0.37NA, 2.5 mm stainless 540)_E2(555-570)_F2(580-680)_S) that was coupled to an integrated fiber-photometry system (Tucker-970 Davis Technologies, RZ10X). We delivered 405 nm and 465 nm light sinusoidal modulated at 211 Hz 971 and 331 Hz, respectively. The average power for each wavelength was calibrated to 30 µW using a 972 power meter (Lux integrated with the RZ10x) prior to the experiment. The fluorescent emission 973 produced by 405 nm and 465 nm excitation were collected using the same fiber used to deliver light 974 and were measured on a photodetector (Lux) and demodulated during recording. The timing of 975 behavioral events were recorded via TTL communication to the fiber-photometry system. 976 Fiber-photometry was analyzed using custom Python and R scripts that are freely available 977 through our GitHub (archived at swh:1:dir:aecebc3076d83fec0b6dfe76ecf9c34fef8ca356). A custom 978 Python script was used to convert raw data into tidy format and then an assortment of custom R 979 functions were used to process the fiber-photometry signals. The decay in signal throughout the 980 session for the 405 and 465 channels were corrected by fitting and subtracting a 3 rd degree polynomial 981 to each raw signal. We then normalized the signals by computing z-scores using the mean and 982 standard deviation of the entire session. Using the onset of each access period, we created perievent 983 time histograms with time relative to access onset and then resampled signals to 20 samples per 984 second. We used the 405 signal to assess movement artifacts but did not observe any abrupt changes 985 in fluorescence that typically indicate such artifacts (Figure 8-Figure Supplement 5 removed and post-fixed for an additional 24h, and then brains were transferred to 30% sucrose until 997 they sank. Brains were frozen at -20°C and sectioned at 40 µm on a cryostat (Leica). Every other brain 998 section was collected in 1x PBS and then mounted on a glass slide. Slides were cover-slipped using 999 the mounting medium Fluoroshield with DAPI for visualizing cell nuclei. Sections that contained the 1000 bottom of the optic fiber were imaged with epifluorescence at 5x magnification (Zeiss, ApoTome2; Zen mouse brain histology atlas (Paxinos and Franklin, 2001). The position of fibers was overlaid onto a 1003 vector image of the corresponding atlas section using Illustrator (Adobe). 1004

Statistical Analysis and Visualization 1005
All raw data and analysis scripts utilized for this manuscript are freely accessible through our 1006 corresponding public repository (10.5281/zenodo.8015631). Details for all statistical results presented 1007 in the paper can be found in the stats table included with this manuscript (Source data 1). Data with 1008 repeated measures design were analyzed using a repeated measure analysis of variance (RM ANOVA) 1009 using the afex package (0.28.1) in R. We computed post hoc comparisons using Tukey's Honest 1010 Significant Difference (HSD) using the emmeans package (1.6.0) in R. Results with two variables were 1011 analyzed using a two-sided unpaired or paired t-tests using base R. Correlations were computed using 1012 Pearson's product moment correlation coefficient using base R. For all statistics, significance was set at 1013 P values less than 0.05. 1014 Data was visualized using the ggplot2 (3.3.3) package in R. Combined plots were assembled 1015 using patchwork (1.1.1). Color scales were produced using pals (1.7) or viridis (0.6.2). 3D renderings of 1016 the head-fixed hardware were produced using Fusion 360 (Autodesk). Plot components were 1017 assembled and further edited using Illustrator (Adobe). 1018    Figure 2N).  Product-Moment Correlation, multi-sucrose r=-0.14, p=0.14, multi-quinine r=-0.11, p=0.48, multi-NaCl 1495 r=0.23, p=0.15). 1496 J) the lick count on the previous session (Pearson's Product-Moment Correlation, multi-sucrose r=0.55, 1497 ***p=1.7e-8, multi-quinine r=0.54, **p=1.3e-3, multi-NaCl r=0.29, p=0.10).