Need help wiring external power supply to Arduino project

Hi all, I'm trying to operate a 24V solenoid valve with an Arduino Mega, ultimately to control a pneumatic cylinder. Since my board obviously can't supply 24V, I'm using an external supply (two 12v batteries in series) to power the solenoid, while the Mega runs off a USB cable. Here's a rough schematic of how I plan on wiring everything together. Would this work out, or am I going to blow something up? Do I need to add some resistors?

Thank you for any advice! :slight_smile:

Wire the ground of the high current load right to the battery. Avoid running high current (>500mA) through a solderless breadboard.

What is the transistor? If a BJT (Bipolar Junction Transistor) a base resistor is required to limit base current.

If the transistor is NPN or N channelit should be between the load and ground. The load should be between the 12V and the collector of the transistor.

And, as shown below, any inductive load (coil, relay, solenoid) requires a flyback diode to protect the transistor from inductive kickback.

image

NPN BJT driving a solenoid.


N channel MOSFET driving a solenoid

1 Like

The drawing makes it look like a PNP transistor. That will damage, or destroy the controller. Use the suggestion from @groundFungus.

1 Like

Thanks for the feedback! I have a lot of different transistors to choose from in my school's tech shop, based on your schematics I think an NPN BJT would be best.

The solenoid is rated at 24V 3.0W, so about 0.125 amps... that should be fine with a breadboard? I'll make the needed adjustments to my circuit and then double check with my tech instructor before connecting the battery (I really don't want to hurt my new Mega board, haha). Thanks for your help!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.