Shop OBEX P1 Docs P2 Docs Learn Events
Current output smoothing ideas? — Parallax Forums

Current output smoothing ideas?

In the photo the top line is a counter ramping FRQA from 3.3 down to 0 in 512 steps feeding a comparator. Second line is the comparator output design the Prop. Third line is a BLDC motor driver current amp output. The output is scaled to around .8V running the motor at 1/2 speed under no load. This gives headroom for max load. The output is rather noisy and I’d like to first see how to make that a lot smoother. I have a 1uf on the output of the sense amp connected on the motor driver shunt and also a 4.7uf on the low pass filter pin on the AD628 sense amp. Still I’d like to see a smoother signal. Ideas? I got in a 12 bit ADC today ADS1015 I2C as there are no pins for SPI. I will see if I can get a finer resolution for trip points in over-current vs the comparator method. The comparator method works perfectly on an existing system(higher voyage swing under stress) but the new system has a lot higher gear ratio of 75:1 and it is far more difficult to create a trip condition if the motor is under unusual friction so that’s why I’m trying to use a better method of detection with tighter trip threshold since with the high ration there is a much lower current output voltage swing, the motor>gbox can do damage before the current trips. So smoother current measurement output and finer detection resolution is the goal for today.

Comments

  • I had the impression that you are running a full PID where the output is a current/torque command. IOW, if the PID is not active but the drive is enabled, the motor receives zero current?

    If this is the case, you already have a motor-current indicator in the output of the PID.
  • T ChapT Chap Posts: 4,198
    edited 2018-11-13 18:32
    This is an alternative method for some cases where I will watch only the encoder on the output for position. Not PID, no encoder at the motor. Just set a voltage to drive the motor and when it reaches a position is stops. Fixed speed, fixed current unless overload but I want to detect the current and set a threshold. I'll first "learn" the current on a first past to get an average from the ADC. Then set a threshold above that average to trip a fault.

    My PID tracks an error. New position - current pos
  • evanhevanh Posts: 15,126
    The scope traces all look very clean.
  • I hooked up this little 4 channel i2c ADC and this is working great for the purpose of measuring the current output from the sense amp.

    Pretty neat device http://www.ti.com/lit/ds/symlink/ads1015.pdf
    570 x 375 - 135K
  • The INA138 or 168 might be a better choice for current measement
  • INA138 looks interesting, I'll test it out.
  • T Chap wrote: »
    My PID tracks an error. New position - current pos

    Sure but there are two possible setups for a servo-drive:

    1) Velocity mode: Speed regulation is handled within the drive, using feedback from the motor. In this case, the output from the controller's PID is a velocity command. Max PID output results in max motor RPM.

    2) Torque mode: In this case, the output of the PID is commanding current output of the drive. 50% command = 50% of the scaled current output of the drive. Monitoring this value is the same as reading the drive's current analog output.

  • I got in an INA138 and it’s example op amp OPA340 and used their reference schematic which suggests the op amp to reduce loading in parallel to the gain resistor. Using ADS1015 ADC this is a really nice combination. I put a 100k trim pot for the gain resister in the out of the 138 which gives a ton of gain as needed to get a full range of output for the application. In my cases that’s nice because different cases have different loads. Thanks for the suggestion on this INA138.
  • evanhevanh Posts: 15,126
    I hope you're not using a worm drive gearbox.
  • In this case it’s a spur gear.
  • I'm glad the INA138 worked out for you. They always worked well in my current measement applications.
  • evanhevanh Posts: 15,126
    I'm guessing slide velocity is very slow but the stopping momentum still has to be accounted for. Which means using stops that have a built-in decelerate distance upon impact. This could be as simple as deep rubber stoppers but may require shock-absorbers as well.

    Regarding over-current trip as a means of normal stop detection: The mechanics should be built to not be overly stressed when motor is at full toque against the stop. Anything else won't last.

    Alternatives would be use a measuring device like an encoder or just a basic limit sensor to tell the controller when to stop - before reaching the mechanical end! And you still should have electrical cut-outs backing those up.

  • T ChapT Chap Posts: 4,198
    edited 2018-11-16 18:40
    Watts is amps * volts. So on rating the shunt ie .1ohm lets say 2 amps current with 24vdc under load. 2* 24v =48w? Is this correct? My shunt is usually 3 watts or sometimes parallel 2-3watts to half the wattage on the shunt. Still no where near 48watts. Or should this be voltage in - voltage (v drop) out of the shunt which results in much less voltage. Ie 1v * 2amps = 2 watts.
  • jmgjmg Posts: 15,140
    T Chap wrote: »
    Watts is amps * volts. So on rating the shunt ie .1ohm lets say 2 amps current with 24vdc under load. 2* 24v =48w? Is this correct? My shunt is usually 3 watts or sometimes parallel 2-3watts to half the wattage on the shunt. Still no where near 48watts. Or should this be voltage in - voltage (v drop) out of the shunt which results in much less voltage. Ie 1v * 2amps = 2 watts.

    yes, you need the (correct) drop across the shunt, but the simplest is to use I^2*R for power loss - here you have 2*2*0.1 = 0.4W (that 0.1 ohms drops 0.2V at 2A, & 0.2V *2A = 0.4W)
  • Thanks!
  • T ChapT Chap Posts: 4,198
    edited 2018-11-18 18:37
    If the absolute maximum sense voltage(V+ - V-) is 2V on the INA138 or "damage may result above maximum ratings" I assume that means you better reduce the shunt value to not allow >2V. With a .1 I can grab the output the motor gbox ( via shaft coupler) and produce 2V, and I know there is potential for higher loads in some application. Probably best to test each application for the maximum stress and put a shunt that allows some headroom.

    "The maximum differential input voltage for accurate measurements
    is 0.5 V, which produces a 100-μA output current. A differential input voltage of up to 2 V will not cause damage."

    Or what about a trim pot divider on the plus input (V+)
  • T ChapT Chap Posts: 4,198
    edited 2018-11-18 20:52
    This idea worked out well putting trim pot on Vin+ of the shunt. It allows the same board to work on different size motors with different current ranges without changing the shunt. The idea is you want to get enough voltage range 0 - 5V to the ADC for it to have best resolution, and the INA138 wants a maximum of 2V before potential damage, recommended to stay below .5V. The INA138 has an adjustable gain output so you can get a full range on the ADD. With different motors and loads you would have to swap out the shunt to produce the ranges needed for that application. With the trim pot on the shunt to the Vin+ of the INA138 sense amp you can scale down the input and not have to change out the shunt value per project, this allows a motor pulling a lot of current to not exceed the 2V maximum. I notice the trim pot output is not linear, so you don't get 50% voltage output by setting the trim to center position. So I'll need to determine which values work best for each application and then put in some test pads to put a meter and get the ohms to apply the value to the same type application on other boards.

    Side note, since the ADC is a 4 input, I would like to find a way to get the voltage drop difference from the shunt into one of the ADS inputs so there could be a shutdown if that max value 2V was exceeded. What circuit would allow the difference to be determined and sent to the ADS input? The INA138 is a differential input with a specific output based on the difference but it would be nice to just have a raw voltage to an input to measure without having to run the math involved if only using the INA138, since the output the INA138 will be gained with a trimpot.
  • T ChapT Chap Posts: 4,198
    edited 2018-12-14 04:36
    Here is the latest board assembled with the INA138 current sense>OP amp> ADS1015 I2C ADC. The prop board can now monitor the current to the motor driver board via I2C. The INA138 was a great suggestion
  • Nice board. Those INA series devices work well.
  • @T Chap

    Man, you really don't let the grass grow under your feet :smiley:
Sign In or Register to comment.