Almost finished! While prototyping, I swapped out the liquid reward delivery system (a solenoid gating the flow between a lick spout and a reservoir) for a test LED that ran at the same voltage. But, as any student of electronics knows, voltage is not the only thing that matters.
In the final testing stage, I replaced the LED with the real part. Now, I got very erratic Arduino behavior while deploying the solenoid (eg to prime the liquid delivery tubing and make sure the liquid was continuous without air bubbles).
At first, I thought my power supply was not sufficient to run both the Arduino and the solenoid at the same time (they are both drawing from the same 12V, 625mA supply). However, swapping for another wall wart or running the Arduino from the USB connection resulted in the same issues (of course, the grounds were always tied together). Besides that, the solenoid I’m using is only rated for 1 watt, translating to a measly 83mA at 12V. After some googling, it turns out that sudden power demands may spike or drop the voltage, and so one potential answer is to add a capacitor to minimize that disruption in power. Because I’m only using one solenoid, I tried inserting a 220uF capacitor between the positive and negative leads of the solenoid (had I many other such components, it might make more sense to put the capacitor closer to the power supply).
Capacitor in place, no more erratic behavior! The capacitor acts as an extra reserve of charge, so when the solenoid is activated, it uses both the stored charge and the power supply, resulting in no (or at least less) voltage drop.