I'm turning on a solenoid in a car transmission with a p-channel mosfet. The solenoid draws around 2A, although I'm designing the whole project to handle around 8A just to be safe.
I need to detect when the solenoid is on. It'll have a 12v input. (well automotive 12v. So anything between 9-16v) i have a 5.1V zener diode after the resistor.
Here's my question.... why do I need the second resistor going to ground?
Hi, the second resistor, 10K just a safe way of ensuring that 0V is 0V at the arduino when you turn the solenoid off, even though you will be pulling the 12V point to gnd through the solenoid coil.
The zener will not pull the input to gnd when the 12V goes to 0V.
Have you placed a protection diode across the solenoid to protect the control circuits?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?
The second resistor makes a voltage divider. Some of the current going through the upper resistor goes through the lower one. This is important because the zener can't deal with a lot of current, so if you can take some of the load off it, it's a good thing.
Yes, you can get zeners with higher current + power ratings but then their voltage isn't as exact. More current through the zener causes the voltage to rise up above the nominal voltage and low current through a high-power zener never gets to the nominal voltage. Because of this current limitation, a zener is not useful as a protection device. The real protection, which prevents the Arduino from getting toasted with more than 5v, is the voltage divider. The zener just lets you have a lot more variation of input voltage for a relatively constant output voltage.
This also applies in the 'forward' direction. When the solenoid is switched off, the voltage will 'ring' like a bell: positive and negative 20v. The negative voltage will cause the zener to see a 'forward' voltage and it will conduct like any other diode. This will limit the voltage at the input to the Arduino to a maximum of -0.9v (or whatever your zener's datasheet says is the forward voltage.) Once again, a zener can't cope with a lot of current so you really need a proper 'flywheel diode' on the solenoid+FET.
In this example, I would use a lower value zener: maybe 4.7v? It just has to be higher than the Arduino's HIGH threshold voltage, plus a bit of margin. Choose the resistors in the voltage divider to reach this voltage at the lowest expected battery voltage. The zener will only conduct if the input voltage is higher than this. Make sure your resistor power ratings will handle the power going through them. Then check the power dissipated by the zener when at the maximum battery voltage.
MorganS:
Make sure your resistor power ratings will handle the power going through them. Then check the power dissipated by the Zener when at the maximum battery voltage.
I suspect the 47k and 39k (10k is wrong) resistors will be quite all right at 14V. (About 2 mW total dissipation.)
Because of this current limitation, a zener is not useful as a protection device.
A zener is a very useful protection device but for the right sort of thing. Zeners work best at clipping very high short input voltage spikes, they are not so good for the continuous, just over spec voltage levels.
You have to tailor your protection circuits to what you are protecting against.