erickone96

Members
  • Content count

    8
  • Joined

  • Last visited

Posts posted by erickone96


  1. Hey Jack,

    The decoder is giving me a good reading of getSpeed function type 0 (96MHz clock ticks for 5 A_clock pulses). I am able to compute the RPM and then average 40 readings giving me a pretty good and fast RPM reading. The only issue now is that I get an average RPM = 0 everynow and then. Not sure what could be causing it since decoder seems to be working properly.

    I'm using this method to average the RPM: https://www.arduino.cc/en/Tutorial/Smoothing

    And this is how Im computing the RPM for example:

    Robot_Control_Library.getSpeed(0): 37366

    Time for the 5 pulses: 37366 x 10.4ns

    5 pulsles out of 1000 ppr = 0.005

    V = 0.005 rev / 387us = 12.9 rev/s x 60 = 774 rpm.

    In my code, Im computing it as: 

    rpmreading = 28846153/ Robot_Control_Library.getSpeed(0).

    Im guessing that the prob is because of the large numbers in the computation ? 

    Any suggestions ?

     

    Thanks,

     

    Ruben

    rpm01.jpg

    IMG_2050.JPG

    rpm0.jpg


  2. Hey there,

    I have been working in a dc motor control project. So far I got the motor running open loop pretty good (clockwise and counter clockwise), and now I wanna implement a closed loop speed feedback. I tried using the quadrature decoder to read the pulses coming from an quadrature incremental encoder. So this is what I read at approx. 1720 rpm

    Pulse Count
    33133033
    Speed 
    -17034
     Speed Radians: 
    -36.43

    Pulse Count
    33130475
    Speed 
    -17296
     Speed Radians: 
    -36.16

    Pulse Count
    33127931
    Speed 
    -17003
     Speed Radians: 
    -36.05

    Pulse Count
    33125396
    Speed 
    -16801
     Speed Radians: 
    -37.98

    Pulse Count
    33122854
    Speed 
    -17035
     Speed Radians: 
    -36.73

    Pulse Count
    33120307
    Speed 
    -16784
     Speed Radians: 
    -36.69

     

    It is negative because its rotating counter clockwise. Why is it too inaccurate? I have attached my project just in case someone wants to take a look at it. 

    Thanks,

    code02.zip

    P.D. The motor runs at 4000 rpm max. Encoder specs: 1000 ppr. A, B, and I.


  3. Hi Jack,

    I just figured out how to change the frequency of my pwms. I saw in the vhdl code that  [ freq = CLK / (2^PWM_width)]. Thank you so much for replying so quick though! Have a great day!

    P.D. I was using the RCL_PWM_x48.

    Regards,

    Ruben


  4. Hello,

    I'm using the PWM generator block successfully, but the PWM signals have a frequency of about 375KHz (way too fast for my application). Is it possible to change the frequency of the generated PWM signals without messing around with the VHDL code? I'm not very familiar with VHDL. I'm generating two PWM signals, one is the complement of the other (while 1 is high the other one is low), that I will be using for controlling a DC motor so a reasonable frequency would be between 500Hz and 20KHz. 

     thanks,

    Erick

     

     


  5. Hello,

    I'm using the PWM generator block successfully, but the PWM signals have a frequency of about 375KHz (way too fast for my application). Is it possible to reuse that code for setting up a different PWM generator that uses a exteral clock that may allow me to generate PWMs at 1/100 frequency ? I'm not very familiar with VHDL.

     thanks,

    Erick