# Closed Loop Stepper motor chatter at low speed causes?



## WobblyHand (Sep 17, 2022)

Not sure this is the right place to ask this question, but hope by posting here I may get answers from those with some motor control experience.

I have put together a home brewed ELS, using a 4 Nm closed loop stepper and the CL57T stepper driver, and a Teensy4.1 controller.  The kit is similar to url https://www.ebay.com/itm/2336693137...SSxR1aWitFAA6b/rSUMYchRYBhij|tkp:BFBMqpuhlOdg  I am using those parts.

The ELS seems to work fine, successfully cutting 16 and 40 TPI threads.  However, there seems to be an issue for slow feed rates at low RPMs.  It also occurs for 50-100 TPI threads at 100 RPM (spindle).  The stepper motor seems to chatter and make odd noises.  At first I thought there was something loose and rattling.  I have isolated it to the motor itself by removing the belt to the lead screw.  The motor itself is tightly screwed to the motor bracket which is securely fastened to the lathe.  It is not loose at all.  

Does anyone have an idea what might be causing it?  Any fixes that you know of?  The SteppersOnline site mentions current drive of 10mA on their optoisolator inputs.  I believe there is sufficient drive.  Besides, it works fine at 200-300 RPM.  The minimum pulse width on the driver is called out as 1us.  I am using 2us.  My driver current is set to "A" which is 5A RMS.  Selector SW S3 is 5V.  PUL-, DIR-, & ENA- are pulled down using a PN2222A transistor.  Base of transistor is driven by the Teensy @3.3V through a 2K resistor, which gives 1.25mA base drive.  Assuming a minimum beta = 10, yields a collector current of at least 12mA.  I am using the same configuration for drive as shown in Figure 5 of the driver datasheet.  My motor drive cable and closed loop encoder cable are widely separated after exiting the lathe.

I will check the pulse widths of my signals to confirm they are 2us.  Have to drag my oscilloscope down to the basement, but I may as well check off that box.  The chatter never showed up in testing on the bench, just on the lathe.  Thanks for any insights.

Other than that, I'm at a loss for the chatter.


----------



## markba633csi (Sep 17, 2022)

What microstep resolution are you using? Have you tried different ones?
-Mark


----------



## WobblyHand (Sep 17, 2022)

Using 8 microsteps.  Have not tried anything different yet.  

What's odd is that it worked on the bench, (attached to nothing) albeit with lower stepper current.  On the bench, the stepper would jump due to the torque if the spindle encoder moved quickly, so I dropped the current.  Low current mode stalls the motor when attached to the lead screw.  

8 microsteps works fine at full current at higher speeds.  The CL57T has all these darn physical switches, so it's nearly impossible to change stuff on the fly, using a microcontroller.  I can't change microsteps using my microcontroller, only by flipping physical switches, which is needed for coarse threads.


----------



## rabler (Sep 17, 2022)

No motor expert, but could this just be the physical characteristics of a stepper system?   You mention spindle speed being low, but what RPM is the stepper operating at? 8 microsteps is 1600 steps/revolution, how many steps per second is that when encountering chatter?  Each step is obviously a pulse of torque.  With low RPM,  low mass or high friction that step will result in a discrete position step.  With higher RPM, higher mass, less friction, or more microsteps, should give you smoother operation. 

Expanding on @markba633csi's comments, I would try configuring it for something like 64 microsteps (vs 8) to see if that helps.  Are you still using the three speed leadscrew gears?  Could you configure it to use a different one of those gears so that the stepper runs at higher RPM?  Either one would give you more steps/second.


----------



## WobblyHand (Sep 17, 2022)

Oscilloscope showed me that the wall wart power supply was the issue.  Voltage was very noisy.  Replaced the supply with an Apple cube 5V 1A supply, and voila, Everything works.  The noisy supply was falsely triggering the buffer and the Teensy was faithfully following the input.  Noise is much reduced.  Now I have fine feed at low and high RPM.  0.0025"/rev at 96 RPM and at 890 RPM.  Fine pitch threads work ok as well.  Happy dance time!  No more chatter at any speed.


----------



## ttabbal (Sep 17, 2022)

Glad you got it figured out. Power supply issues can be extremely annoying to find.

Nice job getting another option for ELS designs running. With the parts shortages, electronics has become a frustrating hobby. More options can only help.


----------



## WobblyHand (Sep 17, 2022)

It's interesting that I can stall the motor grasping the lead screw pulley for a second, but since it's a closed loop system as soon as I let go it jumped to position and kept on going.  Won't help on threading, indeed it would pooch the thread, but interesting nonetheless.


----------



## homebrewed (Sep 17, 2022)

