So i have 24V going into the barrel jack of the R4 and I am measuring an inductive position sensor. The sensor and arduino are both getting 24V. I have a 3pin M8 connector bringing power in and broke that out to the arduino and sensor so the sensor power isnt going through the arduino.
Using a moving average and correction factor, I got within .001" even with HVAC turning on/off. Then it drifted and I unplugged my sensor and plugged it back in. This ended up killing the input so i grabbed my oscope and attached just the sensor and set the trigger to single shot- rising. The sensors output is 0.5-4.5 VDC when it stabilizes but I see 22.7 VDC MAX peak for 15ms on every startup.
I am planning on using a DC/DC converter to drop the input voltage to 12 (ADC would see ~10.7) or maybe even 8V (Need ~3V over the sensors Full Scale Output) to lessen the spike and so Im not at the top end for the arduino (6 -24 VDC, Seem to remember 40V but its not heatsinked). I'm thinking the regulators (Sensor and Arduino) wouldnt need to work as hard resulting in less heat (and maybe my drift issue lessens or disappears)
Even at 8 VDC, i see 6.7 VDC for 15ms before it stabilizes.
I did some reading last night and found some posts that pointed me towards a Zener or Schottky diode. It's the first time I have to worry myself with protecting the ADC and it seems like there are multiple ways to achieve this but I don't know how to go about it.
A series resistor between the sensor's output and the ADC's input and a Schottky diode with anode to the ADC input and cathode to the controller's Vcc should take care of this. The resistor's value can be something like 1k.
In fact, the diode is kind of redundant because the ADC will generally have an internal clamping diode to Vcc anyway, but a Schottky diode is often used anyway - I guess because of their fast switching behavior and to just not rely on an internal protection mechanism which is generally your last line of defense anyway.
Will your sensor still work if powered by a lower voltage that's within the limits of the microcontroller? If so, it would be inherently safe to power it at that level instead and you'd avoid this problem altogether.
Sensor needs 8-30 VDC but outputs a 0.5 - 4.5 Signal (actually more like ~.3 to ~4.8 since there is pre and over travel where it still responds but may not be linear.) I know that a linear potentiometer wouldn't give me this headache but it has to be this inductive sensor because of packaging.
Oh shucks. Well, your sensor can be made to work fine; it's just a little badly behaved. In @DVDdoug 's link my go-to solution is usually No.2 since I'm not all too fond of low-voltage zeners (they're not very precise much of the time) and it's easier to keep general purpose Schottky diodes on stock anyway. I generally use a BAT54 for this.
Any of your resistors should work. The rating doesn't matter; they won't dissipate any significant power and they're not facing any voltages of particular concern.
I appreciate everyone. I ordered some parts. The diodes were cheap enough I got some of each that way I can play around and also have them for my future projects.
I just thought of something that I left out, I have a 10k pulldown resistor so my input isnt floating and goes out of range in the event of a disconnect, broken cable, .etc.
Be aware that a resistor in series with the Analog Input will cause the RC-time for the sample/hold capacitor to increase. This is a problem when switching from one Analog Input to another. A trick often used is using analogRead(pin) twice. This adds more than 100 μs settling time.
The ESD diodes are there for ESD protection NOT for suppressing repeated over voltage transients.
It's very poor design practice to rely on them for any other purpose.
The reason for the 27k is to limit current through the input pin's ESD protection diode (1 mA), if the Arduino were unpowered and 24V applied to the input, the 27K resistor would limit diode current to 23.4V / 27k = 0.87mA. A 100nF capacitor from pin to GND would mitigate the effect of higher impedance.
I would use a resistor connected to the processor pin maybe 50K depending on the processor and response speed required. I have used it for projects in over 1 million units. Just be sure the processor supply will not rise with it. You may have to add a LED or something.
In normal operation the 4809 consumes up to 10mA, in power down mode possibly less than 1μA.
If a current up to 1mA is injected at an input, and not used by the controller, the excess will flow out of Vcc (not meant to do that, but there’s nothing to block it) and into the onboard green power LED.
If there’s no power supply, Vcc will rise to above the forward voltage of that LED and may or may not rise above the Power Up level, in the latter case the controller will start to consume power, trying to RESET and possibly start running thus applying a significant load to the source connected to the input pin.