---
+ Post New Thread
Results 1 to 14 of 14
  1. #1
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    hi
    I want to measure the current of a motor dc that control its speed with pwm.I use below circuit for measuring the current.but I dont know a good value for resistor and capcitor.I take this value that shown in the picture,voltage has changing proper to the current but its change is very low.and after the motor being off,the voltage doesnt return to the first value.please help me


    •   Alt24th November 2007, 21:44

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 14,471, Level: 29

    Join Date
    Jun 2005
    Location
    Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
    Posts
    1,409
    Helped
    136 / 136
    Points
    14,471
    Level
    29

    current measuring in pwm mode

    Let's walk through this calculation. It starts with a value for the current-sense resistor between the MOSFET and ground. What's the maximum curren that you wanty to run through the motor? How much power can you dissipate on the current sense resistor (if you care about it at all)?



  3. #3
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    maximum 3A-at normal rotating of motor the current is 500ma
    by regards

    Added after 1 minutes:

    actually I use l298 for control the motor's speed.but for showing it I assume one mosfet in place of l298

    Added after 1 minutes:

    and I use 1 ohm 5wat at sense pin of l298

    Added after 1 minutes:

    when I want read the value of current in micro,it change rapidly and abnormally.



  4. #4
    Advanced Member level 4
    Points: 14,471, Level: 29

    Join Date
    Jun 2005
    Location
    Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
    Posts
    1,409
    Helped
    136 / 136
    Points
    14,471
    Level
    29

    Re: current measuring in pwm mode

    3A through a 1 Ohm resistor will dissipate 1W. Probably, you didnít fry the resistor because you were running a low enough duty cycle. Still, I would either pick a resistor with a smaller resistance or with a higher power rating or put two 1 Ohm 5W in parallel.

    Next question: what voltage range (swing) do you want to achieve at the output of your current sense amplifier? Since V(I) goes to the micro, I would guess that the range is from 0 to 5V or to 3.3V. Right?

    when I want read the value of current in micro,it change rapidly and abnormally.
    There are, probably 2 sources of noise in your circuit: PWM noise and brush noise. The frequency of the PWM nosie is proportional to your PWM frequency. The brush noise is caused by the commutation of the windings and brushes as the motor turns. The frequency of the brush noise is twice revolution rate of your motor.

    By the way, Iíve done a L298 with current sensing a couple of years ago (the schematic is attached). It worked with a PIC and Zilog micros. I didnít write down the max motor current and PWM frequency, but I think it was 1A and 1kHz. The noise filret is set by R5 and C4: f_cutoff=1/(2*pi*R5*C4).


    1 members found this post helpful.

  5. #5
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    I put one inverter with 1/3 amplify factor to decrease voltage level and out positive voltage to the micro.I put voltage refrence of adc to 1 volt

    Added after 19 minutes:

    As I know R5=155k and C4=100uF

    f_cutoff=1/2*pi*R5*C4

    f_cutoff=1/2*3.14*155*1000*0.0001=0.010 hz


    but you design it for 1000hz

    is my calculation wrong???



    •   Alt25th November 2007, 23:14

      advertising

        
       

  6. #6
    Advanced Member level 4
    Points: 12,348, Level: 26
    artem's Avatar
    Join Date
    May 2003
    Location
    Turkey
    Posts
    1,351
    Helped
    127 / 127
    Points
    12,348
    Level
    26

    current measuring in pwm mode

    dont put integrator instead of filter - it will wind up with time . Otherwise you have to reset integrator from time to time



    •   Alt25th November 2007, 23:28

      advertising

        
       

  7. #7
    Advanced Member level 4
    Points: 14,471, Level: 29

    Join Date
    Jun 2005
    Location
    Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
    Posts
    1,409
    Helped
    136 / 136
    Points
    14,471
    Level
    29

    Re: current measuring in pwm mode

    Quote Originally Posted by tictac
    f_cutoff=1/2*3.14*155*1000*0.0001=0.010 hz

    but you design it for 1000hz

    is my calculation wrong???
    Your calculation is correct. I was expecting the brush noise at about 1Hz. I only wanted a DC component for the current, so the cutoff frequency set too low didn't hurt me.

    That brings about another question: why do you want to sense the motor current?


    1 members found this post helpful.

  8. #8
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    I want to sense the current because of dont let the motor go to stall

    Added after 1 minutes:

    and I show a progress bar on graphics lcd that relate to cuurent

    Added after 2 minutes:

    is the output of your opamp has a positive voltage?I think it have.and does R5 reset the opamp?

    Added after 2 minutes:

    can you give me the value of cap and resistor for 168 hz of pwm pulse



  9. #9
    Full Member level 2
    Points: 1,904, Level: 10

    Join Date
    Sep 2007
    Location
    NYC
    Posts
    124
    Helped
    20 / 20
    Points
    1,904
    Level
    10

    Re: current measuring in pwm mode

    Quote Originally Posted by kender
    3A through a 1 Ohm resistor will dissipate 1W. Probably, you didnít fry the resistor because you were running a low enough duty cycle. Still, I would either pick a resistor with a smaller resistance or with a higher power rating or put two 1 Ohm 5W in parallel.
    Let's look at that again for DC, and RMS:

    W = I*I*R

    W = 3*3*1 = 9 Watts



  10. #10
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    I use R5=950 and C4=1uF for 168 HZ of pwm frequency

    Added after 2 minutes:

    it solve reset problem of capcitor but I still have a change of ADC value .

    Added after 12 minutes:

    the output of omamp is change proper to the current but in adc conversion doesnt have a fix value

    Added after 7 minutes:

    I use lm324 instead of lm6462.does it make a problem?



  11. #11
    Advanced Member level 4
    Points: 14,471, Level: 29

    Join Date
    Jun 2005
    Location
    Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
    Posts
    1,409
    Helped
    136 / 136
    Points
    14,471
    Level
    29

    Re: current measuring in pwm mode

    Quote Originally Posted by tictac
    I use R5=950 and C4=1uF for 168 HZ of pwm frequency
    it solve reset problem of capcitor but I still have a change of ADC value .
    f_cutoff = 1 / (2*pi*950*1e-6) = 167.5

    At this frequency the amplitude of nosie from PWM is attenuated by 3dB (i.e. a factor of 2). You also have brush noise, because you have a DC motor. My suggestion: set the f_cutoff to less than one half of your ADC sampling rate (Nyquist theorem).

    Quote Originally Posted by tictac
    I use lm324 instead of lm6462.does it make a problem?
    LM342 shouldn't cause problems. Any rail-to-rail opamp will work.


    1 members found this post helpful.

  12. #12
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    my circuit didnt work with this circuit
    I use one normal integral circuit and one inverter with above value of RC.its work better but still I have a changing in ADC reading at about 30-100
    decimal value.My ADC is work at 67khz



  13. #13
    Advanced Member level 4
    Points: 14,471, Level: 29

    Join Date
    Jun 2005
    Location
    Stanford, SF Bay Peninsula, California, Earth, Solar System, Milky Way
    Posts
    1,409
    Helped
    136 / 136
    Points
    14,471
    Level
    29

    Re: current measuring in pwm mode

    Quote Originally Posted by tictac
    My ADC is work at 67khz
    67kHz? 8O That's a very fast sampling rate for your application. Fast rate per se doesn't hurt you, but 67kHz is a definite overkill if you only want to monitor for motor stall and display current to the user.

    I'm just curious. Which ADC chip are you using? What microcontroller are you using?


    1 members found this post helpful.

  14. #14
    Full Member level 5
    Points: 3,232, Level: 13

    Join Date
    Oct 2006
    Location
    Polland
    Posts
    257
    Helped
    3 / 3
    Points
    3,232
    Level
    13

    current measuring in pwm mode

    I use codevision for programming avr ATMEGA128
    when I use wizard to define ADC it add some code for initialize ADC for using.I say the speed of adc in place of clock's ADC
    ADC Clock frequency: 86.400 kHz
    but how this value can calculate to define the ADC speed????Im sorry



+ Post New Thread
Please login