WobblyHand said:


> The CL57T has all these darn physical switches, so it's nearly impossible to change stuff on the fly, using a microcontroller. I can't change microsteps using my microcontroller, only by flipping physical switches, which is needed for coarse threads.


Depending on the driver design (and PCB laiyout), you might be able to use optoisolators to set the state of those switches.  If they're SMT switches maybe not possible but it's worth taking a look at.  That is, if you feel comfortable modding your driver.


----------



## WobblyHand (Sep 17, 2022)

homebrewed said:


> Depending on the driver design (and PCB laiyout), you might be able to use optoisolators to set the state of those switches.  If they're SMT switches maybe not possible but it's worth taking a look at.  That is, if you feel comfortable modding your driver.


New CL57T's are listing for ~ $60.  When I bought it (this summer!) was $48 or so.  Might be worth opening the box to take a look.  What I won't find out from looking at the PCB is when the switches are read by the internal CL57T controller.  Could be they are sampled at startup only - that wouldn't help me.  Only way to find out is to try, I guess.  

The ModBus stepper motor controllers are much more flexible, but cost ~ $140.  They can change micro step settings via RS485 message.  Seems like a big up-charge for something not that tough to implement.  What's a bit difficult - is wading though the parameter lists.  All I really want to change (for now) is the micro step settings.  The large pitch (low TPI) screws need micro step = 4, so that N/D (the Bresenham ratio) is less than 0.5.  Everything else runs comfortably with a micro step setting of 8.


----------



## WobblyHand (Sep 17, 2022)

Have some old slow 4N35 opto couplers.  Switch times in 10's of us, if I am lucky.  Should be fine for changing pitches, as we are in setup mode and the stepper is disabled.  Guess I would have to wire in two opto channels to change from 4 usteps to 8 usteps.  According to the CL57T driver datasheet, using STANDARD binary MSb on the left, the settings are:

SW4 SW3 SW2 SW1

ustep 1   0000b
      4   0001b
      8   0010b

Think I will open up the driver box.  It's not like I think there's a real warranty on these stepper drivers.


----------



## WobblyHand (Sep 17, 2022)

Opened the box.  They painted over the part number for the processor, but that's pretty much normal.  The power devices are on the bottom of the board and sandwiched against the heat sink plate.  To take up the gap, they inserted an extra slice of insulator.  The transistors are NOT physically attached to the heat sink with a fastener.  Hey, that would be old school and cost a screw and a plastic insulator.  So they saved 8 screws and 8 insulators.  Otherwise, the board looks nice and dense.  The dip switch is through hole.  There's also a programming connector that was blocked by the cover.  I presume that is how they flashed the processor.  4 pins.  To get to the back side of the board, I have to disturb the driver transistors and the thermal paste, if there is any.  I will loosen the 5 screws and see what happens...  First need to put on an anti-static strap.  You can see the anti-static mat.  Well, it just lifts right off!  Not much thermal compound there, but it does look like they used some kind of thermal compliant insulating mat.



You can see it is a Ledshine CL57C V2.1 board.  Hey, it's right on the silkscreen.  On the top left side of the board is the dipswitch and its associated resistors.  They look like 0603's.  They are 4.7K ohm.  The signal side, I think, is on the right side.  Going to be tough to shoehorn the isolator in on the bottom side.  Only have 4.8mm between the board and the case.  Plus I need to come up with a connector with 4 pins for the diodes and somehow mount it.  Would be a tricky packaging job.  But the circuit is easy.  Short across the pins horizontally.  Need an SMT opto, with a height under 3.6mm.  I could dead bug it.  A standard DIP package is a bit thick.


----------



## homebrewed (Sep 17, 2022)

WobblyHand said:


> Opened the box.  They painted over the part number for the processor, but that's pretty much normal.  The power devices are on the bottom of the board and sandwiched against the heat sink plate.  To take up the gap, they inserted an extra slice of insulator.  The transistors are NOT physically attached to the heat sink with a fastener.  Hey, that would be old school and cost a screw and a plastic insulator.  So they saved 8 screws and 8 insulators.  Otherwise, the board looks nice and dense.  The dip switch is through hole.  There's also a programming connector that was blocked by the cover.  I presume that is how they flashed the processor.  4 pins.  To get to the back side of the board, I have to disturb the driver transistors and the thermal paste, if there is any.  I will loosen the 5 screws and see what happens...  First need to put on an anti-static strap.  You can see the anti-static mat.  Well, it just lifts right off!  Not much thermal compound there, but it does look like they used some kind of thermal compliant insulating mat.
> View attachment 420612
> View attachment 420613
> 
> You can see it is a Ledshine CL57C V2.1 board.  Hey, it's right on the silkscreen.  On the top left side of the board is the dipswitch and its associated resistors.  They look like 0603's.  They are 4.7K ohm.  The signal side, I think, is on the right side.  Going to be tough to shoehorn the isolator in on the bottom side.  Only have 4.8mm between the board and the case.  Plus I need to come up with a connector with 4 pins for the diodes and somehow mount it.  Would be a tricky packaging job.  But the circuit is easy.  Short across the pins horizontally.  Need an SMT opto, with a height under 3.6mm.  I could dead bug it.  A standard DIP package is a bit thick.


