I'm currently working on automating a watering system for a population of about 40 lab mice. I'm looking at using an Arduino Mega to control small pumps that correspond to a water line for each mouse enclosure. I was originally thinking of using a bunch of relays to activate the pumps when the mice need water, but now I'm thinking that I could use transistors to achieve the same effect. Relays seemed a little overkill.

Currently I'm thinking of using these pumps (the mice are water deprived and drink very little at one time).

  • \$\begingroup\$ Is the Arduino able to drive a relay directly, or would you need to use an external transistor in addition to the relay if you went that route? \$\endgroup\$
    – The Photon
    Commented Sep 21, 2023 at 4:53
  • \$\begingroup\$ Is this something that can't be bought? Or at least not hacked together from hobby grade electronics? Is this even approved by some standards? Sounds like a simple bug in code or glitch in electronics results into restarting an expensive experiment by buying a new lot of lab mice. \$\endgroup\$
    – Justme
    Commented Sep 21, 2023 at 5:21
  • \$\begingroup\$ Run the arduino at 5V so you can switch mosfets directly from MCU pins. The mosfets will drive the pumps without relay. Do not forget to use diode across pump to clamp spikes from motor. \$\endgroup\$ Commented Sep 21, 2023 at 6:30
  • \$\begingroup\$ Please note that equipment that may harm animals if malfunctioning nowadays counts as safety-related. Meaning that you cannot use an Arduino or similar hobbyist board found in some packet of corn flakes. In case this system malfunctions because of poor engineering and a mouse gets dehydrated, then there are severe legal consequences. You need to be able to demonstrate that best practices in safety-related design was used. \$\endgroup\$
    – Lundin
    Commented Sep 21, 2023 at 6:54
  • 1
    \$\begingroup\$ either I misread it, or Michael corrected it afterwards (it was edited, but I don't know how to check edit history). Anyway, my previous comment is now pointless, so I will delete it \$\endgroup\$
    – Sandro
    Commented Sep 21, 2023 at 15:08

3 Answers 3


You can use either one : both will do the job. So choose whichever suits you best.

If you use relays :

  • you will need a small transistor to power the coil of the relay anyway (nb : if you want to go the "hobby way", there are "arduino relay" PCBs which already include the transistor, but at 40 of them, the risk of bad contact starts to increase if you don't do proper cabling)
  • less likely to be destroyed if you put your fingers on the relay without antistatic protection (but the transistor is still sensible)
  • bigger
  • I would adwice you add a freewheeling diode across both the coil and the motor, to reduce the risk of damaging the transistor and the contacts (the second one being less likely for such small load)

Using transistors (I would suggest logic level N-MOS, but a NPN bipolar can also do the job) :

  • more compact
  • cheaper
  • I would strongly advice a freewheeling diode across the motor to protect the transistor
  • a resistor between gate and arduino pin will avoid big switching currents in the arduino pin
  • a resistor between gate and ground will make sure the motors are off if arduino is unpowered (up to you if you need it)
  • mosfets are somewhat sensible to electrostatic discharges : don't touch anything without antistatic protection
  • if you fear about someone touching the wires/motors, considere adding anti ESD diodes (TVS) on the output of the mosfets

So globally, in your place :

  • if I had (nearly) no electronics/soldering skills, and wanted to do all with hobbyist modules, then buy Arduino relay modules and be done with it
  • if you expect people to touch your instalation without any protection against ESD, then relays might be more robust
  • if you plan to do your own little PCB (either real PCB or striboard/veroboard), then I would use N-MOS transistors

From an electronics viewpoint, of course it's perfectly possible to drive your pumps with transistors or relays; and of course the relays are likely to need a transistor to drive them.

From a scientific experiment point of view, consider the following:

  • How easy is it to determine the system is working correctly?
  • Which of your team can do this work?
  • How much time/effort is this portion of your research worth?
  • What happens if you have a system failure? (repeat experiment?)
  • Are field failures easy to detect?

Taking those into account:

  • Consider using high-reputation suppliers with modular interfacing, such Mikroe Click and Digilen PMOD. Mikroe for example has 4-relay and 16-relay cards with all the interfacing already done, which might save you an enormous amount of wiring. (As do many other manufacturers, good and bad.)
  • Consider redundancy: would it make sense to have two systems to switch the pumps on?
  • Consider feedback: is there any way to detect that a pump has operated?
  • Consider logging: if you're driving this with an Arduino, what is doing the logging?
  • Consider testing: are there buttons you can easily press to manually drive a pump (for testing the pump, relay, etc). Are there LEDs so you can easily see which pump is supposed to be activated?

This sort of manufacturer provides good circuit diagrams, good repeatability etc. If you get economy products or hobby items you may well have a source of poor repeatability. And you may well find the product ranges and approach are helpful for other or future automation that you might have.

This even before you get to software, which is of course the usual cause of field failures. For reliability and reproducibility, I recommend microcontrollers with gcc-avr or similar. This gives you good makefile-type documentation and eliminates GUI compilation, a notorious source of variation; of course at the price of additional learning curve if you're not familiar with it.

  • \$\begingroup\$ And worse if you don't write up the documentation then all of your future lab mates will pester you on fixing it or training people how to use it. And when you leave, it's going into the trash in about 30 ns. \$\endgroup\$
    – D Duck
    Commented Sep 21, 2023 at 19:44
  • \$\begingroup\$ For this kind of reason, I sometimes put all source and doc on a memory stick and bolt it to the device, so that future workers can find it. \$\endgroup\$
    – jonathanjo
    Commented Sep 22, 2023 at 7:45

Given the specific application of automating a watering system for lab mice and considering the details of the "LPM Series Fixed Volume Dispense Pumps" you're planning to use, here's a comparison of relays and transistors as switching mechanisms:

  1. Isolation:

    • Relay: Offers inherent electrical isolation between the control (Arduino Mega) and the pump.
    • Transistor: Requires additional components like optocouplers to achieve similar isolation, complicating the design.
  2. Power Consumption and Dissipation:

    • Relay: Consumes a static current (around 30mA - 100mA for PCB relays) for activation, irrespective of the load.
    • Transistor: With the pump's low power consumption (as low as 1.5W), transistors would be more efficient as the dissipated power would be minimal.
  3. Response Time:

    • Relay: Has a slower response due to its mechanical nature. There's a slight delay from when the relay is activated to when the contacts close.
    • Transistor: Nearly instantaneous response, ensuring immediate switching action when triggered.
  4. Complexity of Control:

    • Relay: Typically requires a driver circuit when controlled by a low-power microcontroller like the Arduino, to handle the relay's coil current.
    • Transistor: Can be directly driven by microcontrollers like the Arduino Mega, especially when using logic-level gate threshold MOSFETs.
  5. AC/DC Load Handling:

    • Relay: Can handle both AC and DC loads without modification. Depending on the relay's specifications, there will typically be different current and voltage ratings for AC and DC loads. When choosing a relay, it's important to ensure that its ratings match the type of load you're controlling.
    • Transistor: Primarily designed for DC load switching. If you need to control an AC load, a bipolar junction transistor (BJT) or a field-effect transistor (MOSFET) would not be suitable. Instead, you'd typically use a TRIAC (Triode for Alternating Current) or an optoisolator with a built-in TRIAC output for AC load control. TRIACs are specifically designed for controlling AC loads and can be triggered by a low-power DC signal, making them ideal for interfacing with microcontrollers.
  6. Electromotive Force (EMF):

    • Relay: Can produce a significant EMF when switched. A flyback diode is mandatory.
    • Transistor: Given the solenoid nature of the pump, a flyback diode is also recommended for transistor switching.
  7. Electromagnetic Interference (EMI):

    • Relay: Generates EMI which might glitch out sensitive lab equipment or even the Arduino's operation.
    • Transistor: Produces less EMI. High-frequency switching can, however, introduce electrical noise.
  8. Lifespan:

    • Relay: Mechanical contacts degrade over time.
    • Transistor: Generally more durable, especially if it's properly rated and protected against voltage/current spikes.
  9. Audible Noise:

    • Relay: Produces a clicking sound which might not be ideal for a lab setting with mice as it might disturb them.
    • Transistor: Typically operates silently. However, for extremely high-frequency switching even if that's above the human audible range, there's a potential for it to disturb the mice if it's in close proximity and sufficiently loud for the mice.
  10. Size:

    • Relay: Can be bulkier.
    • Transistor: More compact, especially when considering SMD variants.
  11. Cost:

    • Relay: Typically pricier than transistors.
    • Transistor: More cost-effective, though additional components might slightly raise the price.
  12. Heat Generation:

    • Relay: Typically generates minimal heat during operation. However, frequent switching can produce sparks, which might lead to additional heat generation.
    • Transistor: Can produce heat, especially under high current loads. May require heat sinks or other cooling methods, adding to the design complexity.
  13. Switching Frequency:

    • Relay: Limited primarily due to its mechanical nature, wear and tear of the contacts, and the potential for contact welding. Not a significant concern if you're just intermittently supplying water.
    • Transistor: Suitable if there's any requirement for rapid or frequent switching.
  14. Fail Mode:

    • Relay: Can fail open or closed. If the contacts are weld together, a relay can stay permanently closed. Make sure you take this seriously, as a permanently on pump might put the mice at risk of drowning.
    • Transistor: Typically fails closed, meaning it could remain in a conductive state, similar to a relay.

Given the provided pump details and the desired application, transistors seem more appropriate to me. They offer silent and efficient operation, are more compact, and align well with the low power consumption of the pumps.

Remember to choose a transistor that can handle the pump's current and voltage, and integrate a flyback diode to protect against voltage spikes due to the solenoid-driven nature of the pump.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.