misan / dcservo

Position control of DC motors
315 stars 115 forks source link

PId Tuning tool not displayng graph correctly #53

Closed PaulRobert1 closed 6 years ago

PaulRobert1 commented 6 years ago

Hello,

I am currently working on modifying a old school milling machine, modifying it using grbl and your amazing code for the servos, I am using windshield wiper motors to move the axes, encoders from china and 3d printed encoder discs but i have hit a sinkhole:) these are the issues I am currently facing:

Thank you very much for all the support provided.

Kind Regards, Robert. whatsapp image 2018-08-10 at 12 13 34 whatsapp image 2018-08-10 at 12 13 54 1 whatsapp image 2018-08-10 at 12 13 54 2 whatsapp image 2018-08-24 at 16 40 06 whatsapp image 2018-08-24 at 16 40 07 whatsapp image 2018-09-11 at 18 52 05

misan commented 6 years ago

Hi Robert, it seems you have given a lot of thought and work on your machine.

I can see that the encoder being on the output shaft can compensate gearbox backslash but that may also introduce instabilities in the system.

If the motor does not stop once reaching the final location can be a sign that proportional gain is too high. You can try lowering that.

Also, for manual adjustment remember you can use the Arduino IDE serial monitor to send various commands like a new proportional gain value. While you do that the system will also respond to step and direction pins. Initially set D0, I0 and P0.1 to see how it goes. Try manually adjusting them to get a good response (if possible, as I mentioned backslash on the gearset might give you hell).

If when lifting Z everything goes bad that might be caused by the power supply not delivering enough current. Just a guess.

PaulRobert1 commented 6 years ago

OMG! that was a unexpected fast response:)

I am powering my milling machine from my Off grid Photovoltaic system, from the batteries more exact, that s 600amp hours on 24v. I am gonna give it a try with P0.1,I0,D0 see what happens.(everything slowed down:-) ) I can see what u mean with the encoder after the gearbox, backlash is what I had in mind:) and I made sure that the gearbox from each motor diddnt have any noticable play on it

I uploaded 2 videos to google drive with videos of the pid tuning tool and z axis erratic behaviour https://drive.google.com/open?id=1jRwQhsOKyt0WeZdFfnS9Pzzm7uZ7SPew What are your toughts on z going down smooth and when lifting z all axes going crazy? Thank you.

misan commented 6 years ago

Well, if powered from batteries I guess juice is plenty (only if a too thin cable is used lack of power might be an issue).

PaulRobert1 commented 6 years ago

calbe is 4mm(diameter) silver coated they are rated at 70 amps, but the machine goes crazy only when i lift z:))) when i move x or y everything works well, check the video out when i lower z everything is smooth, when i lift z movement is not linear at all

misan commented 6 years ago

I saw the videos, Z axis up is surely creating some noise that seems to affect the rest, I do not see why noise and activation seems quite different than when going down. It may well be the motor's dead zone. Something I have not yet addressed in my project.

PaulRobert1 commented 6 years ago

coud it be encoder related( i have 2 adjustable resistors i think that s what they are called in english)

PaulRobert1 commented 6 years ago

hmm, gonna try to change the motor see what happens:)

misan commented 6 years ago

You can always try the motor/encoder without the load to see if that changes and the motor behaves better them

On Tue, Sep 25, 2018 at 11:53 AM PaulRobert1 notifications@github.com wrote:

hmm, gonna try to change the motor see what happens:)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/53#issuecomment-424279306, or mute the thread https://github.com/notifications/unsubscribe-auth/AAccyHCZizhS3k4Jb2ChtcJ7HJrYxQlqks5uef0QgaJpZM4W4J9k .

PaulRobert1 commented 6 years ago

gonna try that too

PaulRobert1 commented 6 years ago

Thank you very much for taking the time to help me out, i really diddnt expect such a fast and helpful response:D

misan commented 6 years ago

It is the least I could do considering the love you have put to the project

PaulRobert1 commented 6 years ago

Thank you 4 the kind words Misan:)

I have removed the z axis letting the motor run freely, and the erratic behaviour stops but starts as soon as i apply a little bit of force on the motor (bad brushes maybe) taking into account that these motors are from a salvage yard:) gonna put a new motor in, see what happens would ceramic capacitors on the motor leads help in filtering the ripple that is going on there?

PaulRobert1 commented 6 years ago

also tried switching polarity to the motor, same result, diffrent direction lmao

misan commented 6 years ago

maybe you can move z motor to x or y where hopefull less torque is needed ... ?

On Tue, Sep 25, 2018 at 12:37 PM PaulRobert1 notifications@github.com wrote:

Thank you 4 the kind words Misan:)

I have removed the z axis letting the motor run freely, and the erratic behaviour stops but starts as soon as i apply a little bit of force on the motor (bad brushes maybe) taking into account that these motors are from a salvage yard:) gonna put a new motor in, see what happens would ceramic capacitors on the motor leads help in filtering the ripple that is going on there?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/53#issuecomment-424291951, or mute the thread https://github.com/notifications/unsubscribe-auth/AAccyPTERLIjsRXa2P8lbjL3-uaVJG1Vks5uegdQgaJpZM4W4J9k .

PaulRobert1 commented 6 years ago

actually the z motor wich has screw and nut for movement requires the least torque, the other axes require 5 nm just to start moving

PaulRobert1 commented 6 years ago

Hello misan, i managed to get everything working, the noise was coming from a motor winding wich was tied to ground, fixed it, now I am still stuch at the PID tuning tool not displayng graph correctly:(( How can I fix that?

misan commented 6 years ago

Not sure what the problem could be. The graphical tool does issue an "S" command afer the motion. There are some built-in delays in the code that usually work, but if your system is too fast or too slow they might need to be adapted. The goal is for the data transmitted by the S command to fully finish before the graph is drawn.

Unfortunately, there is not much RAM on an Arduino, so only 999 points can be recorded. If memory serves, I think at 1ms per loop that is just 1 second for the whole move. If the sample move takes longer than that there is no way the current code will draw the full graph. You could try reducing the counts of the move from the existing value to its half to see if that helps.

On Thu, Oct 11, 2018 at 4:43 PM PaulRobert1 notifications@github.com wrote:

Hello misan, i managed to get everything working, the noise was coming from a motor winding wich was tied to ground, fixed it, now I am still stuch at the PID tuning tool not displayng graph correctly:(( How can I fix that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/53#issuecomment-428977557, or mute the thread https://github.com/notifications/unsubscribe-auth/AAccyLPEKW_8zdZUR6qXn7QCuwA_iO_Hks5uj1kYgaJpZM4W4J9k .

PaulRobert1 commented 6 years ago

Thank you very much, i am gonna try that, i l let u know how it works.

PaulRobert1 commented 6 years ago

what step time and step pulse time do u recommend in ns?

misan commented 6 years ago

@PaulRobert1 I expect step pulse time longer than 1uS. Not sure about the minimum acceptable time though.