Dead bug is handy for this kind of thing.  

You lucked out with the through-hole DIP switch, so hopefully the processor regularly checks the state(s) of the switches.  Before making it nice and pretty-looking I'd do a quick manual test with the DIP switches to see if you can change the microstepping settings on the fly.  That should be easy enough to do.

You may not need to mount the optoisolator on the back of the board.  I see a couple of unused through-holes next to what is probably the processor (the quad leaded package).  They're probably large enough in diameter to feed a couple of wire-wrap wires through each one.  If not, you could remove the center brass standoff and feed wires through that hole.  If there's space between the PCB and side of the enclosure that would be another option.


----------



## homebrewed (Sep 18, 2022)

It appears that some versions of that stepper driver also have an RS232 interface.  According to the data sheet I found, it can be used to control microstepping, uh, things.  I said "things"  because the data sheet was _extremely_  sketchy regarding that interface.  Like not offering a single word on what what the commands are, or how they're formatted.  What a tease, eh?

I note a white connector just below the DIP switch.  I think that's where the RS232 connection may be.  But the DS I found indicates it's a 6-pin connector while yours just has 4 pins (based on what I see on the bottom of the PCB).


----------



## WobblyHand (Sep 18, 2022)

Reverse engineering ICD's is not one of my strong points.  The only possibility I see is to snoop the serial lines while exercising their Windows tool.  Even that doesn't tell you everything.  The connector appears to be 4 pins.  It would be great to control micro stepping, that's really the only extra feature that I need.  Otherwise, my controller (Teensy) doesn't know what the ustep settings are.  Unpredictable results are not good for an ELS.


----------



## RJSakowski (Sep 18, 2022)

WobblyHand said:


> Opened the box.  They painted over the part number for the processor, but that's pretty much normal.  The power devices are on the bottom of the board and sandwiched against the heat sink plate.  To take up the gap, they inserted an extra slice of insulator.  The transistors are NOT physically attached to the heat sink with a fastener.  Hey, that would be old school and cost a screw and a plastic insulator.  So they saved 8 screws and 8 insulators.  Otherwise, the board looks nice and dense.  The dip switch is through hole.  There's also a programming connector that was blocked by the cover.  I presume that is how they flashed the processor.  4 pins.  To get to the back side of the board, I have to disturb the driver transistors and the thermal paste, if there is any.  I will loosen the 5 screws and see what happens...  First need to put on an anti-static strap.  You can see the anti-static mat.  Well, it just lifts right off!  Not much thermal compound there, but it does look like they used some kind of thermal compliant insulating mat.
> View attachment 420612
> View attachment 420613
> 
> You can see it is a Ledshine CL57C V2.1 board.  Hey, it's right on the silkscreen.  On the top left side of the board is the dipswitch and its associated resistors.  They look like 0603's.  They are 4.7K ohm.  The signal side, I think, is on the right side.  Going to be tough to shoehorn the isolator in on the bottom side.  Only have 4.8mm between the board and the case.  Plus I need to come up with a connector with 4 pins for the diodes and somehow mount it.  Would be a tricky packaging job.  But the circuit is easy.  Short across the pins horizontally.  Need an SMT opto, with a height under 3.6mm.  I could dead bug it.  A standard DIP package is a bit thick.


I am using the CL57T driver and it has an RS232 port for external programming, microsteps being one of the parameters available. This may be an easier route for you.


----------



## WobblyHand (Sep 18, 2022)

RJSakowski said:


> I am using the CL57T driver and it has an RS232 port for external programming, microsteps being one of the parameters available. This may be an easier route for you.


You wouldn't happen to know what the actual serial commands are, would you?  The actual byte string?  I have V4.0, as marked on the outside of the case.  If I could do that, it would be great, as that is easy.  Is there a command to check the microstep settings, in other words a read back?  Does one need to make the ustep setting, and then "tell the stepper controller" that the setting should be implemented?  Or does the command alert the stepper controller to change the setting "automatically".

