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?
Printable View
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?
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.
Thank you Henrik!!!
Will the PIC then also be able to run on the 12V?
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.
will a 7805 do?
Thank you very much for your help!!!