I was trying to make an exhaust valve for my car controlled by an arduino. As a way of measuring when the valve was fully open or fully closed i used a resistor in front of the valve with an analog input in front of the resistor and one behind the resistor. That way the arduino can see the voltage drop when the valve gets 'stuck'. the problem with this setup is that I have 12V input going to 2 of the analog inputs. (I blew an arduino up already).
Is there a way to step down this voltage without compromising this edge detection?
Use a voltage divider.
use 100K for R1 and 27K for R2. With 12V input, the Vout will be 2.55V. you can connect up to 24V to the Vin. Connect the Vout to any analog pin for measurement.
If you want to recalculate the values you can use this Voltage divider calculator
It will scale down the voltage so that it can be safely measured using the Arduino. Then use the appropriate code to recalculate the actual voltage. for eg.
value = analogRead(A0);
voltage = value * (5.0/1023) * ((R1 + R2)/R2);
replace R1 and R2 with the actual resistance values.
Using the voltage divider would be the best. To be safe add a 10K resistor between the analog port and the junction of R1 and R2. Be careful, A car voltage can go up to 24V with a double battery jump and reverse if connected backwards. 12V is not the car's voltage if the electrical system is working properly, It is in the range of 13.8V allowing the battery to charge. You might look at the AEC 100 specifications. When you calibrate it you can adjust the math to reflect the values you receive but a known voltage source is needed.