I found a MS10E.rar on the StepperOnline website.  Inside the rar file, it contains CLSeries_setup.exe.  I would need to run WINE on Linux to try this.  Don't have WINE installed on this PC, but could do so.  However, for a standalone ELS, I would have the Teensy serial port communicate with the stepper controller.  That's why I am asking about serial commands and byte strings.

Do you know the connector pin out?  Is it 3V serial, or really RS232 with bipolar levels?  From looking at the PCB, I suspect the processor is 3.3V because there's a 3.3V regulator on board, the AMS1117-3.3.


----------



## homebrewed (Sep 18, 2022)

WobblyHand said:


> You wouldn't happen to know what the actual serial commands are, would you?  The actual byte string?  I have V4.0, as marked on the outside of the case.  If I could do that, it would be great, as that is easy.  Is there a command to check the microstep settings, in other words a read back?  Does one need to make the ustep setting, and then "tell the stepper controller" that the setting should be implemented?  Or does the command alert the stepper controller to change the setting "automatically".
> 
> I found a MS10E.rar on the StepperOnline website.  Inside the rar file, it contains CLSeries_setup.exe.  I would need to run WINE on Linux to try this.  Don't have WINE installed on this PC, but could do so.  However, for a standalone ELS, I would have the Teensy serial port communicate with the stepper controller.  That's why I am asking about serial commands and byte strings.
> 
> Do you know the connector pin out?  Is it 3V serial, or really RS232 with bipolar levels?  From looking at the PCB, I suspect the processor is 3.3V because there's a 3.3V regulator on board, the AMS1117-3.3.


The setup program might create a .ini file that contains relevant information.  That makes more sense than hard-coding the information in the executable:  but you never know.  Another option is to look through your oscilloscope manual.  Some can decode common serial data streams, which would make that part of the reverse-engineering somewhat easier (hopefully!).  For the latter approach you will need WINE.

That doesn't answer your question regarding the connector pinout.  But they sell an RS232 cable for not much: here. I think you know where to go from there


----------



## RJSakowski (Sep 18, 2022)

WobblyHand said:


> You wouldn't happen to know what the actual serial commands are, would you?  The actual byte string?  I have V4.0, as marked on the outside of the case.  If I could do that, it would be great, as that is easy.  Is there a command to check the microstep settings, in other words a read back?  Does one need to make the ustep setting, and then "tell the stepper controller" that the setting should be implemented?  Or does the command alert the stepper controller to change the setting "automatically".
> 
> I found a MS10E.rar on the StepperOnline website.  Inside the rar file, it contains CLSeries_setup.exe.  I would need to run WINE on Linux to try this.  Don't have WINE installed on this PC, but could do so.  However, for a standalone ELS, I would have the Teensy serial port communicate with the stepper controller.  That's why I am asking about serial commands and byte strings.
> 
> Do you know the connector pin out?  Is it 3V serial, or really RS232 with bipolar levels?  From looking at the PCB, I suspect the processor is 3.3V because there's a 3.3V regulator on board, the AMS1117-3.3.


I was looking for the program that I used.  I believe it is the same as in CLSeries_setup.rar.  I'm no expert on this but it seems that setting the dip switches to 0000 allows software control of the driver.


----------



## WobblyHand (Sep 18, 2022)

homebrewed said:


> The setup program might create a .ini file that contains relevant information.  That makes more sense than hard-coding the information in the executable:  but you never know.  Another option is to look through your oscilloscope manual.  Some can decode common serial data streams, which would make that part of the reverse-engineering somewhat easier (hopefully!).  For the latter approach you will need WINE.
> 
> That doesn't answer your question regarding the connector pinout.  But they sell an RS232 cable for not much: here. I think you know where to go from there


It seems like a good deal until you click on the shipping.  $1.71 for the cable, $20.84 for shipping from China!  Cable is $4.27 in Germany, but no shipping options.  Can't seem to find the cable online elsewhere, yet.


----------



## homebrewed (Sep 18, 2022)

Oh, there's another possible route to at least getting some information on the commands used.  If they _are_ hard-coded in the executable it's very likely they are in a table that includes the ASCII commands.  This is where the "dd" command-line utility could be your friend.  That's very definitely hacker territory but could be useful to verify analysis results if you're monitoring the serial data stream.


----------



## WobblyHand (Sep 18, 2022)

RJSakowski said:


> I was looking for the program that I used.  I believe it is the same as in CLSeries_setup.rar.  I'm no expert on this but it seems that setting the dip switches to 0000 allows software control of the driver.


Do you have the cable that is used?  Where did you get it?  SteppersOnline wants $1.71 + $20.83 for shipping.  I have bought lots of stuff from China, and the shipping they are charging is a super premium rate.  I don't need it overnight!  They don't seem to have the cable on their eBay Store.  Do you know how it is wired?  It's only 4 pins.


