Trying to control a solenoid - power issues?

Hi Everyone,

I have created this circuit (pretty much exactly, except I'm using a 12v 2.5A DC powersource) as per the attached image

I have the code for testing its function as a 5 second delay, then setting pin 9 to high, 5 second delay, then set pin 9 to low.

It does appear to be working, but at a fraction of the magnetic power compared to when I plug the solenoid directly into the power supply.

are my wires too small? Do I need to wire this a different way?

A logic level MOSFET should be used to control the solenoid.

Use circuit B2 below:

1 Like

Hi,

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

What is the part number of your transistor?

Do you have a DMM? Digital MultiMeter?

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Hi Tom,

I do have a DMM.
I picked up a TIP32C transistor, as TIP120's are hard to find in my area.
This is my circuit drawing - I've labeled the rows along my breadboard:

Hi, @themrbrightside2000
Thanks for the diagram.

A TIP32 appears to be a PNP BJT.
You need a NPN BJT.

Tom... :grinning: :+1: :coffee: :australia:

Thanks Tom!

I'll give it a go when Jaycar opens up tomorrow.

Hi, @themrbrightside2000
Are you in Australia? :australia:

TIP31 would work.

Tom... :grinning: :+1: :coffee: :australia:

Do you actually have this circuit on a breadboard?  If so you may be losing voltage in the breadboard itself.

Do a web search on 'breadboard current capacity'.

Yeah, I'm in Canberra

The TIP31C worked - plenty of power coming through and the 3 pins of the transistor became so hot it melted the plastic around the breadboard.

Having said that, it wont turn off - I put the LED PIN on 13 to mark when it should go off and on.

This is my code:

const int SOL_PIN = 2; // the Arduino's input pin that connects to the solenoid

const int LED_PIN = 13;

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

// initialize the Arduino's pin as output

pinMode(SOL_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
}

void loop() {

// turn on

digitalWrite(SOL_PIN, HIGH);

digitalWrite(LED_PIN, HIGH);

delay(5000);

//turn off

digitalWrite(SOL_PIN, LOW);

digitalWrite(LED_PIN, LOW);

delay(5000);

}
1 Like

Does the LED pin go ON and OFF?

Tom.. :grinning: :+1: :coffee: :australia:

My guess is that your solenoid is drawing too high a current causing the NPN transistor to go short circuit.
Can you measure the resistance of your solenoid, or measure the current it draws when connected directly across the power supply?

Hi Tom,

The LED certainly does, 5 seconds on, 5 second off. The magnet's strength remains largely the same - do I need a stronger resistor?

Keeping in mind, I want to solenoid to release not on a timer but at a sudden break in a reed sensor or a light sensor, I would want it to be quite quick.

Hi,
Measure the voltage at the solenoid pin, pin 2, see if it is going high and low.
Measure the voltage at the TIP31 base, it should go 0.7V to 0V.

Can you please post some pictures of your project?
Make sure you have gnd of the UNO and gnd of the 12V supply connected.

Check if you remove the base resistor, leave the base open circuit, the solenoid should not activate, you still have the back EMF diode in circuit I hope.

That relay appears by the specs to pull 100mA.

Thanks.. Tom.... :grinning: :+1: :coffee: :australia:
PS. Can you please measure the resistance of the solenoid?

Hi @themrbrightside2000,

when you are visiting jaycar you might have a look at the uln2003 IC as well...

https://www.jaycar.com.au/uln2003-16-pin-darlington-transistor-array-ic/p/ZK8855

It is easy to implement and if not used here it might be of interest for further applications.

Good luck (and no worries :wink: )

Hi everyone,

Voltage at pin 2: when high - 5.14V, when low: 1.2V
Voltage at TIP31 base (pins 3 and 2): when high: 132mV, when low: 40mV)
Voltage at TIP31 base (pins 1 and 2): when high: 0.84V, when low: -180mV)
Voltage at TIP31 base (pins 3 and 1): when high: -0.7V, when low: 160mV)

Resistance of solenoid: 11.8 Ohms

I noticed that the Voltage on the TIP31 wasn't as sharp on/off as I thought it would be, but a gradual drop and rise - would that be the issue?

The yellow wire (pin 2) does not look like it is connected to the base resistor.


Your Arduino pin 2 will never turn the transistor OFF as the output goes from 0v to 5v and you are using a TIP32 PNP transistor.

You need to use a circuit such as below, resistors may need adjustment.

Suggest you use a Logic level MOSFET transistor.

Hi LarryD,

Do you have a recommendation for a Mofset?

It's also a TIP31 transistor, I switched it over from the TIP32

Pin 2 is connected to the solenoid, is it?
The other end of the solenoid is connected to 12V?
Check your wiring using this schematic;

Can you measure DC voltages at A, B, C, D and E with the neg probe of the DMM on the gnd line.
Measurements for pin 2 HIGH then LOW.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

1 Like

FYI