| Electronics > Projects, Designs, and Technical Stuff |
| Motion control, S-curves and other stuff >> controlling lift with DC motor |
| << < (9/14) > >> |
| krisRaba:
Thanks for these suggestions. I have already extended my TODO list to improve ACS power supply filtering as well because AFAIK it produces ratiometric output so any noise on its VCC will be reflected in output signal, I think. "CMRR" doesn't exist in ACS722 datasheet so I am probably right about its rule of operation ;). At the moment there is some foil cap in THT for VCC decoupling because it was easier to install so in final design I will replace it with low ESR mlcc 100n+1u and maybe ferrite bead. AVCC which is also AREF in this MCU is already quite well filtered, I think. My particular DC motor has rather low rotor inertia itself - 72.8gcm2 - and what is also important (I suppose) it has quite low windings inductance - 0.103 mH - so current will be less filtered than in high inertia, high inductance models and motor will react faster to any changes on input. What it interesting, original motor controller that can be purchased with that motor uses 50kHz PWM, 25kHz current PI loop, 2.5kHz speed PI loop and 2.5kHz position PID loop. In some NXP article I have found a note: --- Quote ---This principle works only on the condition that the motor electrical time constant must be many times higher than the switching period. Therefore, the motor current waveform will be almost linear during the pulse of the PWM --- End quote --- and my DSO shows rounded and skewed triangle on ACS output, as mentioned earlier... Maybe they have increased PWM frequency to get more linear current transitions? I don't know. Or maybe it is only a matter of limited bandwidth? ;) |
| jbb:
Glad to hear it more or less works. It’d be nice to see some photos of the setup if you’d be so kind. I suggest you try sampling the ADC at twice the sampling frequency. Then you can quite simply average the two samples and feed that into your current controller, which hen runs at 1x PWM frequency. If you then want to try more, you could try a modified PI controller. Keep the integrator part as normal, and add a low pass filter to the proportional part to knock down the high frequency gain a little. (Rationale: the integrator has a 90 degree phase lag. If you simply low pass filter the current the you add filter phase lag to the integrator phase lag and could have trouble.) |
| IconicPCB:
Place an inductor in series with the motor to achieve required electrical time constantwith motor |
| Siwastaja:
If getting the correct & accurate average current is an issue due to large current ripple, or running in DCM (at low currents, in "diode emulation mode"), use an MCU with high enough sample rate ADC, and sample several times during the PWM cycle. For example, I have done 2 x 8 samples/cycle in a 140kHz dual converter no problem using STM32F334, averaging in software. With motor control frequencies (say < 50 kHz) and only one channel required, it should be trivial to go for, say, 32 samples/cycle. Some ADC peripherals offer oversampling in the peripheral itself (accumulating in the data register). This will reject switching noise as well, unless the spikes are truly massive. |
| krisRaba:
--- Quote from: jbb on October 23, 2019, 09:36:18 am ---Glad to hear it more or less works. It’d be nice to see some photos of the setup if you’d be so kind. --- End quote --- Maybe with next release. Now it looks horrible :-DD --- Quote from: jbb on October 23, 2019, 09:36:18 am ---I suggest you try sampling the ADC at twice the sampling frequency. Then you can quite simply average the two samples and feed that into your current controller, which hen runs at 1x PWM frequency. --- End quote --- That is a good idea and easy to implement. I will try that. --- Quote from: jbb on October 23, 2019, 09:36:18 am ---If you then want to try more, you could try a modified PI controller. Keep the integrator part as normal, and add a low pass filter to the proportional part to knock down the high frequency gain a little. (Rationale: the integrator has a 90 degree phase lag. If you simply low pass filter the current the you add filter phase lag to the integrator phase lag and could have trouble.) --- End quote --- Yeah, some time ago I have noticed that too much lag causes strange bahavior which is quite obvious because reaction is made against something that is not true anymore in reality ;) --- Quote from: IconicPCB on October 23, 2019, 10:33:32 am ---Place an inductor in series with the motor to achieve required electrical time constantwith motor --- End quote --- You are right, I have noticed today that original controller has specified built-in motor choke of about 9uH and I have found FAQ document with some formulas to check if additional external inductor is needed. And what even more interesting, they claim that for calculations only 30% of inductance from datasheet should be used because it is measured with 1kHz sine and effective inductance for higher freq square is 30-80% of that ;) So I plan to add 4,7uH to each H-bridge output. I was looking for some info about type, whether it should be CM choke or DM (not coupled inductors) and I am still not sure ;) By intuition DM... But I have also found some standard solutions with 220uH CM and 82uH+RC to ground ;) The best way to check would be to play around and swap some components, maybe there will be some spare time to do that ;) --- Quote from: Siwastaja on October 23, 2019, 11:50:19 am ---If getting the correct & accurate average current is an issue due to large current ripple, or running in DCM (at low currents, in "diode emulation mode"), use an MCU with high enough sample rate ADC, and sample several times during the PWM cycle. For example, I have done 2 x 8 samples/cycle in a 140kHz dual converter no problem using STM32F334, averaging in software. With motor control frequencies (say < 50 kHz) and only one channel required, it should be trivial to go for, say, 32 samples/cycle. Some ADC peripherals offer oversampling in the peripheral itself (accumulating in the data register). This will reject switching noise as well, unless the spikes are truly massive. --- End quote --- Yes, I think that my F303 could also handle that. I will check the results with simplier solutions and if it fails I will try more sophisticated ones.. :) In the meantime I have switched to 50kHz PWM ;) It works (without current control loop at the moment) but I have to check some bad things on output signals. From very quick investigation I think that ringing on MOSFET gates causes cross-conduction for short moments so motor works but H-bridge becomes hot... |
| Navigation |
| Message Index |
| Next page |
| Previous page |