----------



## WobblyHand (Sep 18, 2022)

homebrewed said:


> Oh, there's another possible route to at least getting some information on the commands used.  If they _are_ hard-coded in the executable it's very likely they are in a table that includes the ASCII commands.  This is where the "dd" command-line utility could be your friend.  That's very definitely hacker territory but could be useful to verify analysis results if you're monitoring the serial data stream.


I used gHex to look inside the setup file, but didn't find anything obvious.  Probably need to run it in WINE to let it create an ini file, then snoop around.  I'm not sure how I would use dd for internal file inspection.  Looking through a hex file is not my idea of fun.  

Played around with grep and strings.  Nothing found, but not sure I was doing it right either.

Have no idea if this is a 32 bit app or 64.  No idea which wine to install.


----------



## RJSakowski (Sep 18, 2022)

WobblyHand said:


> It seems like a good deal until you click on the shipping.  $1.71 for the cable, $20.84 for shipping from China!  Cable is $4.27 in Germany, but no shipping options.  Can't seem to find the cable online elsewhere, yet.


I made my own cable.  I spliced an RJ45 cable to a DB9 serial cable.  I'll find the cable and figure the pinout.


----------



## RJSakowski (Sep 18, 2022)

RJSakowski said:


> I made my own cable.  I spliced an RJ45 cable to a DB9 serial cable.  I'll find the cable and figure the pinout.


I misremembered.  It is an RJ11.  I rung the pins and it appears the cable conforms to the pinout in the user manual; Pin 2 wasn't connected.


----------



## WobblyHand (Sep 18, 2022)

RJSakowski said:


> I misremembered.  It is an RJ11.  I rung the pins and it appears the cable conforms to the pinout in the user manual; Pin 2 wasn't connected.
> 
> View attachment 420690


Thanks for the pin out.  My connector is not RJ11.  It only has 4 pins.  Are the signals actually RS232 levels?  +/-10V, +/-5V or are they 0-3.3V?


----------



## RJSakowski (Sep 18, 2022)

WobblyHand said:


> Thanks for the pin out.  My connector is not RJ11.  It only has 4 pins.  Are the signals actually RS232 levels?  +/-10V, +/-5V or are they 0-3.3V?


My driver is buried deep on my cabinet so I can't examine the RS232 port.  Only four pins are used, actually so a standard RS11 phone connector worked.  I used on that had come with a DSL modem.  As to voltages, I can't comment except to say that the driver interfaced with the serial port on my old Win XT computer. I was not able to connect via a USB to RS@#@ adapter.  There is more detail here, starting at post 263. https://www.hobby-machinist.com/threads/electronic-lead-screw.76101/page-27

Do you have a user manual for the driver?  All those that I have seen online show an RJ11 jack.


----------



## homebrewed (Sep 18, 2022)

WobblyHand said:


> I used gHex to look inside the setup file, but didn't find anything obvious.  Probably need to run it in WINE to let it create an ini file, then snoop around.  I'm not sure how I would use dd for internal file inspection.  Looking through a hex file is not my idea of fun.
> 
> Played around with grep and strings.  Nothing found, but not sure I was doing it right either.
> 
> Have no idea if this is a 32 bit app or 64.  No idea which wine to install.


dd is good for this because you can tell it to dump the stuff it finds in a file as ASCII characters.  Looking at hex equivalents, not so good.


----------



## WobblyHand (Sep 18, 2022)

homebrewed said:


> dd is good for this because you can tell it to dump the stuff it finds in a file as ASCII characters.  Looking at hex equivalents, not so good.


In my defense, gHex does convert hex to readable characters in the right side of the screen.  Other tools also didn't show any character strings with "serial" in it.


----------



## WobblyHand (Sep 18, 2022)

RJSakowski said:


> My driver is buried deep on my cabinet so I can't examine the RS232 port.  Only four pins are used, actually so a standard RS11 phone connector worked.  I used on that had come with a DSL modem.  As to voltages, I can't comment except to say that the driver interfaced with the serial port on my old Win XT computer. I was not able to connect via a USB to RS@#@ adapter.  There is more detail here, starting at post 263. https://www.hobby-machinist.com/threads/electronic-lead-screw.76101/page-27
> 
> Do you have a user manual for the driver?  All those that I have seen online show an RJ11 jack


I have a manual for the CL57T hardware.  I have been unable to find any written documentation for the software, only the exe file.  I will have to install wine so I can install the software.  However, I did take the driver apart and there is only one possible connector that it can be.  It is unlabeled and behind a breakaway plastic tab.  The implication is this is a test connector only.  It is not an RJ11 or telephone like connector.  It has male pins.


