PID -Hardware needed for a software fix

New Home Forum Mostly Printed CNC – MPCNC Hardware Development – MPCNC PID -Hardware needed for a software fix

This topic contains 458 replies, has 27 voices, and was last updated by  Guffy 3 weeks, 1 day ago.

Viewing 30 posts - 121 through 150 (of 459 total)
  • Author
    Posts
  • #53689

    Jeffeb3
    Participant

    Not to muddle the conversation, but I’ve been messing with TMC2130 drivers using the SPI interface and I think our LCD also uses SPI, so that might be another reason to try the ASCII ones.

    #53690

    SquidPlan
    Participant

    I doubt I have that kind of EE skill but after I get the 660 pimped out then I will crack open the 611. I guess it could be a possibility to use the built in speed control.

    I feel like an oscilloscope would be in order.  Those scare me.  😛

    #53694

    Ryan
    Keymaster

    Honestly I was very intimidated by the LCD stuff. In all the arduino stuff I had done I have never touched the LCD any more than just the marlin boot screen logo. I love learning something new and getting over my stupid fear. Admittedly the Ascii is probably as simple as it gets.

    I am going for a short hike then work on this some more.

    #53722

    Bill
    Participant

    So, now that you have speed control down pat … how feasible would it be to take one of our favorite routers and build a CNC lathe? I’m thinking of something suitable for wood (can you say ‘pool cue’?) and using conduit to allow for pieces in the 3-4 foot length and up to 4″ in diameter. My 7×14 mini-lathe is too small.

    1 user thanked author for this post.
    #53725

    JJWHarris
    Participant

    I’ve been thinking about CNC Lathes a lot lately, how hard could a 13″ metal lathe be…

    #53726

    JJWHarris
    Participant

    Does the router make less noise at a lower speed, or more noise?

    I’m after speed control on a motor that would run at a constant 200 rpm, the work happening here seems to fit into that idea perfectly, I was originally intending to use a 24V DC motor, but I feel like a mains power motor may run a bit more silently…Only issue is the motor is probably closer rated to 1750rpm, would something like that still work at lower speeds?

    #53732

    Ryan
    Keymaster

    CNC Lathes

    I know nothing about them. I have seen some crazy stuff but I guess I am going to need to look into them a little more. I can’t imagine anything being better than some sort of conversion though.

     

    JJ, they do make a lot less noise but the 660 is rated for 30k rpm and seems to not be very stable under 8k.

    #53735

    Johnny
    Participant

    For a lathe you are really going to have to slow things down. Now you are talking about spinning the work and moving the cutting edge which is held stationary. Going to need some serious rigidity, lots of torque, and slower speeds. And likely you will end up with a random electric motor and a gear drive to accomplish what you need. They are not complicated machines but there is a reason they are typically heavy. Thats a lot of mass thats spinning around vs with a router when the work is stationary and the moving mass is relatively light.

    #53783

    Bill
    Participant

    I visualize a MPCNC laid out with a 48″x6″ work area, no Y conduit in the center and two Xs 4″ apart (tied together so one pair of steppers, just like the MPCNC, or perhaps a lead screw and one stepper instead). There’s a platform on X that holds the cutter, and the cutter mount to the platform is where most of the rigidity is needed. No need for a Z axis, though you might do motor speed control with it. Y axis is likely belt driven, due to the length. Y axis moves using similar roller assemblies as the MPCNC, X likely uses linear bearings and smooth rod. DeWalt mount off center at one end and either uses gears or pulleys to divide speed into something reasonable, then uses the new PID controller for fine increments. Pulley/gear mounts on pillow block with bearings and other side has chuck with 0-4″ grip range. Other end has a drill style chuck to hold centering pin, drill bit or threading tap.

    I’m not sure how to get the software working, X axis moves ‘draw’ on both sides of the center at once. Depth of cut on X, so maybe we’re really looking at a Y and Z axis and carving a line that moves ‘up and down’.

    #53801

    Jeffeb3
    Participant

    So you’re saying there would be a spinning bit, and a spinning workpiece? And the bit would be on the side, the closer it got to the rotational center of the workpiece, the deeper it would cut?

    Cam would have to know what depth per pass it could cut and how fast it could travel on Y. Making it be Z would be easier, but you’d still have to be basically carving along a line, not along a surface.

    Something like you’ve drawn a line in CAD, with a certain depth profile. The CAM needs to travel along that line only, and not exceed a certain depth per pass, or speed along the line, or total depth for the profile… Hmmm. That’s a tough one. Maybe there’s a way to take a profile and easily make an STL that would work.

    If it was an XY design, then it would have to always start at the top, and not exceed a depth in X, which it has no constraint for so far.

    Maybe because it’s a single pattern, it could be done with some simple code instead of using EstlCAM or something.

    I don’t really understand why this needs PID speed control either. Are you planning on controlling the speed of the lathe? I have seen spinning lathes against spinning router bits before. I think that would take a lot of the guesswork and rigidity out of it. You’d still have a real mess if you ever dug too deep.

    #53832

    Bill
    Participant

    As Johnny says, there’s a lot of mass when spinning your work, especially when changing speed, but since the center of mass is pretty close to the center of your work piece in most situations the torque needed to keep it spinning is much lower. Either of our routers should have plenty of torque as long as we’re not trying to spin up a good sized stump.

    Of more importance is the design of the tool holder. You want as little flex as possible, so lots of back bracing.

    #53836

    Bill
    Participant

    No spinning bit, the router is used as the lathe motor. The bit is held against the spinning work piece and it’s the movement of the piece against the bit that cuts. think of a long skinny MPCNC layout except what’s normally the X axis is connected to the Z stepper. The center of your spinning piece is zero for the Z, the outside of your piece is your ‘top of piece’ for Z. You cut down Z in your normal increments and never need to move the X axis. At one end of your Y axis is the router, spinning the piece through gears or pulleys, at the other end is something that either holds the end steady or cuts in at Z zero.

    #53846

    Ryan
    Keymaster

    If you really wanted a lathe type machine a rotary axis on the MPCNC is pretty much ready to go with a 2 or 3 options on thingiverse already. Keep the endmill spinning fast and the material spinning slow.

    PID first (I hope), then I think I have a solid MPCNC update in mind, before I get to any new toys.

    #53853

    Ryan
    Keymaster

    Well I havn’t made any progress because I can’t freaking figure out how to get the dang code uploaded to github….grrrrr.  Using it like I always do but for some reason sourcetree won’t let me login to the new repo I created online. Sometimes stupid little things really put a damper on progress.

    #53854

    Jeffeb3
    Participant

    Sorry man. I don’t do windows. 😛

    1 user thanked author for this post.
    #53855

    Ryan
    Keymaster

    oh dude this is so irritating. I can do all my firmware stuff just fine….that has 1.453 million zillion files. The PID has 2 text files….I don’t get it. One more try this evening before I give up again.

    #53856

    Jeffeb3
    Participant

    One possibly helpful thing. When you make a new repo in github, it initializes it with license and readme files. If you created a new repo on your computer, then you’ve already got two branches without common ancestors. Try just creating the repo on GitHub, cloning it with your program to a fresh folder, and then copying your files there and adding/committing them there.

    #53858

    Ryan
    Keymaster

    That is how I started. Then no go. So I deleted the local stuff, started fresh, cloned the 2 docs. Tried to push a readme update, then a fork. No go on either. There is something wrong with the login from sourcetree to github. Or more likely I missed some sort of setting and can’t push.

    #53861

    Ryan
    Keymaster

    Fresh install of git solved the issue.

    Be gentle, it is a very slow work in progress.

    https://github.com/Allted/Router_PID

    #58152

    Tim
    Participant

    Is there a how to with step by step and wiring diagram or links ?

    #58153

    Jeffeb3
    Participant

    No. It’s not even done, AFAIK. So there aren’t any tutorials.

    #58158

    JJWHarris
    Participant

    I’m hopefully going to give this a crack once my parts arrive – I got all excited when I saw there was a new post!

    #58173

    thesfreader
    Participant

    I’ve started some tests now that I received my IR diode pairs, bu unfortunately have troubles getting reliable “low speed” measurements : it seems I pick-up many superfluous “turns” so… bad measures.

    Note that I tried at first on an Arduino UNO, and it was better, but switched to a Nano, and the problem is far worst. I’ll have to find out what’s happening… (Ordered a low cost ascilloscope, but need to wait a few weeks… will keep going in the meantime)

    Since I’m too bad an electronician, I don’t now how to rig the correct input filter (I suppose a resistor/capacitor pair should do the trick, but what values for them ?), so will probably test with getting analog measures and filter them on the software side.

     

    I also checked on my chinese 500W spindle’s PSU, and was prepared to reproduce Christian’s (ESTLCAM) electronic circuit to replace the speed pot with it, but measured that the input wasn’t 10V but 3V max.

    I used the left part of the circuit (resistor +capacitor) to get a filtered command from the PWM output (0-5v), but will need to get that down to 0-3v

    Once that’s done, I should be able to “command” the spindle, and measure it’s speed… and it’ll be time to insert the PID as Ryan did.

    And then it’ll be time to see on the CNC firmware what GCODE is best , and how best to forward it to the “PID controller” (a 255 steps PWM seems too lossy, perhaps use a “servo” signal” with its greater precision, or even an digital/serial transmission?)

     

    Lastly, check how / if it’s possible to get ESTLCam to generate the gcode for the spin RPM…

    (That’s if I don’t switch to other projects in the meantime…)

    #58186

    Ryan
    Keymaster

    unfortunately have troubles getting reliable

    That is why for now I am using the PCB mounted pair and the encoder disk. I am trying with the cleanest signal possible, then I will try and work out a smaller solution. The disk seems to give extremely consistent numbers, so I feel I have a baseline for ideal. Some sort of filtering/averaging will probably need to be added for the reflective sensors.

    I have a bit of a cold, so I might work on this today, I had planned on getting the toolbox build dirty but I think it will have to wait.

    Since I last posted I have an LCD working as well, and I think Heffe figured out my variable rounding issue. So as of now I can either refine the PID or integrate the LCD (or change to the oled).

    #58202

    Todd Hansen
    Participant

    If i wanted to use the AC dimmer module to control the speed of the spindle where would I pick up the 5v signal from the RAMBO board.  I was looking at using FAN2, but it is 12V.

    #58203

    Ryan
    Keymaster

    If you use marlin 2.0 there is a definable pin for speed/laser control. You pick the pin you want from the rambo wiki. Pretty sure in this thread I have pics and details of what I used.

    #58228

    JJWHarris
    Participant

    Has it possibly got something to do with the timing of the microcontroller?

     

    I’m looking at speed control for a record player and people are suggesting i use something like this http://esp32.net/#Features instead of an arduino due to the arduino having a low resolution/clockspeed

    #58231

    thesfreader
    Participant
    unfortunately have troubles getting reliable

    That is why for now I am using the PCB mounted pair and the encoder disk. I am trying with the cleanest signal possible, then I will try and work out a smaller solution. The disk seems to give extremely consistent numbers, so I feel I have a baseline for ideal. Some sort of filtering/averaging will probably need to be added for the reflective sensors.

    I have a bit of a cold, so I might work on this today, I had planned on getting the toolbox build dirty but I think it will have to wait.

    Since I last posted I have an LCD working as well, and I think Heffe figured out my variable rounding issue. So as of now I can either refine the PID or integrate the LCD (or change to the oled).

     

    I’ve got it ! Added a smallish capacitor (.75nF) between the IR receiver “signal” and ground, and if works flawlessly.

     

    No need to add an encoder ring anymore, the solution works really well.

     

    I’ll just update the code to try and get better reactivity by just computing frequency as inverse of time between two detections rather than counting the revolutions between two periodic updates (at which partial revolutions can have some impact).

    #58232

    Jeffeb3
    Participant

    I’ll just update the code to try and get better reactivity by just computing frequency as inverse of time between two detections rather than counting the revolutions between two periodic updates (at which partial revolutions can have some impact).

    I thought Ryan’s code already does that? Are you using his interrupts and everything?

    #58237

    thesfreader
    Participant

    Yes, indeed, Ryan’s code does just that (as I mentionned in a message that I mis-edited/deleted), but since I had troubles, I tried a few code changes/iterations before testing a “hardware” modification, especially since I don’t use (yet) the PID controller.

     

    Now that I have “feedback”, I should be able to switch to the “control” side of things. (Tomorrow ?)

     

    BTW, any thoughts on the 255 steps “resolution” for command ? Is it precise enough ?

     

    WRT Ryan’s code, now that I look at it more closely, wouldn’t it make more sense to have the PID work on RPMs rather than % of the max input ? Especially with the “discretized” input value, which could cause problems with big speed steps.

     

    I’d suggest to convert the  target PWM to a target RPM and use that as the setpoint, use the computed “optical” RPM as the input, and convert the output to PWM just before control  of the hardware.

     

    (But what I know of PIDs, I read on th Internet, so may be completely wrong)

Viewing 30 posts - 121 through 150 (of 459 total)

You must be logged in to reply to this topic.