Shop OBEX P1 Docs P2 Docs Learn Events
Controlling rpm of a motor — Parallax Forums

Controlling rpm of a motor

It has been a very long time since I have been active in this group (had to make a new username) and almost as long away from electronics. I have a project that I would like to use the propeller 1 for but need some pointing in the right direction. I have a 480rpm motor from lynxmotion that has an encode attached. Think Ferris wheel with this motor driving the rotation of the assembly. I want to start the rotation off slowly and then arrive at a set rpm (190rpm). This is where I need the direction. This encode is considered Quadrature correct? That is, if I were using both the A and B input. My application will never require reverse. Do I still use both A and B and am I correct that this is the quadrature object from the obex?

Thank you to anyone who can assist.

Comments

  • It would have been nice to include a link to the motor your going to use. I found this motor on there site:480 RPM motor

    It says it uses a Hall effect encoder which is not a quadrature. I would assume that as the motor turns the sensor would vary the output voltage or maybe it just outputs a pulse each time the motor makes one revaluation. No details are given.

    To control the speed of the motor you need to drive it with a PWM signal using maybe one of these units: Dual Motor Driver

    I have used one of these to control a small tank I had laying around. Works great at driving both motors and even in reverse.

    Mike
  • You're effectively only wanting a tachometer so you only really need A or B as a pulse generator.
  • W9GFOW9GFO Posts: 4,010
    iseries wrote: »
    It says it uses a Hall effect encoder which is not a quadrature.

    The method of sensing the pulses has nothing to do with wether or not it is quadrature. I have a dozens of motors that use hall effect sensors, they are all quadrature.


  • W9GFO wrote: »
    iseries wrote: »
    It says it uses a Hall effect encoder which is not a quadrature.

    The method of sensing the pulses has nothing to do with wether or not it is quadrature. I have a dozens of motors that use hall effect sensors, they are all quadrature.


    Beg to differ. Please expand on this quadrature Hall Effect.

    Hall effects are typically used for commutation of brushless motors...I have never heard of a quadrature Hall Effect and can't imagine what its purpose would be.
  • W9GFOW9GFO Posts: 4,010
    edited 2018-10-14 20:52
    Mickster wrote: »
    Beg to differ. Please expand on this quadrature Hall Effect.

    Hall effects are typically used for commutation of brushless motors...I have never heard of a quadrature Hall Effect and can't imagine what its purpose would be.

    Just google "quadrature hall effect".

    0711EDEapplication_FIG1.gif

  • So....
    Best way to accomplish what I am trying to do?
  • W9GFOW9GFO Posts: 4,010
    If you are going to use quadrature code from the obex then you need to use both outputs. Using quadrature you will have greater control over the motor even if you don't need reverse.

    If you choose to use just one output then coding your own tachometer would be trivial (don't know if there is code for this in the obex or not).
  • kwinnkwinn Posts: 8,697
    W9GFO wrote: »
    If you are going to use quadrature code from the obex then you need to use both outputs. Using quadrature you will have greater control over the motor even if you don't need reverse.

    If you choose to use just one output then coding your own tachometer would be trivial (don't know if there is code for this in the obex or not).

    Two tachometers are listed if you go to the OBEX and search for "tach".
  • ercoerco Posts: 20,256
    edited 2018-10-15 15:02
    Yep, a single sensor can work for you and is called a "tach sensor" as opposed to a quadrature encoder. It's a simple matter to determine RPM by counting pulses in a fixed interval.
  • am am getting very jittery readings using the Xtach code.
  • kwinnkwinn Posts: 8,697
    altitudeap wrote: »
    am am getting very jittery readings using the Xtach code.

    How jittery? What are the min and max readings?
  • altitudeapaltitudeap Posts: 9
    edited 2018-10-18 17:53
    https://youtu.be/Ow04iKJgDmcKwinn,
    Please see the attached
  • kwinnkwinn Posts: 8,697
    altitudeap wrote: »
    https://youtu.be/Ow04iKJgDmcKwinn,
    Please see the attached

    OK, thats pretty bad. Could you be picking up noise from something? Motor, wiring, power supply, etc. Try running the code without powering the motor.

    You don't have the motor and prop on the same power supply do you?
  • separate power supplies.
    nothing happens when the motor is off. Likewise, if i start the program with out the motor on, and then turn it on, the program does nothing.
  • ercoerco Posts: 20,256
    Can you turn the motor by hand and see if there is more consistency?

  • kwinnkwinn Posts: 8,697
    edited 2018-10-19 00:05
    altitudeap wrote: »
    separate power supplies.
    nothing happens when the motor is off. Likewise, if i start the program with out the motor on, and then turn it on, the program does nothing.

    Ah yes, should have realized the waitpne/peq would hang it. Turn the motor by hand as erco suggests. Is this a brushed motor (2 wires, DC in)?

    Come to think of it having no power to the motor might also mean no quadrature signal as well. Any way to disable motor only?
  • I now have one of my motors working but not the correct one.
    I have an EMG30 motor connected and i went back and read the spec sheet and it stated that i needed a 4K7 pullup resistor which i was not using.
    With it in place, i can make the xTachtest.spin display the rpm https://youtu.be/a53cDP4_tIo

    With the Linxmotion motor and encoder, i cant make it work either way. But it looks to me that the pullup is build into the encoder. (i cant attach an image so here is the pdf for the encoder https://robotshop.com/media/files/images2/encoder_specification_e-16ppr.jpg)

    Any ideas on what i am doing wrong? I have ordered another motor to see if mine is bad but it wont be here until monday.
  • WhitWhit Posts: 4,191
    edited 2018-10-21 11:23
    Wonder if you could filter the signal with a capacitor? Looks like it might be caused by motor noise.

    https://www.arrow.com/en/research-and-events/articles/using-capacitors-to-filter-electrical-noise

    I was having some trouble with motor noise interfering with an IR signal on a robot (m-Arlo). Using a small (0.1 uF capacitor (Parallax #200-01040)) capacitor between the signal and ground filtered the noise and all was fine.

    See also https://www.parallax.com/product/751-00012 I especially like the "Overview" note on this page - "Circuit not working? Put a capacitor on it! Capacitors are used almost everywhere in electronics: from energy storage to signal coupling. (Signal coupling allows AC signals to pass while blocking DC signals. Like when Gandalf yells, "You. Shall. Not. Pass!" at Balrog in the mines of Moria. But you don't have to do that when you add one of these to your circuit. Bonus points if you do.)"

    Might be worth a try...
  • I recieved my new motor replacement today. The old one was faulty. The new one works.
    Question regarding math. The xTach code wants to know pulses per revolution so that it can devide to calculate rpm. My motor has a gearbox with a gear reduction of 1:5.2 and the encoder has a 16 PPR. This gives me something like 83.2 PPR on the output shaft. I am trying to maintain 190 rpm. Given the decimal number, would it be best to just round down to 83 so as not to have to use float and then try and call rpm with some sort of an adjustment factor? Sorry if I am not making sense
  • WhitWhit Posts: 4,191
    @altitudeap - glad you found the fault!
  • Instead of using floating point math, multiply everything by some factor to remove the decimal point, do the math and then at the end divide by the factor. So if your reduction is 1:5.2 then change that to 10:52 (x10) then your PPR comes out to 832 for 10 revolutions. So 190RPM /10 =19. 19 x 832 = 15,808 pulses. No floating math required!
  • @DiverBob thank you
  • kwinnkwinn Posts: 8,697
    Or when possible use a power of 2 factor so you can shift the values rather than multiply or divide them.
Sign In or Register to comment.