----------



## ttabbal (Sep 18, 2022)

For getting strings from the program, you probably need to install it first and look at the exe/dll files it leaves. If I remember correctly, Linux boxes generally have a program installed named "strings" or "string" that pulls the ascii data out as well. Setup files are usually compressed, so you can't get much from the raw setup fine. 

Try asking the vendor. Sometimes they have info that they didn't think people would ever want or shipping options perhaps.

For the connections, two of the pins are probably power/ground those usually go straight to power planes. The other two are likely RX/TX for serial, probably vcc/vdd levels as that's so common with microcontrollers. If you can get the real cable, use your scope to verify the logic levels. The cheap logic analyzers are handy for this as well. You might even get lucky and catch handshake pulses on one of the lines. That would tell you levels as well. 

Or it could be a ICSP port or something else entirely. Given that it would be accessible while assembly is in progress, and the 4 pins, makes me think it's probably serial though.


----------



## RJSakowski (Sep 18, 2022)

This is the manual that I have for my driver.  https://www.omc-stepperonline.com/download/CL57T.pdf  Section 3 on page 2 shows the location of P4, the serial interface.  Further searching online, I see that the current driver is v4..0 which doesn't have an RS232 port. https://docplayer.net/229887688-Cl5...rd-of-revisions-aug-2019-initial-release.html

I wonder if the user inaccessible port on your driver is a serial port.


----------



## WobblyHand (Sep 19, 2022)

RJSakowski said:


> This is the manual that I have for my driver.  https://www.omc-stepperonline.com/download/CL57T.pdf  Section 3 on page 2 shows the location of P4, the serial interface.  Further searching online, I see that the current driver is v4..0 which doesn't have an RS232 port. https://docplayer.net/229887688-Cl5...rd-of-revisions-aug-2019-initial-release.html
> 
> I wonder if the user inaccessible port on your driver is a serial port.


I don't know for sure what it is.  It's 4 pin horizontal PCB mount.  The connector is present, but the assembly housing has a knock out cover which blocks access.  I suspect that it's either serial, or it could be a real debug port direct to the microcontroller.  I need to power up the board with it all taken apart and probe it.  I think that it may be 3.3V level serial.  If it was never intended to be used by customers, they probably would have made a solid housing blocking access.  The knock out is clearly removable and the connector is visible from the outside.


----------



## WobblyHand (Sep 19, 2022)

ttabbal said:


> For getting strings from the program, you probably need to install it first and look at the exe/dll files it leaves. If I remember correctly, Linux boxes generally have a program installed named "strings" or "string" that pulls the ascii data out as well. Setup files are usually compressed, so you can't get much from the raw setup fine.
> 
> Try asking the vendor. Sometimes they have info that they didn't think people would ever want or shipping options perhaps.
> 
> ...


I've used the string command.  Used it to look inside the setup exe.  Nothing obvious there.  Need to install the program so it unpacks the program.

Have a two channel scope so verifying levels is easy.

Vendor seems to be cagey, at least publically.  I will send them an email about this.  They do offer software, so there has to be some info somewhere.


----------



## RJSakowski (Sep 19, 2022)

Can you contact either Leadshine or StepperOnLine for some help?  It appears that V4.0 came out around 2019 so it's been around for a while.  Possibly a query to CNC Zone might bring up some info. https://www.cnczone.com/forums/leadshine/


----------



## WobblyHand (Sep 19, 2022)

RJSakowski said:


> Can you contact either Leadshine or StepperOnLine for some help?  It appears that V4.0 came out around 2019 so it's been around for a while.  Possibly a query to CNC Zone might bring up some info. https://www.cnczone.com/forums/leadshine/


Sent a direct email to technical support at StepperOnline.  Hope to get a response.


----------



## homebrewed (Sep 19, 2022)

WobblyHand said:


> In my defense, gHex does convert hex to readable characters in the right side of the screen.  Other tools also didn't show any character strings with "serial" in it.


I guess thel commands sent to the driver don't HAVE to be human-readable, do they?  Maybe they're more like g code.....designed to make it easy for the firmware at the receiving end to understand..  If so, the turning lemons into lemonade argument is that the protocol might be a little easier to reverse-engineer.  Maybe


----------



## WobblyHand (Sep 19, 2022)

I only need to change micro stepping for 8 to 4 for one or two threads.  All others can be cut using ustep = 8.  

