I'm going to be using my Arduino to do some high speed datalogging of cam and crank sensors and fuel injector signals but I'm new to electronics so I need a little bit of guidance.
I'm guessing that the fuel injector signals will be positive but the cam and crank signals are VR sensors so I'll see a positive spike followed buy a negative spike. I'm not sure what would happen but I know that the Arduino isn't a fan of negative voltages so I need some way of clipping the voltage. Is there a way to do this electronically? I've seen diodes mentioned but I don't really know which one to get or how they really work. Someone at work suggested an op-amp.
A diode wired "backwards" from the input to ground won't affect positive voltages, but will send negative current to ground, effectively "shorting-out" the negative voltage. (A regular silicon diode doesn't start conducting 'till there is about 0.5 - 0.7 volts across it, so you'll get about 1/2 Volt negative into the Arduino. But, less than ~1V negative won't hurt the Arduino .)
If you get any positive spikes greater than 5V, another diode wired "backwards" from the input to +5V will start conducting if the input goes above about +5.5V, diverting the current into the 5V supply and protecting the Arduino from excessive positive voltage.
A resistor (maybe 1k) in series, before the diodes, will limit current into the diodes. So, you can use any-old diode (maybe a 1N4001) without worrying abnout burning-out the diodes.
If you need to measure/read analog voltages above +5V, then you won't want to clip the signal. You can use a voltage divider (2 resistors) to scale-down the voltage.
Protection diodes are a good idea whenever you are feeding-in a voltage from an outside source that you can't 100% control, or that you are not 100% sure of.
You might as well tell me if something I have wired up to a piezo disk making low power as a touch sensor would be alright for other not-high power alternating signals.
To each piezo lead (red and black) I have 1 diode 'pointing in' and 1 diode 'pointing out' just as a full wave rectifier would be.
Both of the diodes 'pointing in' are connected to ground. (my thought is when neg V is on a wire, current will be sucked from ground to the relative lower-than-zero-V of that side of the piezo)
Each of the diodes 'pointing out' go to a separate NPN transistor that currently because it's a piezo goes directly to the grid pin but with more V would require a resistor. Each NPN transistor is (at this time) fed to the collector 5V through 2200 ohms to limit current coming out. Each emitter is connected through 22k ohms to ground and each emitter is connected to a separate digital input.
My code measures how long each pin is HIGH as an analog of how hard the disk was touched/pressed. Also, if either pin is HIGH, the pin 13 led is lit until neither pin is HIGH.
So far it works. I get a printout on serial monitor showing me touch and release time, it's possible to touch slowly/lightly enough to not register a press and maybe a release but it sure ain't easy. OTOH, hard taps do generate bigger numbers every time.
But would that be a bad circuit to feed say MP3 earbud audio?
Because it's about alternating current and a possibly right or wrong way to sense it. And that -might- help you.
Piezo disks are like capacitors that charge and discharge when stressed and released. So press and current goes one way, release or press the other way and current goes the other way... makes alternating current, makes positive and negative voltage on the same wire. What works with that should work with other similar AC.
Instead of having -.7V to my sensor pins I have always +V or none. The negative is not only clipped but inverted and sensed on a different pin. It's only a shame I miss the wave between -.7V and +.7V.
Try it without the resistors, with 0.310V schottky diodes.
Many logic chips have input diodes wired just like that.
That's what provides the Input & Output Clamp current:
That circuit is not going to work. No clipping happenning. I just simmulated... a negative pulse at the analog pin... bye..bye Arduino chip... ]
Do you have any suggestions? What program are you using to simulate it?
I'm really really new to electronics so I really don't know what to do for this. I did some basic stuff back in undergrad but the extent of my work since then has really been limited to wiring up some turnkey NI DAQ systems, voltage dividers, and popping in voltage regulators to try and stabilize voltage sources.
That circuit is not going to work. No clipping happenning. I just simmulated... a negative pulse at the analog pin... bye..bye Arduino chip... ]
Yes, I could have told you that - the series resistor makes the diode completely useless as a protection device. The correct way is resistor (1k to 10k?) between the source and the input pin, diode directly from input pin to ground. Protection diodes have to short the signal - put 1k in series and it's irrelevant. Schottky diode is a good choice, low forward voltage.
FWIW, I worked on the same issues here a while ago. Grumpy Mikes protection circuit was a starting point for my specific application. I used iCircuit on the Mac quite successfully, but you don't have to pay for it - the free Falstad Java-based circuit simulator can do the same thing, though not quite as conveniently. I have yet to try out the circuit in anger but the simulation suggests that the protection diodes inside the Atmel will never need to fire even with a 2x over-nominal potential on the input side.
You don't need to add any protection diodes, PROVIDED THAT you limit the maximum current when the input is above 5v or below 0v to a few hundred microamps or less. This is because the Arduino inputs already have protection diodes. For example, a 47K series resistor will protect against inputs up to about +25v and down to -25v.
If you need to use a lower series resistance for whatever reason, then use Schottky protection diodes to +5v and ground. They need to be Schottky so that they conduct before the Arduino's own protection diodes do.