PID -Hardware needed for a software fix

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

Tagged: 

This topic contains 472 replies, has 31 voices, and was last updated by  Ryan 2 days, 23 hours ago.

Viewing 30 posts - 241 through 270 (of 473 total)
  • Author
    Posts
  • #60403

    Ryan
    Keymaster

    If you wanted to go that far there is no extra cost in just bypassing it.

    #60404

    Kyle
    Participant

    Pretty much just remove the current controller & wire in the new controller, correct?

    #60412

    thesfreader
    Participant

    I got my PC back, but am busy working on my new MP3DP V2 printer instead… (And am quite frustrated with the sensor, waiting for an order…)

    #60415

    David Walling
    Participant

    Wow, guys…

    This is looking really good. Looking forward to a ‘buy it now’ button in the shop with everything ready to go 🙂

    1 user thanked author for this post.
    #60781

    Ryan
    Keymaster

    Nice giant box just showed up on my doorstep, feels good to get my hands on these finally!

    IMG_20180531_1145142

    #60783

    Jeffeb3
    Participant
    #60784

    Ryan
    Keymaster

    HAHAHAH, I really need to plug one in first. Need to test at least one of them. I pack a few boxes, answer some questions, plug in some wires, clean up my test bench……ahhhhhh too excited!

    I really need to make a little box, I really hate shocking myself so I need a cover. Gnarly PID box….

    #60786

    Jeffeb3
    Participant

    Didn’t you just say a giant box just showed up? Add some tape. Done!

    1 user thanked author for this post.
    #60787

    Ryan
    Keymaster

    Getting there.

    IMG_20180531_122019

    2 users thanked author for this post.
    #60801

    Ryan
    Keymaster

    Okay, the signal is great I had 60-840 as a best range out of a max 0-1024. The sensor wires will be passing directly between the AC switch wires so we will see if  or by how much the signal degrades. I don’t think more than a few hundred are needed since we are just looking for rising and falling edges.

    Todd, went with a cap inspired by you. Got the sensor closer, added a light baffle, and a place to cable tie it in. This allows for some adjustments if needed.

    IMG_20180531_1816452
    IMG_20180531_1813512
    Led closer to the center works better for me.

    IMG_20180531_1808073

    Sharpie and WhiteOut, seems to work better than the reflective decal. But I wan to revisit this now that I have a better light baffle in place.

    IMG_20180531_1803292

    #60807

    Ryan
    Keymaster

    IMG_20180531_1843342
    All tucked in.

     

    IMG_20180531_1842072
    Buttoned up, and ready for power.

     

    yeah-baby
    Yeah Baby, Clean signal!!!!!! Game on…

    #60817

    Bill
    Participant

    Now I really need it to show up in the shop. 🙂

    #60827

    Todd Hansen
    Participant

    COOL!

    Will have to fire up the 3D Printer and print a new cap as soon as you post it online.  I have all the parts and am ready to go.

    #60846

    Ryan
    Keymaster

    My bad, I thought I attached it.

     

    Wiring it up, commenting out the LCD stuff….Maybe a real test?

    Attachments:
    1. V1-660-PID.zip
    #60854

    Ryan
    Keymaster

    Dang it, the new sensor is not cooperating. Maybe the signal is not as clean as I had thought, it is routed right between two live power lines….

    #60856

    Ryan
    Keymaster

    Hmm. So this is the raw microsecond values it reads. This put it somewhere near 27,000rpm, wide open, no PID, hardwired.

    The little dips are messing with the PID. Capacitor or software filter? No idea.

    19200

    I would not know how to add a CAP to filter this kind of thing. I rerouted the wires a little bit and got an ideal signal.

    rerouted
    You if you watch it you can even see like an RPM resonance happen while it is wide open. The spikes still happen but not very often. Maybe some shielding…

    #60861

    Ryan
    Keymaster

    Okay, rerouted the wires even more. No glitches, max spikes +-250RPM @~27000, raw hardwired. Back to the PID now.

    #60862

    Todd Hansen
    Participant

    Do you think we may have to use shielded cable?

    Also hit the 3D printed cap with some flat black paint to cut down on the shine of the plastic.

    I also put some black paint on the Dewalt under the cap.  Need to keep the IR light  from bouncing around under the cap.

    Hope to change out my cap this weekend and will see how the data looks after to goes all the way back to my control box.

    May also try to find some shield cable.

     

     

    #60863

    Ryan
    Keymaster

    I moved around the wires and by itself it has a great signal.

     

    Drop the PID sketch back on it and it is horrible again. The raw time has random 12’s and 24’s, not even just the 1k drop outs. So I think there are some sketch issues. Not sure what is going on, or why it is different. I tried reading rising edge instead of falling, no different.

    Just in case I am cleaning up my test bench and moving all the cords to the same power strip and everything. It gets a little frantic and messy when the goal is so near.

    Soooooo, close…

    #60864

    Jeffeb3
    Participant

    Looking at the pic with the dips, you are looking at the processed value. The actual signal light be stuttering a little bit, causeing two quick edges. The simplest thing I can think of is a small median filter (software) on the microsecond values. If you keep the last 5 numbers, and drop the two highest and two lowest, you’ll be able to reject these outliers. Even a small filter on the input could also reduce the stuttering (a debounce circuit). That might eliminate the outliers completely.

    The median filter is a little tricky, because you need to keep the last 5 values (so, a circular buffer) and then sort them, without moving your buffer. It’s not rocket surgery though.

    #60865

    Jeffeb3
    Participant

    You can also cheat.

    If new measurement < old measurement * 0.05
    // Reject it.

    #60866

    Ryan
    Keymaster

    I think it is the sketch somehow. I have to run to the post office real quick but I am going to do a clean up of it (get rid of the LCD stuff), read the same values with the same variables, one just plain reading rising times, one with the PID loop (but not running on it). The values are too far off when the loop is running…but it wasn’t with the other sensor.

    I am sure you are right about a filter though. I just want to make sure the hardware is as proper as possible first.

    #60867

    Jeffeb3
    Participant

    Your sketch is just fast enough to catch it.

    #60868

    Ryan
    Keymaster

    Oh… so maybe limit the reading to no faster than Max RPM, plus a little overhead?

    Back from the PO and Cleaning it up now and trying without moving or touching anything.

    #60869

    Ryan
    Keymaster

    hmm….

    everything connected and powered up even if I am not using it. The issues are there. So a raw test next (solo board only the 3 sensor wires).

    testpid7

    This is a good sketch to test the filtering (or whatever solution) on I would think, the same but…naked. Dam I knew the encoder was better but not by this much.

     

    Attachments:
    #60872

    Ryan
    Keymaster

    The signal is kinda wonky only when the ground is connected between the rambo and the nano.

    #60873

    Jeffeb3
    Participant

    Yeah. This is a good test script, after you’ve cleaned it up enough to trip the interrupt.

    The 12/24 doesn’t bother me, but the 1100 does. That’s pretty far off of the mark.

    Why dont you bring it over to my shop and we’ll take a look 😉

    #60874

    Jeffeb3
    Participant

    The signal is kinda wonky only when the ground is connected between the rambo and the nano.

    Do you have a ground loop? Two ground wires connecting the same two grounds?

    #60877

    Ryan
    Keymaster

    Well, yes and no. Its a mess but it is as simple as I can get it I think.

    To test I have the rambo powered, USB to computer, ground and 2 signals to the nano. Bad things happen without the ground.

    The nano is also Usb to the next computer port, sensor wires, ground power signal to the dimmer. Dimmer is powered. All the power is in the same power strip.

    I can’t monitor the speed or signal but I did just try power to nano from the rambo (how it should be when finalized), no USB. Didn’t seem to help.

    Scope might help if I knew how to troubleshoot with one. I have about 1 hour worth of experience with one.

    #60878

    Jeffeb3
    Participant

    30000 RPM is 500rps or 2000us period. Ignoring anything that’s less than 1500 would be reasonable. It’s definitely strange that you’re getting an edge in the middle of a cycle. (The two 1100ish nimbers means it’s triggering twice, probably).

    I think a 5 element median filter makes sense. I’ll think about a clever way to implement one in arduino. Even if you fix your hardware issue, someone else will hit something similar. For now just cut out anything under 1500.

Viewing 30 posts - 241 through 270 (of 473 total)

You must be logged in to reply to this topic.