The holdout threads are 4 TPI and under, as well as 6 mm pitch and over.  I redid my thread tables, using a GCD function to make the numbers look more readable.  4 TPI makes N/D > 1 using ustep = 8 (N=150, D=128).  I can do 5 TPI, just not 4 TPI for ustep=8.  I can do 5mm pitch, but not 6mm for ustep = 8.  (5mm N=15, D=16, good)  (6mm, N=1125, D=1016, bad)  Practically speaking, for a G0602/G0752, not sure I could even cut such a coarse thread without problems.  I did cut 8 TPI internal threads using gears though.

Until I come up with a solution to remotely changing the stepper driver ustep settings, I will not enable 4 TPI or 6mm threads.  Giving up these threads is not much of a problem for me.  Coarser threads probably require significantly more torque from the stepper as well.  I chose a 4Nm stepper, and I can stall it if I grasp the pulley, so its not like there are buckets of torque available.

Not sure I'd want to cut a 1 TPI thread, even if I could do it, at least not without gearing my spindle motor to a crawl!  Currently my slowest spindle RPM is about 100 RPM.  That's darn quick for coarse threads!


----------



## rabler (Sep 19, 2022)

homebrewed said:


> dd is good for this because you can tell it to dump the stuff it finds in a file as ASCII characters.  Looking at hex equivalents, not so good.


My goto for this is _od -h -a_
You get both.  May need to fiddle with options to get good formatting.

edited to add:  looks like Ghex gives something very similar.  My Unix/Linux is just dated.  But I had to smile thinking of all the uses of 'dd' I've encountered over the years.


----------



## ttabbal (Sep 20, 2022)

Yeah, "dd" is the Swiss army knife of Linux. You can do most anything with that stupid thing. Many of them ill advised and dangerous, but you can..


----------



## WobblyHand (Sep 20, 2022)

Got a response from StepperOnline.  However, it's not encouraging.  I sent back a response.  Hopefully there will be a dialog, but I'm not holding my breath.

Found a work around for the micro-step programmability problem.  If I judiciously up the rotary encoder resolution, I will be able to get down to 4 TPI without having to change the micro-step value.  Then I can cut from 4-100 TPI and 0.2mm - 6mm pitch.  It costs me another encoder, which seem to be going on eBay for about $35-$40.  Not sure it is worth it, but it is a solution.  The required resolution would be an encoder marked 1500.  I have a 1024.  Missed it by that much...


----------



## WobblyHand (Sep 21, 2022)

Second response from Stepper Online China wasn't encouraging either.  Claimed it was not possible to change micro step settings via this port.  The answer was in not well formed English, so perhaps it is true, or there's a communication problem.  Or as customer service they are trained to up sell to a unit that does offer the ability.  In this case there was no up sell, just a comment, to paraphrase, "unit can't do that".  They never told me pin out or voltage levels.  Just feels like a language issue. 

They ended with "if you have any questions, please ask".  I did, but didn't get all the answers, nevermind the ones I wanted to hear.  Don't think this is a company that you go to that caters to hobbyist requests.  Probably need to spend the big bucks at a domestic firm to get support. At least they will tell you point blank that what you want can't be done that way, but here's a different way to do it.

Let's say this approach is looking less likely.  I could deadbug something and try it just for the heck of it.  Or at least connect the port pins to the oscilloscope for a quick look.  Don't think 4 TPI is worth the hassle of engineering a good solution at the moment on a G0602/G0752Z.  May change my mind later, should the need arise.


----------



## ttabbal (Sep 21, 2022)

That's too bad. It would be nice if these places would be willing to give out info, but many places seem to think it's a competitive advantage or something. I don't see how, it's not like there's some mystery in driving steppers. 

On the other hand, I don't think I've ever wanted a 4 TPI thread. So I guess I wouldn't feel like I was losing anything. Of course, I can't speak for you or anyone else. And at least you know you CAN get it if you need it, it's just a pain. One possibility might be to use the gearbox on the machine if you have one. My PM1127 has a 3 speed selector. If you have an option for x2 or /2 you might be able to switch it and set the ELS for the multiple of what you want. The downside is that I would forget I did that and spend hours wondering why the next thread is so wrong...


----------



## WobblyHand (Sep 21, 2022)

ttabbal said:


> The downside is that I would forget I did that and spend hours wondering why the next thread is so wrong...


This ^^^  

I would forget the settings as well.  If I had sensor feedback to my controller with the gear box settings, it would be ok.  But I forget my name in the morning, so an open loop design is not good for me.  Basically, I am limited to 6 TPI and higher.  That's not terrible.

Another way of solving the problem is to increase the encoder resolution a little.  1500P/R will give me 4 TPI, and 6mm.  I have 1024P/R.  1024 will do 5 TPI and higher. (5mm pitch and lower)

