Controlling a Solenoid with an Arduino (the saga continues)

I made the circuit shown in the attachment to control a 4.5v solenoid with an Arduino Uno. I could not get it to work until I pulled R1 out of the circuit. I started with a 330ohm resistor and it didn't work. I dropped down to 100ohm and could hear the solenoid trying to work. When I removed the resistor (R1) completely the circuit worked fine.

I am still not getting the fast power that I want out of the solenoid. When I switch the solenoid with a push-button switch I really snaps.

I have some N-Channel Mosfet transistors on order. I hope they will switch better than the 2N2222 transistor, but I am wondering what people think of why this only worked for me after removing the resistor and is it bad not to have that resistor protecting the circut.

Thank you in advance for your thoughts.

NPNMot-2.png

NPNMot-2.png

Please confirm the resistor values with your Ohmmeter.
Paul

I hope you ordered Avalanche or UIS rated MOSFETs, then you will only need a gate resistor in the 50 Ohm range. It sounds like your solenoid pulls more then the 2N222 can supply. The schematic made it easy, thanks.

Have you collector and emitter connected right? When swapped the current amplification is near 1.

With the 470 Ohm resistor the transistor should switch 500mA easily.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
https://forum.arduino.cc/index.php?topic=712198.0

Why are you powering the 4V5 solenoid with 24V?
What is your 24V supply?

Do you have a DMM?
If so can you measure:
The voltage between the emitter and collector of the 2N2222 please, without base drive and then with base drive.
The voltage between the emitter and base of the 2N2222 please, without base drive and then with base drive.

Are you sure you have the 2N2222 pins configured correctly, double check the data sheets.
Make sure your BJT is 2N2222 and not a PN2222.

Can you post a link to data/specs of your solenoid?
Can you please post your code that you are testing the solenoid action with please?

Can you please post a picture of your project?

Thanks.. Tom.. :slight_smile:

define "solenoid". when i hear solenoid, i picture in my mind an air/water/etc valve, but perhaps its a relay, door lock, etc?

if its something like a valve, door lock, or other high power solenoid, why not use a relay with the appropriate driving circuit?

maybe like [This?](Guide for Relay Module with Arduino | Random Nerd Tutorials connections between the relay module and the,to connect it) 4 VCC%3A goes to 5V)

if its a relay, or other low power solenoid then perhaps your existing circuit should work?

maybe use a circuit such as shown Here?

fil66:
When I removed the resistor (R1) completely the circuit worked fine.

So you are happily, grossly overloading the UNO output pin. What a good idea!
:roll_eyes:

In this case it is much easier to use a mosfet, which can directly replace the transistor. then change the 470r for 4K7, and add 100K from source (GND) to gate).

But I think a relay is a much better solution.

The point here is that using a relay does might not seem as elegant as an electronic switch, but when activating solenoids a relay is being used for precisely the purpose for which it is intended. Cheap, reliable and capable of handing the horrid currents and flyback voltages of solenoids.

Think about replacing the solenoid in your diagram with a relay (and using a cheapo mosfet). And then switch the solenoid with the relay.
As I say, this is precisely the designed function of a relay.

So,
As far as I can see the following sequence of events is possible:.

  1. 4.5V coil 24V supply => Activate the transistor and blow it up => Transistor dead (B-C junction alive, B-E junction dead).
  2. Then if Arduino output is high => no current can enter the Arduino.
  3. If Arduino output is low: all current goes through the transistor (C->B) and through the Arduino to GND.
    For sure this is not healthy for the processor.
    This would explain why a resistor in the B-Circuit spoils the fun.
    Best Regards,
    Johi.

bezelsanddisplays:
In this case it is much easier to use a mosfet, which can directly replace the transistor. then change the 470r for 4K7, and add 100K from source (GND) to gate).

What is the purpose of the 100K?

What is the solenoid's resistance (Ohms)? What voltage is connected to the coil? Some xN2222s have a reversed pinout (C-B-E instead of E-B-C). Make sure yours is correct.

Hi,
Can you please post a picture of your project so we can see your component layout?

Tom.... :slight_smile:

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