I am banging my head against the wall with this problem.
What I am trying to do should be very simple - just turn on/off a 12v solenoid with a transistor or MOSFET controlled by my arduino.
I have read at least 50 blog posts or forum threads on this subject, but just cannot find the solution.
My electronics experience - beginner.
I have tried numerous different transistors and MOSFETS, following advice found during my research, but to no avail.
My test circuit -
3 Blue LED with resistor.
12V adaptor supplying 2A current
Blink sketch with pin 13 running to appropriate pin on tran/mosfet
All lead positions treble checked and LED lighting up if supplied power direct.
Common ground between 12v supply and Arduino
Tested - TIP31, IRL8113PBF & some other transistors that I can't find at the moment (desk is a bit cluttered)
Transistor/MOSFET all N series and placed after the LED from the 12v supply
Circuit is like this but without the capicitor (and with various different components tried:
- 90% of the time with transistor/mosfet in position LED simply stay on at what looks to be half brightness, as if there is a power leak getting through the component. They do not Blink though.
- Nearly rest of time LED are either at full brightness (not blinking) or just do not light at all.
- I did get the test circuit to work with the TIP31. The LED flashed on and off as expected but again were at a much lower brightness than I thought they would be. I then switched in my solenoid (which again works when given power directly) which did not work at all.
I have spent a fair bit of money on different components now, all to no avail, and simply can't find the answer. All the problem threads I've read end with the initial poster having their problem resolved but the answers don't work for me.
So, does anyone have any ideas at all?
Even better, and for my eternal gratitude, could someone list the exact parts and circuit diagram I need to follow to get this to work? The solenoid I need to get to work is this one - http://www.ebay.co.uk/itm/251488508604?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
Many, many thanks indeed in advance.
Have a great day!
Hi, can you show us a picture of your project, so we can see your connections.
When using a MOSFET you will need to connect a 10K resistor between the gate and source, this will discharge the gate and turn the MOSFET off if it is left open circuit.
Your circuit is the same as this one and the one near the bottom here, except for that capacitor on yours.
I’m no guru, but I don’t recall seeing a cap on such circuits before… could that be the culprit?
With that 1K on the base of the TIP31, the base current will only be around 5mA. If the gain of the transistor is around 100, the collector current will only be around 500mA. Do you know what current is required to fire the solenoid? 500mA may not be enough.
You could try 330R on the base, that would give collector current of something like 1.5A.
Double check the pin out on each device - before powering up.
You should be aware that darlingtons in particular have large leakage currents when
off (due to the gain of 10000+ at low currents) which means a high brightness LED will
probably glow a bit when they should be off. Some LEDs only need a few tens of uA to glow
Normal BJTs have a smaller gain so the leakage should be much smaller, negligible
The best test load is one that requires the expected current level (perhaps 100mA),
such as an indicator bulb or power resistor, or even better the relay itself (with
free-wheel diode always). Leakage currents won't be anything like enough to operate
Make sure you aren't accidentally using the wrong circuit and that the emitter or
source are connected to ground, load to collector or drain.
The circuit given requires NPN or n-channel device.
From what i can understand from the first post. Here are some possibilities :
Pin 13 has a LED on board. Which causes drop. Hence try changing the pin?.
Maybe the transistor requires more base current to fully turn on. Try changing the base resistor value.
If you are sourcing the current from arduino pin (in this case) then you need to look how much current it can SOURCE from one pin.
I guess its 20mA. I maybe wrong.
I ran into a problem like this while using a ATtiny85. It couldn't source the amount of current needed to turn on the transistor. Had to change the logic. Had to Sink current.
If you have not solved this yet, try measuring the voltage from gate or base to ground.
With no signal in the voltage should be 0.
With a FET the gate on-voltage should be ~5V.
With a bipolar transistor the base on-voltage should be ~0.6V.
If you aren't getting required input voltage to the device it won't work right.
Firstly, talking nonsense. Referring to three blue LEDs and showing a circuit containing a solenoid and no LEDs. Clearly you are confused and need to sort things out in order to explain what you are actually doing - a common problem here.
Secondly, a "one post wonder".
Time to forget this post.
Obvious question. Did you declare the pin to be output in Setup() using: pinMode(yourpin,OUTPUT); ?
And don't use pins 0,1 or 13.
Hi when you use an LED in place of the solenoid, do you also have a series current limit resistor with the LED?