The eBay purveyors of these encoders usually don't know what they are selling.  Or they know they are selling 2nds, but aren't telling you.  I am looking at a 1500P/R encoder, but the picture is unclear, and I can't tell what I am purchasing.  The listing is for 1500P/R, but the picture, and the product could be 50P/R, the picture is that out of focus.  

The "1500P/R" encoder costs $44.  May be inauthentic, a kind way of saying counterfeit.  Is 4 TPI and 6mm worth that?  Not at the moment. I was looking for a cheap way to get a little more range in threading.  Haven't found that cheap way yet, so I will stay put for now.


----------



## jwmelvin (Sep 21, 2022)

WobblyHand said:


> If I had sensor feedback to my controller with the gear box settings, it would be ok.



Seems like this approach would be about as straightforward as trying to dynamically change the microstepping. Also, your system depends on the gearbox being in a certain setting, so confirmation of that setting would be nice. Once you sense one gear, sensing another is pretty trivial.


----------



## WobblyHand (Sep 21, 2022)

jwmelvin said:


> Seems like this approach would be about as straightforward as trying to dynamically change the microstepping. Also, your system depends on the gearbox being in a certain setting, so confirmation of that setting would be nice. Once you sense one gear, sensing another is pretty trivial.


Exactly. It also assumes that the gear box actually has the correct ratio!  I haven't even checked if the gear box has favorable ratios for this.

Doesn't seem like it is worth the effort for a hobbyist on a 10 x 22 lathe.  Lots of effort for a minimal benefit.  Was trying to see if adding capability  was practical for me to do.  Don't see that it makes sense right now.  My ELS is supposed to be a simple add on that gives some improvements over the traditional geared way.  A base G0602 won't do less than 8 TPI, at least with the provided gearing and QCGB.  I can actually do 5 TPI and up electronically, without touching a gear box or touching gears, so that is not too bad.

Due to screen size limitations, (320x240 pixel display) I can only fit 25 pitches on a screen at a time.  Could go denser, but then it becomes very difficult for a finger press to select the correct pitch.  The fatter your finger, the harder it would be to select a pitch.  Would not want to rely on the use of a stylus.  I haven't implemented a secondary screen for pitches, just simply because its work.  The 25 values I chose cover everything that I have ever run into.  However, there's no reason that the table couldn't be edited to replace a value.

I suppose if I worked at it, I could implement a user input thread.  The problem with that is there are a lot of checks you need to do to avoid non-integer values.  For the moment, I have implemented Bresenham using integer math.  It is fast, just the thing you need to do in an interrupt service routine.  Going to float would slow things down a bit.  At 2000 RPM with my current encoder, there is 7.3us per interrupt.  (136kHz)  I rarely have even operated the lathe that fast.  Usually 1/2 that speed and down near 100-300 for threading.  

The custom thread algorithm would run when the spindle is off, or we are no longer tracking the spindle.  (I can disable the encoder) The algorithm would have to do all those non-integer value tests.  A lot of the fudges and workarounds are really easy to see as a human, but tough to implement with a machine, because they have no common sense, they only do what we tell them to do.


----------



## jwmelvin (Sep 21, 2022)

I agree with your approach. Sure, it might be nice to develop a way to enter custom threads, but it's not a first-order requirement. Also - for sure the super coarse threads are a fringe use case. And one might arrive there through a gearing change even without changes to the software. I can imagine that super coarse threads might be fun for using live tooling to create a decorative helix of sorts, maybe in wood etc.


----------



## WobblyHand (Sep 21, 2022)

jwmelvin said:


> I agree with your approach. Sure, it might be nice to develop a way to enter custom threads, but it's not a first-order requirement. Also - for sure the super coarse threads are a fringe use case. And one might arrive there through a gearing change even without changes to the software. I can imagine that super coarse threads might be fun for using live tooling to create a decorative helix of sorts, maybe in wood etc.


I did come up with a way to get coarser threads.  I need to try it tonight.  For some reason, I stuck with thinking 8 microsteps was the right number. 

There is no reason why I cannot use 4 instead all the time  I will see if it is noisier.  Using 4 instead of 8 micro steps should also provide more holding torque, nearly double that of 8.  If it works, then I can get to 10mm threads or down to 2.5 TPI.  Will I ever try 2.5 TPI?  Only for giggles. 

My PEC pitch gauge is from 4-84, TPI.  I will try 4 TPI, then 20, then 40 at 4 micro-step setting.  Have a program that calculates the tables for me. Think I have a P4 blade.  4 TPI is on 2.5" diameter screws.  That's quite a big screw.  Not sure I want to waste stock on that size...


----------

