I will preface this by saying that I am still learning about electronics, what all is available, and how it all works. I am working on a building a device for one of my PhD research projects, and I need some advice.
I need to run three 12VDC solenoid water valves, and I am considering adding an optional 12VDC bidirectional pump. I was originally planning to use TIP120 Darlington transistors to operate the solenoids based on a tutorial I found, but my breadboard is getting pretty full and there is no way to build an H bridge in the space left (there are a lot of components for this device, requiring 12V from a power supply on one rail, 5V from a buck transformer on the opposite rail, and 3.3V from the board through a contact strip). I'm planning to use a Arduino Mega 2560.
I am considering switching from TIP120s to a ULN2004A Darlington transistor array. However, I can't find any tutorials to learn how to properly use one, so I am going off of the knowledge that I have built so far, but I am left with a few questions.
Looking at the schematics for each of the drivers in the ULN2004A, it looks like each of the Darlington transistors in the array are essentially the same as in the TIP120, but with an added 10.5 kΩ resistor on the in line. The tutorial that I was using for the TIP120s said that I should use a 1 kΩ resistor on the base in from the Arduino signal. Since the ULN2004A has the added 10.5 kΩ resistor in series, do I still need a base resistor?
I also see that there is a diode added on each of the drivers between the ground/earth and the in. In the TIP120 tutorial, there is a snubber diode between the live and ground for the motor. Is it still necessary to add a snubber diode to the motor, or is the one in the ULN2004A sufficient?
The tutorial that I read said to put the Darlington transistor in a lower power stitching configuration (i.e., interrupt the ground from the motor). I assume that is the same for the ULN2004A microcontroller?
With running three solenoid valves, that leaves me with four drivers that I could use to build an H bridge to run a gear pump (12VDC ≤250 mA, potentially 80 mA). Two of the drivers in the ULN2004A would be used for the power, and likely two TIP120s added for the grounds. Is this a good idea?
I imagine that I am likely going to blow a few of the microcontrollers. Unfortunately, my local electronics store doesn't seem to carry them, so I am having to order them in (likely from Digi-Key). Since it's going to be a nuisance to have to order one in every time, I figure that I should order extras. Do you have any suggestions about how many I should be buying?
I suppose that another thing that I should consider is high side switching instead and using relays. I recently used a Releco C10-A10FX/DC12V relay on another Arduino project to run a 120 VAC water pump, and it worked well. I would need to find a suitable 5VDC relay though for this. Would this be a better option than a microcontroller?
Also, I know that breadboards are not for permanent use, so I am looking at either a perma-proto board or a custom PCB, possibly even a custom shield, once I have the design working.
This may be because you asked for "ULN2004A microcontrollers" which would have confused them.
No, the ULN2004A cannot be used to switch the 12V to the motor, only between the motor and ground.
If you are switching 12V, it would be better to use a 12V relay module. These can be controlled with the 5V signal from an Arduino but use the 12V supply to power the relay coil. A 5V relay would need to be powered from a 5V power supply. It's not good to use the Arduino 5V pin for this purpose since it puts a great strain on the Arduino's built-in regulator, especially if the Vin pin is connected to 12V. It could overheat and shut down or be damaged.
But relays are even more old and inefficient than Darlingtons.
Maybe something like TB6612FNG module. These are dual H-bridge modules which use MOSFET drivers that are much more efficient than older designs based on Darlingtons or BJTs (for example L298).
They are rated for 1.2A per channel which I think is enough for your valves and motor?
I have not been able to check this for TB6612FNG, but normally H-bridges can be used as 2 half-bridges, each controlling a valve. If so, each module could control 2 motors (in either direction) or 4 valves.
Well, first you would want to use the 2003 because it will work with 5V CMOS outputs the 2004 will not. However it won't do you any good anyway. If the valves draw 400mA you will exceed the power dissipation capability of the IC with just 2 valves connected i.e. you will burn it out.
Each breakout chip contains two full H-bridges (four half H-bridges). That means you can
drive four solenoids, two DC motors bi-directionally, or one stepper motor
Thanks for the suggestion! If I do add the motor, I need is to run at one speed in the one direction and a higher speed in the reverse direction. If it weren't for that, this layout would make things much simpler.
...you would want to use the 2003 because it will work with 5V CMOS outputs the 2004 will not.
It looks like I misread the data sheet. Thanks for catching this.
If the valves draw 400mA you will exceed the power dissipation capability of the IC with just 2 valves connected i.e. you will burn it out.
I would be operating only one valve at a time, and one would be shut off before the next one is opened (though it rapid succession), so that should be fine I think.
The L9110 looks good.
If you use it, you wont need the spare 2003 drivers so I would connect two of the 2003 drivers in parallel for each valve. The power dissipation will be less.