PDA

View Full Version : Trigger 12v Solenoid Valve from a PIC



koossa
- 20th March 2014, 15:33
I'm playing with PICs for a long time, but still a beginner.

I want to build a hobby project that must switch a 12v Solenoid Valve on and off from a PIC running on a single battery.
How would I do this without complicating the circuit?

HenrikOlsson
- 20th March 2014, 15:57
Hi,
The easiest way is to use a NPN transistor or a N-channel MOSFET and switch the lowside of the solenoid. Ie +12V -> Solenoid -> Switch -> GND.
Drive the transistor with an output of the PIC. Don't forget to put a diode in reverse across the solenoid to clamp the inductive kickback when it's turned off.

Google low side transistor switch and you should find plenty of information.

/Henrik.

koossa
- 20th March 2014, 16:12
Thank you Henrik!!!
Will the PIC then also be able to run on the 12V?

HenrikOlsson
- 20th March 2014, 16:32
No, not directly on 12V it won't.
You'll need a voltage regulator to bring down the battery voltage to a range that the PIC can operate on, what that range is is stated in the datasheet but usually 2.5V to 5V.

/Henrik.

koossa
- 20th March 2014, 17:03
will a 7805 do?

andywpg
- 20th March 2014, 23:33
will a 7805 do?

It certainly will, as long as your PIC is designed for 5V

koossa
- 21st March 2014, 05:42
Thank you very much for your help!!!