Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Best setup for 12v solenoid  (Read 1437 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to figure the safest way to have the arduino activate a 12v solenoid. I've done a lot of reading up before posting, just had a few questions.

1) Two separate power supplies are needed, a 12v one for the solenoid, and the arduino one. I don't want to use the 12v for the arduino because the vreg will get very hot.

2) I will need to tie the grounds together. I heard this can lead to issues like backfeeding through the mcu pins and possibly damaging it. I tested with my multimeter and the potential across the two - for both supplies was around 48v AC. Apparently this kind of measurement is normal from what I read, it's just a matter of bringing grounds to the same potential.

3) It seems a mosfet is the best way of switching the 12v side. I don't know if this would protect the mcu pins well though. Using a relay instead of a mosfet still gives problems with current usage of the coil along with needing another diode, (The other one being across the solenoid) so it makes sense to go with a mosfet instead.

4) Optoisolating the 5v and 12v sides might be a solution, but is it necessary? Is there a decent optoislation chip anywhere? There was one on sparkfun but it was limited to 50ma, not sure if that would be enough for switching the mosfet? I saw this solution here: http://playground.arduino.cc/Learning/SolenoidTutorial
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17320
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think using a 'logic level' N-channel power MOSFET as a low side switch is the best solution overall. As long as you have a diode across the solenoid coil terminals you shouldn't risk any damage to the arduino just because you have the 12vdc negative terminal wired to a arduino ground pin.

Lefty

Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it, so optoisolation isn't really necessary then. Is it that hard to set it up so a HIGH output on the pin correlates to the solenoid being activated? Seems a lot of setups have it so you need to set output on the pin to LOW to switch the solenoid on.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17320
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it, so optoisolation isn't really necessary then. Is it that hard to set it up so a HIGH output on the pin correlates to the solenoid being activated? Seems a lot of setups have it so you need to set output on the pin to LOW to switch the solenoid on.

If the mosfet is wired as a low side switch, then a HIGH from an arduino output pin wired to the gate of the mosfet will turn on the mosfet and allow 12vdc current to flow through the solenoid, through the mosfet drain/source terminals to ground, thus activating the solenoid.

Lefty
Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought so, but wanted to make sure. Thanks
Logged

United Kingdom
Online Online
Tesla Member
***
Karma: 228
Posts: 6644
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1) Two separate power supplies are needed, a 12v one for the solenoid, and the arduino one. I don't want to use the 12v for the arduino because the vreg will get very hot.

No, you can use a single power supply. The regulator will not get hot unless you draw a lot of current from the +5V pin of the Arduino - in which case, either use 2 supplies or use a 5V switching regulator to derive 5V from the 12V supply.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, my previous experiences with running 12v to the barrel connection was the vreg got really hot, even when only powering a couple LEDs limited to ~5ma each. I will attempt it again though to see if I have better luck this time. If not, I'll use two supplies. I don't have a 5v switching regulator around, that would be the ideal solution to bypass the vreg entirely, though I'm not sure if that would introduce em noise problems.
Logged

United Kingdom
Online Online
Tesla Member
***
Karma: 228
Posts: 6644
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If it was a 12V unregulated power supply, then it may have been supplying much more than 12V when lightly loaded, and that would increase the power dissipation in the regulator.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yea, I will have to test it again once I get the fet and solenoid. If it gets too hot I'll just use two supplies, or maybe find a way to heatsink the vreg.
Logged

United Kingdom
Online Online
Tesla Member
***
Karma: 228
Posts: 6644
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yea, I will have to test it again once I get the fet and solenoid. If it gets too hot I'll just use two supplies, or maybe find a way to heatsink the vreg.

or you could use an external 7805 regulator with a small heatsink.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My tests so far with a 12v supply have led to no problems with the vreg even getting warm. It must have been the LCD screen's current draw causing the heatup on a previous project where I attempted to use a 12V supply.

Anyway, I noticed when the power supply is disconnected and the board is only powered through usb, there is still ~50mv backfed through the barrel jack. I'm afraid if the pin switches the fet in this state, the solenoid will attempt to draw a lot of current from the 5v usb supply back through the barrel jack, which might burn something out in the board. Do I need to take this into account, or is there some kind of limiting in the arduino board which will prevent this?
« Last Edit: March 04, 2013, 12:30:48 am by MrGarak » Logged

United Kingdom
Online Online
Tesla Member
***
Karma: 228
Posts: 6644
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My tests so far with a 12v supply have led to no problems with the vreg even getting warm. It must have been the LCD screen's current draw causing the heatup on a previous project where I attempted to use a 12V supply.

Some LCD backlights need as much as 100mA, and drawing that amount of current from the 5V pin would certainly make the regulator hot.

Anyway, I noticed when the power supply is disconnected and the board is only powered through usb, there is still ~50mv backfed through the barrel jack. I'm afraid if the pin switches the fet in this state, the solenoid will attempt to draw a lot of current from the 5v usb supply back through the barrel jack, which might burn something out in the board. Do I need to take this into account, or is there some kind of limiting in the arduino board which will prevent this?

Don'r worry about it. There is a diode in series with the barrel jack, and your high-resistance meter is registering the leakage current through the diode, which is probably well under a microamp.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: