Author Topic: ADC - Shunt resistor spikes  (Read 3177 times)

0 Members and 1 Guest are viewing this topic.

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
ADC - Shunt resistor spikes
« on: June 24, 2019, 12:00:35 pm »
Hello everyone



I try to measure current on DC motor using shunt resistor - 5V Atmega ADC.

I use 0.1 shunt resistor. On multimeter i have:
0,03V -> 0,3A - no load
0,1V -> 1A - on load
0,5V -> 5A - stall current
Everything looks OK.




But on a scope i see spikes with a higher voltage than i expected and multuimeter shows.



First circuit: Circuit 1



Spikes are above 10V but only for couples of microseconds.


Second circuit: Circuit 2


Spikes repeated less frequently. About 7,5V.
The diodes should limit voltage to 0.6.


Third circuit:Circuit 3


Like in second circuit.



Why is this happening? Is this dangerous to 5V Atmega? If so how to prevent it?

Thanks!
« Last Edit: June 24, 2019, 12:12:08 pm by nixie84 »
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 15156
  • Country: de
Re: ADC - Shunt resistor spikes
« Reply #1 on: June 24, 2019, 12:26:36 pm »
The mechanical contacts at the carbon brushes can cause current spikes, e.g. from some kind of make before brake action. The wire wound resistor used will have some parasitic inductance than can make current spikes look larger than they actually are.


Some 7.5 or 10 V spikes could cause trouble to the AVR.  Die Diodes are really effective only with some series resistance.  Ideally there would also be some resistance in front of the ADC input to limit current here if the voltage goes out of range.

Diodes parallel to a shunt are a known way to protect shunts, but it need strong diodes and may lead to some leakage currents that can be relevant for the smaller range.
 

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
Re: ADC - Shunt resistor spikes
« Reply #2 on: June 25, 2019, 12:36:45 pm »
Fourth circuit: Circuit 4

Something like that?




DIY 0,1 Ohm  bifilar resistor ;-)

Spikes appear less frequently but are still at a high level.
« Last Edit: June 25, 2019, 12:54:16 pm by nixie84 »
 

Offline ArthurWozniak

  • Newbie
  • Posts: 6
  • Country: br
Re: ADC - Shunt resistor spikes
« Reply #3 on: June 29, 2019, 01:01:57 am »
Hello,

Use some filters, as Snubber filters. They are good for smoothing those voltages spikes  ;D

Best regards,
 

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
Re: ADC - Shunt resistor spikes
« Reply #4 on: July 02, 2019, 12:24:01 pm »
I assembled the electronic circuit from the diagram.
It works probably ok.
The 2nd channel of the oscilloscope shows output. 1st channel show spikes on motor.

What are the other ways to solve this problem?
 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 4135
  • Country: 00
Re: ADC - Shunt resistor spikes
« Reply #5 on: July 03, 2019, 01:06:52 am »
that's normal behavior for inductive load with interrupted contact. And yes, it can be dangerous for your ADC. But you can use low pass filter in order to filter these pulses. Also add protection diodes. But, note - when voltage is near to diode open level, it will leads to distortions and in such way it will affect your measurement results. So, you're also needs for some voltage divider to keep voltage below the level of diode open.
« Last Edit: July 03, 2019, 01:09:23 am by radiolistener »
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: ADC - Shunt resistor spikes
« Reply #6 on: July 03, 2019, 01:18:42 am »
You will need a RC filter.
This will remove most of those high voltage spikes from getting to the ADC. Motors are very noisy with lots of high frequency crap and you're only interested in the slow current changes.
Adding a TVS diode would be a good idea as well.

Signal ------1k Resistor------------------------------------- to AVR INPUT
                                     |                      |
                                  10uF cap       5V TVS diode (optional)
                                     |                      |
GND-----------------------------------------------------------to AVR GND


This will smooth out all the spikes and get a nice slow changing DC signal you can measure with the AVR ADC.

First thing to decide is how fast do you want your AVR to sense the motor current at.
This will depend what you plan to do with the data, but if its just to see the current i would go with 15hz

To spec an RC filter for 15hz you can use many online calculators.
Try a 1k resistor and 10uF capacitor and see how that works.



« Last Edit: July 03, 2019, 01:31:50 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
Re: ADC - Shunt resistor spikes
« Reply #7 on: July 15, 2019, 10:02:03 am »
I have tested some circuits.
I noticed a strange thing. Not a single RC filter works.
Either it is interference from the air or im doing the measurement incorrectly.
Just add 10k resistor to the probe tip and then everything is OK.
How to explain it?
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: ADC - Shunt resistor spikes
« Reply #8 on: July 15, 2019, 11:18:07 am »
Just add 10k resistor to the probe tip and then everything is OK.

That proves the RC filters must be working.

Measuring noise spikes is always difficult. To measure the noise in the 0.1R the scope probe and GND should be as close as possible to the 0.1R's leads, as in your 1st post.
To measure the effect of the RC filter the scope probe and GND should be as close as possible to the 100nF's or 100R's leads in Working.png, the 100R in series with the 100n doesn't do anything useful there, it could just be linked/shorted out.
« Last Edit: July 15, 2019, 11:29:21 am by StillTrying »
.  That took much longer than I thought it would.
 

Offline hsn93

  • Regular Contributor
  • *
  • Posts: 114
  • Country: bh
Re: ADC - Shunt resistor spikes
« Reply #9 on: July 16, 2019, 01:42:46 pm »
I have tested some circuits.
I noticed a strange thing. Not a single RC filter works.
Either it is interference from the air or im doing the measurement incorrectly.
Just add 10k resistor to the probe tip and then everything is OK.
How to explain it?


hi,
would be very nice to have description or (photos from your oscilloscope instead of saying (working / not working / everything is OK). this is a great place where people communicate and its very nice to have a skill of describing the things and let others to be synchronized to the information on your mind from first comment / post.

-------------------------------------
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1327
  • Country: gb
    • bitdynamics
Re: ADC - Shunt resistor spikes
« Reply #10 on: July 16, 2019, 01:49:36 pm »
Also: Be careful with your Oscope ground clip!  You may be introducing unwanted current paths, depending on how your motor is driven and the power supply arranged! (and where the current shunt sits in the circuit).  The high frequency common mode rejection ratio of your Oscope won't be all that great, and by attaching your probing, you could be providing a nice AC (or DC...) path for high frequency currents from your motor and motor drive.
 

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
Re: ADC - Shunt resistor spikes
« Reply #11 on: July 16, 2019, 08:18:10 pm »
I put all circuits in post #7.
Oscillogram with and without spikes is in #4 post.
All others oscillograms looked similar, that's why i wrote it works or not.


I try to be careful. I have already seen:







I would like to go back to this circuit:


If there is only a resistor without a capacitor, how is the RC filter formed here?
I know that the probe has some capacity but very small.
With 1k resistor spikes appearing. With 10k or more all looks good. Why?
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 914
  • Country: fr
Re: ADC - Shunt resistor spikes
« Reply #12 on: July 17, 2019, 05:51:23 am »
Probes have their own capacity.rtfm first and work after, especially with things you can damage,like the scope...


Envoyé de mon iPad en utilisant Tapatalk
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: ADC - Shunt resistor spikes
« Reply #13 on: July 17, 2019, 12:23:44 pm »
If there is only a resistor without a capacitor, how is the RC filter formed here?
I know that the probe has some capacity but very small.
With 1k resistor spikes appearing. With 10k or more all looks good. Why?

The ringing in your scope shot is about 70MHz, the scope probe's ~17pF is only about 200R at that frequency so the 10k in series with the probe gives about 50 times less amplitude to the ringing.
.  That took much longer than I thought it would.
 

Offline nixie84Topic starter

  • Newbie
  • Posts: 8
  • Country: pl
Re: ADC - Shunt resistor spikes
« Reply #14 on: July 24, 2019, 11:07:23 am »
Thanks all for help!
I think I understand how it works now.

I will put together bellow circuit on PCB and i will check how its work with Atmega and scope.

PS. Diode on right is schottky.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf