EmbDev.net

Forum: FPGA, VHDL & Verilog I am hopeless (motor control system)


von Marco (pastaman71)


Attached files:

Rate this post
useful
not useful
Good morning to all dear friends, for those who have not followed my 
past problems, I have been asked to design a system that drives a DC 
motor with encoder (I will attach the text of the project). In all this 
time I managed to create a PWM, a PI regulator and recently I designed a 
system that counted the time elapsed between 2 pulses of channel A of 
the encoder to obtain the motor speed (which turned out to be a failure 
according to my professor because I wasn't taking into account the speed 
reducer installed on the DC motor). He advised me to use a reciprocal 
counter[(?) never heard of it] or if I have anything else in mind I'm 
free to do so. To tell the truth, I find myself once again in the dark 
tunnel of VHDL and I have no idea how to proceed and for this reason I 
ask for your opinion on how to calculate the speed of this quadrature 
encoder. A second problem I encountered is that of real numbers: taking 
the PI regulator as an example, when I calculate I, the product with the 
sampling period gives me a very small value that VHDL truncates to 0, 
how do I solve this problem? The professor told me that I have to use 
the 1.n representation, but he never explained how to implement it or 
anything close to it.
I am truly desperate and unmotivated, I hope your words can lift me up, 
I thank you infinitely in advance.
Marco

mia pi: is my pi.
mia pwm: is my pwm.
mio rilevatore: is my detector.

i'm sorry about the comments in italian language, if needed i'll proceed 
to translate them all.

project text link:https://www.celec.org/doku/doku.php?id=dafare (just 
for the images, if needed)
Translated project text:Suppose you have available (they will be 
provided by the teacher) a DC motor equipped with a gearbox and a 
quadrature digital encoder and a full bridge driver to power the moder.

A digital system must be designed capable of maintaining constant the 
rotation speed of the motor which is supposed to be encoded on an 8-bit 
integer in two's complement notation.

The output of the digital system consists of the digital signals 
necessary for driving the bridge, i.e. a bit to indicate the direction 
of rotation and a PWM signal with the duty cycle proportional to the 
power to be sent to the motor.

The system must continuously monitor the quadrature encoder output to 
estimate the direction and magnitude of the rotational speed. Based on 
the estimated value and the reference input, the duty cycle of the 
output PWM signal must be modified in order to reach the set rotation 
speed.

Once the design of the digital system has been completed and its correct 
behavior has been verified through MODELSIM simulation, this must be 
integrated as part of a peripheral for NIOSII with the preparation of 
the control commands on serial line following the system on chip model 
developed in class.

The characteristics of the motor with encoder and the full bridge driver 
available are summarized in the figures.

For now just ignore the nios2 part

von Antti L. (trioflex)


Rate this post
useful
not useful
What you are asking is essentially: "Please do all my homework for me"!

This is unlikely to happen.

If you count clock pulses between encoder pulses, then you get a numeric 
value that is ratiometric to the motor RPM. You can use this value in 
your PID loop.

If integer numbers go too small, then well you need to use fixed point 
arithmetic. With fixed point you still use integer operations, but you 
have "virtual" point somewhere in the logic vector. Say if you want to 
convert an integer to 16.16 fixed point then all you need todo is to 
shift the integer left 16 positions. Now you have fixed point value.

von Marco (pastaman71)


Rate this post
useful
not useful
I guess you didn't read the whole message, since it specifically says "I
ask for your opinion on how to calculate the speed of this quadrature
encoder". thanks anyway for your answer (I would add rather useless and 
offensive)

von Antti L. (trioflex)


Rate this post
useful
not useful
I did read all you post.

And I did give the best advice I had. Use fixed-point arithmetic.

von Marco (pastaman71)


Rate this post
useful
not useful
ok thank you, maybe i was too arsh. just stressed a lot, sorry again

von Andi F. (chefdesigner)


Rate this post
useful
not useful
Why do I have the impression that FPGA designers become more and more 
unskilled? This is a piece of cake for an engineer.

Sorry, but why the hell do companies employ people who did not have 
learned about such easy things? A realization of a PWM-Controller is the 
most easy thing for beginners, unless they are only programmers and have 
no idea about hardware.

However, a PWM might be even the false solution for you problem in 
detail because of the required reaction time of the control logic.

von Marco (pastaman71)


Rate this post
useful
not useful
actually i am a student... is the first time (and i hope the last) using 
an fpga/coding vhdl

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.