Pages: [1]   Go Down
Author Topic: Clipping negative voltages  (Read 945 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 34
Posts: 1318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Like this?

Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know what you're talking about nor do I understand why you didn't make your own thread.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@MrDomino

That circuit is not going to work. No clipping happenning. I just simmulated... a negative pulse at the analog pin... bye..bye Arduino chip...  smiley-evil
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27114
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Input clamp current, IIK (VI < 0 or VI > VCC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ±20 mA
Output clamp current, IOK (VO < 0 or VO > VCC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ±20 mA
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@MrDomino

That circuit is not going to work. No clipping happenning. I just simmulated... a negative pulse at the analog pin... bye..bye Arduino chip...  smiley-evil

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.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4808
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How about the modified full wave recitifier? It hasn't hurt my UNO at all.. yet.. so far anyway.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

0
Offline Offline
Shannon Member
****
Karma: 207
Posts: 12200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@MrDomino

That circuit is not going to work. No clipping happenning. I just simmulated... a negative pulse at the analog pin... bye..bye Arduino chip...  smiley-evil

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.
Logged

[ I won't respond to messages, use the forum please ]

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.thebox.myzen.co.uk/Tutorial/Protection.html
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: