Electronic – arduino – Switching a solenoid between 2 different AC/DC adapters

arduinomicrocontrollersolenoid

I have build a circuit to turn a solenoid on and off with an Arduino (actually it's 10 solenoids, but that's not important right now), and now I would really like to make it possible to choose between 2 different AC/DC adapters because that would give me possibility to have 2 velocity levels that I can trigger from Max/msp. Of course I never want the positive side of the two different AC/DC adapters to connect, so I would have to make sure (in my Arduino code), that never happens.

Here's a rudely made schematic hopefully spreading some light on what I'm trying to achieve:

enter image description here

As the picture shows, I am unsure as where to connect the positive side of the solenoid. At first I thought this was easy to do, but I don't think connecting the positive side of the solenoid to each of the AC/DC adapters positive sides would work out, although I'm not sure.

NOTE: In the end I want to be able to control a minimum of 10 solenoids – each with the possibility to choose between 9 and 24V.

Best Answer

I'd consider doing it this way: -

enter image description here

There is a P channel FET used to switch either the 9V or the 24V. Note the extra 10k resistor (circled in red) in series with the FET gate - most FETs can have several volts on their gates but 24V is too much and so I've limited it to about 12V with the resistor.

Also circled in red are schottky diodes. These are protection but the one in series with the 24V output may not be needed and can be replaced with a short circuit. The one in series with the 9V is needed because when the 24V supply activates it doesn't want to be driving current into the 9V supply switch - the schottky diode prevents this by reverse biasing when 24V is present.

The "optional schottky" is to stop reverse currents into the top P channel FET should the 24V supply become disconnected whilst the 9V is activated. It is removable should you feel there are no circumstances that warrant this.

Controls are circled in blue (MCU #1 and #2) - the logic levels can be 3V3 or 5V. Also note the 1N4001 diode across the solenoid to prevent voltage spikes damaging the devices when the solenoid is switched off.

I've assumed that the max current thru the solenoid is 1A - if it is greater than this then maybe consider going for a more powerful diode than the 1N4001 but it should be OK providing you are not switching this circuit on and off rapidly and repeatedly.

I've not listed the P channels FET but use one that can handle the current of the load and is rated no-less than 30V. The schottky diodes also need to be rated with max reverse voltage greater than 30V and current rating should be as per the solenoid's requirements with a little headroom of course.

The down side of this circuit is that the 9V supply is realistically dropped to about 8.5V due to the lower schottky and should you decide the top schottky is required the 24V supply will be more like 23.5V

EDIT - here's a FET I'd consider using. It can easily switch the load and is rated at 30V and can even tolerate 25V on the gate (I'd still use the 10k resistor though): -

enter image description here