I'm building an EKG heart monitor, which is bipolar and has voltages that go slightly below 0V. I know that my Diecimila is unipolar and needs inputs between 0-5V and that inputting a negative voltage into the analog input pins could damage them.
My EKG circuit runs off a battery, so there's only a virtual ground in the circuit. I was thinking about using a voltage divider or a voltage regulator to input a slightly negative (-1.2V) voltage into the ground pin on the Arduino board. This way, my analog input pins will all be positive with respect to the ground pin.
I am a bit puzzled here. If you are running it of a single battery how do you get below 0V? If you are running it off two batteries then make the negative of the negative battery connected to the Arduino ground.
Thanks for the reply! I think that's what I was looking for. I think I'm just confusing myself because I'm working with batteries.
I have two batteries and a little circuit with an op-amp so that I have a fairly stable -9V, 0V and 9V reference. My signal is slightly negative with respect to my virtual ground, but I just wanted to be sure that plugging in "-1.2V" from my circuit to the arduino was okay. Sorry if I'm confusing!
but I just wanted to be sure that plugging in "-1.2V" from my circuit to the arduino was okay
In short this is not OK and it will damage the board. So either fit protection, ground the -ve battery (then you have 18V max potential so you will still need input protection from that) or add some biasing resistors to bring the output to zero volts.
As the input has the potential to go outside the Arduino's supply rails then you defiantly need a series resistor and catching diodes.
I brought the whole signal up above 0v by putting it through a capacitor into a voltage divider. When the person is still, it's fine, but occasionally the signal will still spike below 0V.
Could I just bias it with a single diode? Ideally, I'd like for any signal below 0V to clip and stay at 0V, but would -0.7V really damage the board? (I don't see an easy way to make the cut off 0V).
I don't think I understand the configuration Mike suggested with a series resistor and catching diode.
Sorry that I'm slow today : ( I've spent many, many hours in the lab this week!
I'd really like to know what is being damaged in the arduino when negative voltages are put into the analog pins. Is there any kind of tolerance?
Each I/O pin has internal clamping diodes that will conduct hard on if voltage exceeds Vcc or Vdd (ground). The spec allows only voltages to: "Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V"
There are methods where one can exceed these voltage limits if you have a series resistance that limits the current flow to a very few microamps but I don't think that is considered a good engineering practice.
That's basically what I was trying with the diodes, but I was worried since because they're not ideal, it would only short the signal to ground at -0.7V. But from what I understand now, it is the series resistor that reduces the current and makes this okay - is that correct?
Silly question now... Does 22R in that link mean 22ohms? Wouldn't that make the current coming out of the series resistor huge when my signal is up at 5V?
Silly question now... Does 22R in that link mean 22ohms? Wouldn't that make the current coming out of the series resistor huge when my signal is up at 5V?
No, OK at 5vdc, that would not forward bias the protection diode and no current would flow, however at 5.5vdc (actually at .5vdc above Vcc) or above then current would start to flow and 22 ohms would not be enough resistance to limit current to a safe value.
22 ohms would not be enough resistance to limit current to a safe value.
Well it depends on two things, the time it was above 5.6V and the current rating of the diodes. These values were designed for a system where the normal signal was not persistently above the limits like in an electrostatic discharge, or a spike or surge. The pulse current capacity of most rectifier diodes is in the order of 10s of amps.
You can make the resistor bigger but then you can begin to affect the normal operation of the input. For example it it was a TTL level input then anything much over 100R will stop the input seeing a logic zero and you begin to erode the noise margin.
For a system that you are going to put say 10V in all the time then you would be better adding a zener or feed the input through a transistor first.