Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Building a DIY public domain low cost stepper motor analyzer

    Scheduled Pinned Locked Moved
    General Discussion
    10
    51
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JuKuundefined
      JuKu
      last edited by

      Thank you for this thread! It really shows how a simple tool used with intelligence gives a lot of insight.

      1 Reply Last reply Reply Quote 0
      • zaptaundefined
        zapta
        last edited by

        The firmware of the stepper analyzer proof of concept is done and the prototype has four functioning screens (see below) which demonstrate the viability of the hardware design. Next I will work on a PCB layout.

        Screen1: general information in text form (current in coils A.B, total steps, phase errors, etc)
        IMG-1726.JPG

        Screen2: histogram of time spent in each speed range (botton = slow, top = fast).
        IMG-1727.JPG

        Screen3: histogram of coil current vs stepper speed. Will indicate issues such insufficient power voltage or too high inductance, which cause lower currents in high speeds.
        IMG-1729.JPG

        Screen4: general signal waveforms of coils A (green) and B (red).
        IMG-1721.JPG

        1 Reply Last reply Reply Quote 3
        • zaptaundefined
          zapta
          last edited by

          Slowly slowly progressing with the stepper analyzer project. The PCB design is completed and I ordered it from a PCB house. Should arrive in a week or two. Snapshots of the schema and PCB are included below. The schema is straight forward, two current sensor, a Teensy 4.0 MCU module, small display, two buttons for user interaction and 4 dip switch for configuration (e.g. to reverse the step count direction). The dotted region includes optional stuff for firmware developers.

          PCB Layout
          stepper_analyzer.png

          Schema
          stepper_analyzer.pdf

          T3P3Tonyundefined 1 Reply Last reply Reply Quote 3
          • DocTruckerundefined
            DocTrucker
            last edited by

            Nice work. I need to read through this in detail, forgive me if the following is already answered.

            Does the detail of the plots change under acceleration vs deceleration? Any indication that lag or advance of the rotor may be delectable? I'm not talking about hundredths of a degree resolution, just and indication of where the rotor is relative to target on dynamic moves?

            Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

            zaptaundefined 1 Reply Last reply Reply Quote 0
            • T3P3Tonyundefined
              T3P3Tony administrators @zapta
              last edited by

              @zapta this is a great project! thanks for documenting it as you go through. Worth a submission to hackaday once complete I think!

              www.duet3d.com

              zaptaundefined 1 Reply Last reply Reply Quote 1
              • kraegarundefined
                kraegar
                last edited by

                Awesome project! Thanks for sharing!

                Co-Creator of the RailcoreII CoreXY printer
                https://www.thingiverse.com/thing:2407174

                1 Reply Last reply Reply Quote 0
                • JRDMundefined
                  JRDM
                  last edited by

                  This is neat. One time I thought of building a step motor dynamometer to compare motors by looking at their torque curves. I wish I followed through. Maybe that can be another module for this device?

                  1 Reply Last reply Reply Quote 0
                  • JoergS5undefined
                    JoergS5
                    last edited by JoergS5

                    This could be a good project for a electronic magazine (I mean as an article in the magazine with explanation): a useful topic for many users, nice images and a PCB project. Something like Elektor in germany.

                    1 Reply Last reply Reply Quote 1
                    • zaptaundefined
                      zapta @DocTrucker
                      last edited by

                      @DocTrucker said in Building a DIY public domain low cost stepper motor analyzer:

                      Does the detail of the plots change under acceleration vs deceleration? Any indication that lag or advance of the rotor may be delectable?

                      Good question. I don't know. I clearly observed that the current does not reach full amplitude when the speed was too fast that voltage and stepper combination but I don't know if the current signals are sufficient to detect missing steps.

                      1 Reply Last reply Reply Quote 0
                      • zaptaundefined
                        zapta @T3P3Tony
                        last edited by

                        @T3P3Tony said in Building a DIY public domain low cost stepper motor analyzer:

                        @zapta this is a great project! thanks for documenting it as you go through. Worth a submission to hackaday once complete I think!

                        Hi Tony, yes I plan to do that, to get more awareness. My goal is to provide a baseline hardware and firmware such that more knowledgable and creative people can use to provide useful tools for the community.

                        1 Reply Last reply Reply Quote 2
                        • zaptaundefined
                          zapta
                          last edited by

                          After procrastinating on this project for some time I realized that having to implement the UI with a low level screen API was distracting so I decided to switch to a smart touch display (Nextion 4.5") and things started to move fast. Here are a few pictures with the current state. Next I plan to redesign the PCB for the new LCD and clean up the UI.

                          The old PCB with connected to the new display:
                          f1eba650-5594-4108-9360-c8693898c6ca-image.png

                          The home screen with summary data:
                          f8589f7f-505b-43cb-aff8-5bb9543280c1-image.png

                          The setup screen. It allows to set the zero current and to reverse the steps direction.
                          3efd6fc5-1bbe-47df-921f-c62e53f94838-image.png

                          The distance graph. Graphs moves up/down in real time with the steps counter:
                          5afe5ebf-70c8-499d-8a37-c2d25e6a6f3a-image.png

                          Histogram of time by speed. I am thinking adding a similar screen with histogram of distance by speed.
                          014b6ada-9932-4f5a-9509-d35af6385854-image.png

                          Histogram of peak current vs speed. In this example, a 12V 1.2A stepper, the max current starts to drop at ~7000 steps per sec.
                          c6bf7903-760b-473f-8beb-529981f81762-image.png

                          A tachometer that shows speed in real time.
                          88a789db-11fc-46ed-8c83-a2b4b17d3508-image.png

                          A capture of the current signals in the two stepper coils. This one is at high speed with only 12V supply which resulted in poor current pattern, close to the speed limit of the system. (ideally the two signals should look like sine/cosine).
                          c98ab65d-745b-44fc-84fe-b137e89bc98a-image.png

                          JoergS5undefined 1 Reply Last reply Reply Quote 3
                          • JoergS5undefined
                            JoergS5 @zapta
                            last edited by

                            @zapta your project is very interesting. Can you tell me please whether you were able to analyse currents with microstepping and to which detail?

                            Thank you for pointing me to the ACS70331. I have a couple of ACS712, but they are much too slow.

                            I would like to analyze the correlation between step commands to the TMC, the created currents from TCM to stepper and the resulting movement of the stepper.

                            zaptaundefined 1 Reply Last reply Reply Quote 0
                            • zaptaundefined
                              zapta @JoergS5
                              last edited by zapta

                              Hi @JoergS5, think it shouldn't be too difficult to decode x16 microsteping. When going through a full step, the current in the two coils behave like the graph below. X16 can be achieved by breaking the cycle to x4, x2 and x2:

                              x4 - detection of a quadrant (90deg) is already already done and needed to determine the direction.

                              X2 - each quadrant can be divided int two (45deg each) by comparing the absolute value of the two channels.

                              X2 - each sub quadrant can be divided by 2 using the ratio of the high coil current to the low coil current.

                              I think this is straight forward and doable, given the two currents, and can also be come manually using the two current readings.

                              d008d56a-dc4f-4bec-857a-3b172052355a-image.png

                              BTW, I send the new PCB layout to manufacturing. Should arrive in a few weeks. It's a small 40x50mm board.

                              1344139d-7746-45bb-9d35-14aeda11a72c-image.png

                              All the source files are on github and should work though I plan to do some cleanup.

                              https://github.com/zapta/misc/tree/master/stepper_analyzer

                              Schema is in the link below. As you can see there is no much there:
                              https://github.com/zapta/misc/blob/master/stepper_analyzer/kicad/main/stepper_analyzer.pdf

                              JoergS5undefined fcwiltundefined 2 Replies Last reply Reply Quote 1
                              • JoergS5undefined
                                JoergS5 @zapta
                                last edited by JoergS5

                                @zapta Thanks for your information and the source location. Lucky me I bought a Nextion 3.5 last year, because I liked the idea that the display offers GUI logic, so I can start with your source.
                                It will take some time until I can start with the project, but I can keep you informed what I develop.

                                1 Reply Last reply Reply Quote 0
                                • fcwiltundefined
                                  fcwilt @zapta
                                  last edited by

                                  @zapta said in Building a DIY public domain low cost stepper motor analyzer:

                                  All the source files are on github and should work though I plan to do some cleanup.

                                  https://github.com/zapta/misc/tree/master/stepper_analyzer

                                  I don't see how to download all of the files related to this project.

                                  Does each file have to be downloaded separately?

                                  Frederick

                                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                  A Former User? 1 Reply Last reply Reply Quote 0
                                  • A Former User?
                                    A Former User @fcwilt
                                    last edited by

                                    @fcwilt easy way is to clone or download the whole https://github.com/zapta/misc repository.

                                    Alternatively you can turn to google to try and download just a sub directory from github

                                    fcwiltundefined 1 Reply Last reply Reply Quote 0
                                    • fcwiltundefined
                                      fcwilt @A Former User
                                      last edited by

                                      @bearer said in Building a DIY public domain low cost stepper motor analyzer:

                                      @fcwilt easy way is to clone or download the whole https://github.com/zapta/misc repository.

                                      Well that is certainly not the way I thought it would be done but if it works...

                                      Thanks.

                                      Frederick

                                      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                      A Former User? 1 Reply Last reply Reply Quote 1
                                      • A Former User?
                                        A Former User @fcwilt
                                        last edited by

                                        @fcwilt said in Building a DIY public domain low cost stepper motor analyzer:

                                        if it works...

                                        it does. but packing several projects into a single repo doesn't lend itself well to sharing or collaboration - but it is easy for a single user.

                                        anyways https://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo and other search results does provide options but to me its always seemed like more hassle than just getting the whole thing and discarding what I don't need/want.

                                        zaptaundefined 1 Reply Last reply Reply Quote 2
                                        • zaptaundefined
                                          zapta @A Former User
                                          last edited by

                                          @bearer said in Building a DIY public domain low cost stepper motor analyzer:

                                          it does. but packing several projects into a single repo doesn't lend itself well to sharing or collaboration

                                          Sorry about that. This is my catch all 'misc' repository. I plan to clean up the stepper analyzer in the next week or two so will also move to an independent repository.

                                          Meanwhile, if you encounter any problem, let me know here. I will monitor this thread more closely.

                                          Flushing the firmware has two parts, flashing the Nextion 3.5" using a micro SD card or the nextion designer with a serial port, and flashing the Teensy 4 which I currently do with the Arduino IDE (need to install the Teensy 4 extensions) but am looking for a simpler way (any suggestions?)

                                          A Former User? 1 Reply Last reply Reply Quote 1
                                          • A Former User?
                                            A Former User @zapta
                                            last edited by A Former User

                                            @zapta said in Building a DIY public domain low cost stepper motor analyzer:

                                            but am looking for a simpler way

                                            platformio? (for the teensy at least)

                                            zaptaundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA