Help with DC motor driver circuit

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

I have downloaded the OPA544 spice file from texas instrument and have simulated the circuit successfully. But the result is a bit weird. Please have a look with the attached file. Why the output voltage of the operational amplifier is not identical as the input voltage. The Vin is the input voltage of the first amplifier while the V(n002) is the output voltage of the amplifier. The result was really far away from my expectation.

Please advice. Thank you very much.

Best Regards,
herher
 

ifixit

Joined Nov 20, 2008
650
Hi Herher,

The 1mH inductor you are using to model your motor has a default series resistance of 1 milliohm. The spec for your motor says the stall current at 12V is 1.8 Amps. Therefore 12V / 1.8A is 6.7Ω.

Right click on the inductor and set its series resistance to 6.7.

This is still not a very good model for a DC motor because back EMF is not accounted for, but it will do for now.

Your simulation will not show that you need the decoupling either, because the power supplies and wiring inductance are not modelled either.

Regards,
Ifixit
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Ifixit, I can't say thank you enough to you. You have solved my problem that had troubling me for two hours by just a single sentence. Really thanks a lot for your great help. I will test my real circuit as soon as possible and will notify you once I get the result.

Thanks again.

Best Regrads,
herher
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Ifixit, you know what...you are fabulous! After parallel the capacitors to the power pins, the circuit now is working like a real voltage follower...no more betrayer, haha. Besides, both chips are not hot anymore...everything is working perfectly according to my expectation. You are really great. Thank you very much.:D

Anyway, can I confirm something with you? The positive pin of the electrolytic/tantalum capacitor at the V- pin should connect to ground right? Apart from this, can I know the theory about the addition of these capacitors? Is it just merely because of stabilizing the power to the power pins?

Thank you very much.

Best Regards,
herher
 

ifixit

Joined Nov 20, 2008
650
Hi,

Ifixit, you know what...you are fabulous! After parallel the capacitors to the power pins, the circuit now is working like a real voltage follower...no more betrayer, haha. Besides, both chips are not hot anymore...everything is working perfectly according to my expectation. You are really great. Thank you very much.:D
Glad I could help. The nice pictures you posted earlier helped make the diagnosis easy.:)

Anyway, can I confirm something with you? The positive pin of the electrolytic/tantalum capacitor at the V- pin should connect to ground right?
Correct. For the negative supply rail the + terminal of the capacitor goes to the common point, or ground, and the - terminal goes to the -15V.

Apart from this, can I know the theory about the addition of these capacitors? Is it just merely because of stabilizing the power to the power pins?
The output draws current from the supply rail to drive the load so if there is a resistive or inductive series impedance in the supply line then the supply voltage will drop slightly. If this supply voltage noise gets into the input of your circuit you will have an oscillator. Decoupling the supply pins prevents this from happening.

Regards,
Ifixit
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Ifixit, how are you?

Ifixit, do you know much about MATLAB? Can I ask you something about MATLAB? I know I shouldn't ask this question over here, this should be posted in the programmer's corner. Actually, I already posted a message over there but I don't get any passionate response. So, I hope I can get some precious suggestions from you...again, haha. Thank you very much.

I have attached a file with several pictures along with this message. I am planning to get the plant model (transfer function) of the system operation along the y-axis of my xy positioning table based on the step response graph via MATLAB. In fact, I need two transfer functions for my entire system, one will represent the system operation along y-axis while the other will represent the system operation along x-axis. I am using ADC block and DAC block extracted from the xpc target toolbox in the block diagram.

Please have a look at the pictures in the attached file. My question is how can I acquire a normal step response graph of the speed response of my system? The speed graph I have obtained from the experiment is full of noise even I already added a low pass filter after the derivative block. As I have mentioned previously, I want to acquire the transfer function of the system operation along y-axis based on the step response of my system.

Please allow me to explain the logic over here. From the block diagram, I have supplied a step response signal to the DAC block. The signal generated from the DAC block (microbox DAC port) went to the motor driver circuit and eventually drive the dc motor to actuate the system to move along y-axis. The potentiometer rotated in response to the rotation of the motor, and thus the output of the potentiometer returned the position data back to the ADC port of the microbox. Beside this method, I am going to use system identification toolbox to obtain transfer funciton as well.

Please advice. Thank you very much.

Best Regards,
herher
 

Attachments

ifixit

Joined Nov 20, 2008
650
Hi Herher,

I know about Matlab and what it is for, but I have never used it and I'm not a math expert either.

I am assuming your motor driver gain is still 1, so the loop gain is approximately 1 as well. You can add gain in software if you need to. Your DC motor speed (RPM) is approximately proportional to the voltage applied to it if we neglect friction, inertia, and load (torque) changes. For a pen plotter the load should be reasonably consistant. Therefore you almost don't need the derivative function to find the velocity when the loop gain is 1.

The second graph shows a nice linear rising voltage, which is what I would expect with your setup. The rate of change is 0.3V/Sec which translates to a plotter pen velocity. Cm/S? The derivative of this should be equal to the value of the set input, in your case, 5V. This represents the motor RPM and therefore the pen velocity.

The derivative box in your diagram is not set properly and should not need a filter.

Perhaps another member who is a math and matlab wiz can chime in give some better advice on how to set the derivative function.

Regards,
Ifixit
 

Georacer

Joined Nov 25, 2009
5,182
Where is your noisy graph taken from? Is it from the output of your AD converter or after the derivative block?

And a non-relevant question: why did you use the DA-AD converters?
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Thanks for the reply Georacer.

The noisy graph is a speed graph and it was taken after the derivative block. The graph taken before the derivative block is a position graph, so in order to obtain speed graph I have to put a derivative block after it.

Actually, I am using a microbox which is like a target processor accessing the block diagram that I have created in the simulink. The entire processes is complemented by using the xpc target toolbox in the MATLAB.

Here is a brief decription of the microbox I am using:

Micro-Box 2000/2000C is a rugged, high-performance x86-based industrial PC with no moving parts inside. It supports all standard PC peripherals such as video, mouse, and keyboard. For engineers who have real-time analysis and control systems testing needs, Micro-Box 2000/2000C offers an excellent mix of performance, compact size, sturdiness, and I/O expandability. It is available with several different I/O selections, supporting both SCI and TCP/IP communication interfaces and various PC/104 based AD/DA, DIO, Encoder, CAN Bus and Counter (PWM) modules that address numerous prototyping requirements. User uses Micro-Box 2000/2000C integrating with MATLAB/Simulink and related control modules could run real-time modeling and simulation of control systems, rapid prototyping, and hardware-in-the-loop testing. And these tasks don’t need any manual code generation and complicated debug process.

On the other hand, all these are working with my project, the xy positioning table which consists of two dc motors to actuate the linear movement along x-axis and y-axis respectively and the potentiometers to return the measured position data. The potentiometer is mechanically coupled with the dc motor, so it will rotate in response to the rotation of dc motor.

Anyway, Georacer do you know much about MATLAB system identificaiton toolbox? I am planning to use system identification toolbox to acquire my plant model/transfer function as well.


Please advice, thank you very much.

Best Regards,
herher
 
Last edited:

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Ifixit, thanks for your effort, I am really appreciate.

Anyway, do you know Ziegler Nichols PID tuning method?

I am planning to do this:

(1) Obtain system transfer function based on the system step response graph. Then, design PID controller based on this transfer function.

(2) Obtain system transfer function by using system identification toolbox in MATLAB. Then, design PID controller based on this transfer function.

(3) Directly use Ziegler Nichols method to design PID controller.

I will compare the result for all these three methods and see which one is better. What is your suggestion about using Zeigler Nichols method in my PID controller design?

Please advice. Thank you very much.

Best Regards,
herher
 

Georacer

Joined Nov 25, 2009
5,182
I 'm a bit troubled. I don't have xPC toolbox in my Matlab installation, nor I can be of much help in your feedback design. I do have some remarks, though.

Your input is a step function, and provided that the relay xPC blocks do nothing but transmit the signal, its derivative (an impulse function) is fed to the motor block.

I created a system G=1/(0.001s+1) in Matlab, and asked for its impulse response. Naturally, the response was a decreasing exponential. How did you get an increasing ramp out of that system?
Can you also provide the output of the Scope1 block?
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Georacer, sorry for replying so late.

The second plot in the attached file is the output plot of the Scope1 block. It is the plot of position vs time. The trend of the plot is increasing with respect to time.

Can I explain the concept of the project over here again? Because I think you are a bit misunderstood with it. Thanks.

When the step signal is supplied to the DA block in the block diagram, the microbox I am using will output the identical voltage as the step input signal. This high impedance signal will pass through motor driver circuit and eventually to dc motor to actuate the system to move along y-axis. In the meantime, a multiturn potentiometer which is mechanically coupled with the dc motor will turn in response to the rotation of dc motor. The output of this potentiometer will keep varying when the system is moving along y-axis. This signal will be delivered to the AD port of the microbox. This signal, which shows the position data of the system along y-axis will be the signal after the AD block in the block diagram. Now, in order to obtain the speed graph of the system I have to put a derivative block after it.

All these efforts are done to obtain the plant model of the system operation along y-axis. I need to get this transfer function based on the step response graph of the system speed under the designated step signal. Ideally, the plot after the derivative block should be a step response graph. But, the plot I have obtained is very noisy.

So, my question is straight forward. How can I filter this noisy graph? I have tried to put a low pass filter (1/(0.001s+1)) after the derivative block, but it is still noisy.

Please advice. Thank you very much.

Best Regards,
herher
 

Attachments

Georacer

Joined Nov 25, 2009
5,182
Yes, I hadn't understood the system until you explained it to me again.

Uh, against my expectancies, the velocity output came up much smoother with a denominator of 0.5s+1 on the lpf. Try to reduce the coefficient of s and see what comes out of it.
 

Georacer

Joined Nov 25, 2009
5,182
Thinking about it again, if you want to extract a system model out of the differentiator output, you will be inhibited by its low response to quick transients. It's natural, you designed it to drop the noise.

But if your noise lies withing the operating frequency of the system, you will lose critical data. If they are separated, I suggest you use a filter of higher frequency. If they overlap, you might have a problem.

I 'm not sure if a Kalman filter can be of use here. A more expert opinion on control systems would help.
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Georacer, thanks for the reply. I will try to lower down the coeeficient of the lowpass filter first. Actually, I have tried the lowpass filter with different coeeficient before and the magnitude of the result coming out is quite different with the one I have shown you. Can I know what is the reason?

Besides, do you know much about MATLAB system identification toolbox? Can I ask you something about this??

Please advice, thank you very much.

Best Regards,
herher
 

Thread Starter

herher

Joined Oct 18, 2011
53
Hi,

Thanks for the reply.

You mean changing the value of nominator will vary the dc gain and thus change the amplitude of the waveform right?

So all I need is remain the nominator as 1 and just play around with the coeeficient of the s right? This will only change the filter threshold and not the amplitude of the waveform is it? By the way, does the filter threshold means the beginning point of the filter?

Please advice, thank you very much.

Regards,
herher
 

Georacer

Joined Nov 25, 2009
5,182
You got my intention right. The threshold refers to the frequency at which the filter starts cutting off signals of that frequency and beyond (or up to).
 
Top