# Logan Model 200 Servo Threading



## Briney Eye

Just throwing this out there to see if anybody is interested.  I see a fairly straightforward way to set up a Model 200 for servo threading that would be easier than retrofitting a quick-change gearbox while also being much more flexible.

Conceptually it's simple.  Put an encoder on the spindle and a servo motor on the lead screw, with some digital intelligence in between and a user interface to select the ratios.  Feed rate would become continuously variable, with simultaneous display of both axes.  The noisy change gears would go away.  Metric would become easy.  The function of the forward/reverse lever, half nut lever, and crossfeed plunger would remain the same.

I would avoid "modes" and go with a full-time display of feed rate and pitch in inches and millimeters, with a "highlight" when you landed on a standard pitch.  I see a clear-lidded box with a power switch, a display, and a knob, mounted where a gearbox normally sits.  When the box was on, the lead screw would behave as if there were still gears coupling it to the forward/reverse lever.  You would still use the thread dial.  And of course the lathe could still be returned to its original state.

I possess the necessary skills (from nearly 40 years doing this sort of thing), and think it would make a fun (and functional) project.

What are your thoughts?


----------



## markba633csi

It's been proposed but I have not seen a working example.  The trick of course is to make sure the leadscrew never becomes de-synchronized with
the spindle.  The circuitry should be immune to electromagnetic interference and you would need a backup system for power failure
Mark S.


----------



## T. J.

I have no personal experience, but I've heard this one mentioned on the Atlas 618 Yahoo group before:
http://www.autoartisans.com/ELS/

There is also a Yahoo group called "Electronic Lead Screw".


----------



## Briney Eye

T. J. said:


> I have no personal experience, but I've heard this one mentioned on the Atlas 618 Yahoo group before:
> http://www.autoartisans.com/ELS/
> 
> There is also a Yahoo group called "Electronic Lead Screw".



There are quite a few projects like that floating around.  I just think that it would be worthwhile to do something without all the bells and whistles.  I'm not shooting for a CNC lathe.  I want something very straightforward, without menus or modes, no programming, no tapering or jogging, just a "continuously variable" gearbox.  If the spindle is turning and the forward/reverse lever is engaged, the lead screw turns at a proportional rate.  What got me started was wishing that I could slow down the cross-feed.  I even bought a DC gear motor and worked up some plans, but I eventually realized that this approach would be more worthwhile.

"All" I have to do is attach a suitable encoder to the stud gear and servo motor to the lead screw, make it all fit under the cover without modifying any of the existing parts, and write a program.  Nothing to it .


----------



## T. J.

Briney Eye said:


> Nothing to it .



I start out pretty much all of my projects thinking like that...

I don't have the electronics knowledge to contribute meaningfully to a project along those lines. But I do agree that it would be an improvement to these smaller Logan lathes. I have the quick change gear box, but still the finest feed available is 0.004" per rev.


----------



## markba633csi

My thoughts, If I had the coding skills to do it (which I don't, yet) would be to make it a closed loop rather than an open loop one.
In other words, instead of just one optical encoder on the spindle, have two; one on the spindle and another on the screw.  Then your
microcomputer would act as a comparator in addition to a ratio-changer hence it would never get out of sync. I'm sure it's been done.
Mark
ps if you didn't care about cutting threads then an open loop system might suffice, or simpler still, just a geared-down motor drive; no micro.


----------



## Briney Eye

markba633csi said:


> My thoughts, If I had the coding skills to do it (which I don't, yet) would be to make it a closed loop rather than an open loop one.
> In other words, instead of just one optical encoder on the spindle, have two; one on the spindle and another on the screw.  Then your
> microcomputer would act as a comparator in addition to a ratio-changer hence it would never get out of sync. I'm sure it's been done.
> Mark
> ps if you didn't care about cutting threads then an open loop system might suffice, or simpler still, just a geared-down motor drive; no micro.



Thanks, I should have been more clear.  Any servo motor that I used would certainly include an encoder.  I'm enamored with the Teknic Clearpath motors.  This project would be an excuse to try one.  Their standard models have, I think, 800 counts per revolution, so I would want a spindle encoder with at least that resolution.

I'm pretty sure that one of the Clearpath motors will do pretty much all the hard work, in fact, by connecting the spindle encoder directly to it and programming the ratio.  I just have to get one of the models that I can "talk" to and then the control box really is just a front end.


----------



## Briney Eye

markba633csi said:


> My thoughts, If I had the coding skills to do it (which I don't, yet) would be to make it a closed loop rather than an open loop one.
> In other words, instead of just one optical encoder on the spindle, have two; one on the spindle and another on the screw.  Then your
> microcomputer would act as a comparator in addition to a ratio-changer hence it would never get out of sync. I'm sure it's been done.
> Mark
> ps if you didn't care about cutting threads then an open loop system might suffice, or simpler still, just a geared-down motor drive; no micro.



I apologize for my initial misunderstanding of your comment.  A true closed loop system with the controller monitoring encoders on both the spindle and screw might be ideal, but I think I'll have to leverage the Clearpath motor's built-in brain to tell me if it gets out of sync.  But that's a "feature" of this approach, anyway.  I will be able to program the Clearpath so that I have an "overload clutch" on the feed, something the Model 200 sorely lacks (I know this from personal experience).

Also, after reading the Clearpath documentation more closely it's become clear that I will still have to do most of the work.  While they have quadrature input and scaling capability, it's limited to multiples of 800 encoder counts.

I'm going to start by trying to implement this on an Arduino with a small touch screen, and see if I can do quadrature decoding with interrupts.  At 1440rpm a 100ppr encoder will be interrupting almost 10,000 times per second, which I'm sure is at the limits of what an Arduino can do.  If it can't keep up I'm looking at a programmable logic chip, a PIC32 microcontroller setup with dedicated quadrature decoding hardware, or a Cypress "Programmable System On a Chip" micro which I know supports quadrature decoding logic blocks.  Years ago I did a lot of quadrature decoding with programmable logic for robotics applications.  Dedicated hardware is really the way to go, so I probably won't spend too much time trying to make the Arduino work before I punt.


----------



## Briney Eye

Well, the first small step is a success.  I've hooked up a 200ppr (pulse per revolution) encoder to my Arduino Uno.  With quadrature encoding, that equates to 800 counts per revolution.   Starting with the SpeedTest sketch from the Encoder library I kludged up something that seems to be working fine at over 1400rpm.  First I tried SpeedTest straight, which pulses a pin that you can integrate with a DVM and see the average voltage decrease as the interrupts come faster, and it looks like it takes about 17% of the processor time at 1400rpm.  Then I substituted a print statement for the PWM code.  When I spin it up my oscilloscope says one phase is running at 4.7khz.  If I run it for ten seconds, it comes very close to the 188,000 expected counts.  I guess I'll have to hook up the 360ppr encoder and see how that works, and then try the 600ppr encoder (which ought to soak up about 50% of the CPU cycles).

The performance is much better than I was expecting.  I'll have to study the code.

It's dead quiet, too.

This is fun!


----------



## RandyM

Excellent! I am glad it is working out for you with the added bonus of FUN. You are doing something most of us would not even consider. If you could add pictures of your work we'd greatly appreciate it. Photos really add a lot to the story, particularly for those of us that are more than out of our element. Keep up the good work.


----------



## Briney Eye

RandyM said:


> Excellent! I am glad you is working out for you with the added bonus of FUN. You are doing something most of us would not even consider. If you could add pictures of your work we'd greatly appreciate it. Photos really add a lot to the story, particularly for those of us that are more than out of our element. Keep up the good work.



Thanks for the encouragement.  When I have something picture-worthy I intend to post it.

I think I've worked out how to make the change-over from gears a clean swap.  I'm waiting for a few more parts, then I'll be making brackets for the stepper motor and rotary encoder to mount them on the banjo in place of the change gears.  Timing pulleys will replace the screw and spur gears.  Belt tensioning will be accomplished with the banjo.  That will keep everything looking neat, fit under the cover, and be worth taking pictures of.  It will also make it easy to change everything back.

I'm going to start with a 5:1 reduction between the stepper and the lead screw.  With the stepper spinning 1000rpm (half max) the carriage will move the full length of the bed in under a minute, which seems fast enough to me.

I picked up a 2.8" color display with a resistive touch screen that I think, along with a knob, will make a good user interface.  After I got the display I read something that implied that it used up all the Arduino's pins, but after looking at the schematic I don't see a problem.

Initially I plan to make it function purely as a continuously-variable gearbox.  I suppose it will have to have a fast jog function so that the half nuts can stay engaged for metric threading.  I like the idea of prompts to remind you where to engage the threading dial for a given pitch.  What else do you think would be useful?


----------



## Briney Eye

If you don't have pictures it didn't happen, right?  Baby steps.




The encoder is plugged directly into the Arduino and running from 5V.  You can see that the Arduino internal pullups are pretty weak.

I highly recommend these little Rigol scopes, by the way.  I see that they're going for $350 on Amazon Prime.  I paid $399 for mine a couple of years ago.  Great little scope.


----------



## Briney Eye

I thought I ought to post a progress report to pique the interest of the vanishingly small number of people who might actually be interested.

The Arduino Mega is going to get it done, I think.  I have the prototype interrupt-driven low-level code working well, covering inch feed rates from 0.0005" to 0.250", from 0.01mm to 4.5mm, and the pitch of every tap available from McMaster-Carr.

Then I thought "why stop there?"  So I'm adding diametral pitches from 112 to 12, and module pitches from 0.2 to 7.  It's no harder than doing metric feeds, so why not?  I got the tables from pictures of a Victor lathe that I looked at on eBay and thought it would just be cool to do.

I'm still waiting for slow boats from China, but should have all the pieces within the next week.  I do have the leadscrew timing pulley machined, but have other pulleys to adapt and brackets to make.

I'm hoping to start work on the GUI this week.  Pictures soon, I hope.

All the best, folks!


----------



## TomKro

Plenty of interest here.

Having a simple setup that cleanly attaches at the banjo is a really good idea.  There are many, many change gear Logan's out there that would benefit tremendously from this setup.  My problem is that I have no electronic experience, wouldn't know where to start, and really can't add much to the conversation.  

Once you show a setup that can cut a variety of thread pitches with the push of a button, you'll have plenty of requests for hardware lists and code.  Keep up the good work.


----------



## Briney Eye

I'm still making steady progress, if anyone is interested.

I'm driving a stepper motor and it's looking really good.  I couldn't get the noise immunity that I wanted on the ATmega2560 with full quadrature decoding.  I just couldn't make it behave with the interrupt latency and the slow, sometimes noisy rising edges, so I changed the logic to interrupt on falling edges of one phase and simply read the state of the other.  I gave up resolution, but gained very quiet and stable tracking of the spindle right down to a dead stop.  I started with a 200p/r rotary encoder because 800 counts per spindle revolution just scaled really nicely to the stepper controller, and now I'm waiting for an 800p/r encoder to get that back with the new decoding scheme.  I may try full decoding again when I get the voltage-output 200p/r encoder that I also have headed my way.

There are practical limitations on how fast you can feed for a given spindle RPM, just like with gears, so it will tell you what that maximum RPM is, warn you if you're trying to go too fast, and simply refuse to go if you're exceeding the limit.

I have an encoder knob hooked up and working well (with a bit of debouncing) for changing parameters in the user interface.  And I have a "smart" Nextion 3.2" display connected to the Mega's third serial port which is going to take some time to figure out.  The extra ports are another reason to go with the Arduino Mega.  I can be debugging over Port0 while controlling the display over Port2.

I hope it won't take too much longer to get all the pieces working together on the lathe.  Stay tuned.


----------



## Briney Eye

Prototyping the display layout.  This is just a dummy layout.  I haven't got it talking to the Arduino yet.


----------



## TomKro

Can't wait to see the drive motor mount and the spindle speed pickup.  

As to other features, using the display as a spindle tach when you're not driving the screw would sure be nice.  

Since you're counting turns, can you create a feature to set/reset an infeed limit to help avoid crashes?  

Very interesting project.


----------



## Briney Eye

Several iterations later it looks like this.  The icon in the lower right is the placeholder for feeding to a shoulder.  I still have to write that code.  Actually, everything is a placeholder since it's just a mock-up.  But I am talking to the display at this point:


----------



## TomKro

When you say "talking to the display", do you mean the stepper motion and direction?  Just wondering what you start with on something like this.

From what I can find on-line, there's graphical interface programs to set up the display, and separate code for the Arduino.  There appear to be various "starter kits" for both the display and the control board.  Any thoughts on which kits might be a good starting place for a digital dinosaur?  I got off the programming train at Fortran and punch cards.


----------



## Briney Eye

Frankly, I think the display has a lot more raw processing power than the Arduino Mega that I'm using for motor control.

At this point I can send commands to it over the serial port.  The Mega has four serial ports.  Port 0 is used in the Arduino environment as the debugging port, and I have the Nextion set up on Port 2 (because that's what their examples use).  All I've done so far is send text to it, but that's most of what I'll be doing anyway.  The Nextion itself can handle most of the user interface, and only send the button press events to the Arduino to let it know when something is changing that the Arduino needs to know about.  I've already set up a second page to control the display brightness, but the Arduino doesn't need to know that, though I might have the Nextion check the RPM and not switch pages unless the spindle is stopped, for instance.

Nextion provides an editor to set up the display, and I'm gradually figuring it out.  The display itself keeps track of when a "button" is pressed and highlights it.  For the left and right feeds, for example, I have it sending a button press event and a button release event to the Arduino.  That way, holding the button pressed will allow me to traverse the carriage, and feed faster the longer the button is held. All I need for the inch, metric, diametral and module buttons is the press event, though.

On the Arduino side, you have to use the name of the display object that you defined in the Nextion editor to send commands.  So if I want to display RPM in the appropriate text box I send "rpm.txt=" followed by the string. There's nothing to stop you changing any number of other attributes. You could conceivably leave nearly everything undefined and configure the entire display by sending commands to it.

Communication in the other direction is different.  For instance, when I press the left feed arrow, the Nextion sends 0x65 0x00 0x0E 0x01 0xFF 0xFF 0xFF to the Arduino.  The first byte is the "Touch Event", the second byte is the page number, the third byte is the component ID, and the fourth byte indicates a Press, followed by a three-byte terminator.  When I release the button it sends almost the same thing, except that the fourth byte becomes 0x00 indicating a Release. So you need to keep track of component names _and_ numeric ID's on the Arduino side to manage two-way communication. Clear as mud, I'm sure.

After you've designed the Nextion display look and behavior, it creates a file that you copy to a MicroSD card and plug into the display. When power is applied it copies the file to its on-board memory and runs it.  It can also be done serially, but I haven't tried that.

The display was about $30, and the Arduino Mega about $20.  I also got a "shield" for the Arduino with screw terminals and a prototyping area for about $10.  Arduino and Nextion provide free downloads for their software. So just buy some stuff and give it a try. My first exposure to a computer was running an IBM 1230 Mark Scoring Reader with a card punch console attached, for a Work-Study job at the University of Northern Colorado back in the early 70's.  The grading scheme was "programmed" with rotary switches on the front panel.  Once I had to deliver 50,000 punch cards to the real Computing Center for analysis.  I was a Music major, and didn't actually get into computers for real until a few years later.


----------



## TomKro

Now you got me hooked.  

I have zero electronic hardware, so I ordered an Uno starter kit, motor shield and a display.  I was trying to get a "mega" card, but couldn't find a true Arduino made unit, and have no idea as to the quality/reliability of the other card builders.  If there are any particular brands that you've found to be goods units, can you please advise?  Not trying to bad mouth anyone's hardware, but the range of pricing was crazy wide.  

As to the infeed shoulder stop / crash stop, I wasn't considering the operating concept properly.  I'm guessing it doesn't help much to count motor turns if the half nut isn't connected all the time.  Maybe some sort of carriage travel sensor would work?  Can the motor controls detect a "crash" into a bed mounted travel limit, and prevent continued infeed movement?


----------



## Briney Eye

Pardon me, I did say that I was using an _Arduino_ Mega. Actually I'm using an _Elegoo_ "Mega" clone that I picked up from Amazon Prime for $14.99.  So far I have zero issues, other than blowing out the bootloader with an Atmel ICE and having to figure out how to restore it. It took me a couple of hours to figure out that the hex file existed, buried in the Arduino folder structure (and now I can't remember where!!).

--- Okay, I had to figure that out.  The bootloader hex file for the Mega 2560 is buried deep.  It's in "Program Files (x86)/Arduino/hardware/arduino/avr/bootloaders/stk500v2/stk500boot_v2_mega2560.hex".  Now I'll be able to sleep tonight .

I've got a DIN rail Mega adapter coming that will give me screw terminals for ALL the pins, unlike the Uno shield that I have plugged in now. Kind of painful to pay more than twice as much for it as I paid for the Mega.

Assuming that I get it written, the "feed to a limit" mode will require that the half nuts be engaged at all times. Anything else will just be too much of a pain. I'll probably put a big button overlay right in the middle that says "Engage Half Nuts NOW!"  Hmm, I suppose I could add a Bluetooth sniffer and steal the data stream from the TouchDRO ......


----------



## TomKro

Mega it is.  I saw the Uno kit with wire, instruction book, etc., and figured that would be a good starting place.  The motor shield was pretty cheep, so simply a low cost opportunity to look into the code (but absolutely not a programmer).  I thought best to wait for feedback on the various "clones" to see if they were OK.  I did notice other small touch screens that mount directly to a shield.  Not sure if they have any sort of user interface to help with setup though.  

As to the half nut, are you working with a DRO to locate the carriage position?  

Sorry about the issue with the lost file.  At that point I would have been wondering what was wrong and ordering a new board.


----------



## rwm

This is a brilliant idea! I can't wait to see it in action.
I have a question regarding threading up to a shoulder. If you thread up to a shoulder it seems it would be easy to stop the lead screw to prevent a crash. Is there a way to re-synchronize the spindle and the lead screw after this even if the half nut stays engaged? The thread pitch would play in to this since the ratio of spindle to lead screw turns could be greater or less than 1.0? I suppose the software could do it somehow but I can't get my head around it. Have you figured this out?
I guess this device is actually a single axis CNC on the Z axis.
I'm thinking about putting this on the far end of my lead screw and leaving my gear box intact.
Robert


----------



## Briney Eye

rwm said:


> This is a brilliant idea! I can't wait to see it in action.
> I have a question regarding threading up to a shoulder. If you thread up to a shoulder it seems it would be easy to stop the lead screw to prevent a crash. Is there a way to re-synchronize the spindle and the lead screw after this even if the half nut stays engaged? The thread pitch would play in to this since the ratio of spindle to lead screw turns could be greater or less than 1.0? I suppose the software could do it somehow but I can't get my head around it. Have you figured this out?
> I guess this device is actually a single axis CNC on the Z axis.
> I'm thinking about putting this on the far end of my lead screw and leaving my gear box intact.
> Robert



I'm keeping running totals on the spindle and lead screw, so as long as both are kept engaged it knows where they are relative to one another.  Disengage either one and all bets are off.  I know how many counts per revolution the spindle encoder puts out, and I know how many steps per revolution the lead screw takes.

Perhaps I should elaborate.  The spindle encoder is going to be driven by the stud gear, so it won't see spindle counts unless the feed lever is engaged.  It's directly analogous to using the change gears.  Engage the feed lever and the lead screw will turn, but of course you don't know where the carriage is unless the half nuts are engaged.

I actually have a drive gear mounted on the tail end of my lead screw that I haven't gotten around to taking back off.  I was going to try a simple gear motor drive from that end before I decided to go for full programmability.  I figured I would have to pull the screw gear to use it anyway, so why not just replace that gear with a timing pulley and drive from that end?  And if I was replacing the screw gear with a timing pulley, why not drive it with a stepper?  And if I was driving it with a stepper, why not ...


----------



## Briney Eye

I've done a short video of my bench prototype and posted it to the 'Tube.  All the basic functionality is done, but I still have some "features" to program, and of course get it all installed on the lathe.


----------



## middle.road

This is rather interesting. Taking old iron and 'computerizing' it, adding functionality and 'ease of use' to it.
I haven't used my ol' Logan for threading at all since I got the Birmingham.


----------



## Briney Eye

Time for a progress report.  There is just barely enough room to mount a NEMA23 stepper motor with clearance for the cover.  I'm waiting for another timing belt for the encoder.  The ones that I have are either too short or too long, and I finally had to go directly to Misumi for a complete selection of sizes.  Still have to make the encoder bracket as well.  I'm still adding things to the code, the final piece being the ability to set left and right feed limits to allow feeding/threading to a shoulder.


----------



## Richard White (richardsrelics)

This is fascinating stuff to me. I have run CNC lathes previously, and currently have a 1947 Logan that I would love to convert to full CNC to cut tapers as well as threads.....this is some cool stuff


----------



## Briney Eye

Richard White (richardsrelics) said:


> This is fascinating stuff to me. I have run CNC lathes previously, and currently have a 1947 Logan that I would love to convert to full CNC to cut tapers as well as threads.....this is some cool stuff



Well, I'm keeping this simple insofar as I started off just wanting a power feed, and then the feature creep started.  I wanted it to be invisible, bolt-on, and reversible.  Besides the feed and threading control, I'll have control of feed direction, carriage jogging, and left/right limits.  Beyond that the lathe will operate completely normally in the default mode.  Once it's up and running I may work on the half nuts to take out some backlash, and maybe build a taper attachment, but it's still going to be the same manual machine -- just a lot easier to use.  When I'm gone and it's in the hands of a new owner, if the electronics fail in a few minutes they can still go Old School.  I don't see why it can't keep on going for decades yet (even if I can't say the same for myself!).


----------



## TomKro

I was wondering how you planned to put a stepper motor in there and still be able to close the door.  Great job packaging all the hardware.

Please let us know how the NEMA 23 motor works out for moving the carriage under cutting loads.


----------



## Briney Eye

It's a tight squeeze, but the encoder just fits:


----------



## rwm

Beautiful install! I would love to install this on the tailstock end of my SB 10K.
R


----------



## Briney Eye

Everything hooked up.  I cut my first thread this afternoon.


__
		http://instagr.am/p/BhR9cv4lWcV/


----------



## Richard White (richardsrelics)

Can't view it???  I will try again when I get home...


----------



## Hukshawn

Nice!


----------



## rambin

so what would you estimate the cost/difficulties of getting a set up like that for a person that doesn't know  an arduino from an ar$ehole


----------



## Hukshawn

rambin said:


> so what would you estimate the cost/difficulties of getting a set up like that for a person that doesn't know  an arduino from an ar$ehole


Lol, my dad used to say arse. That made me laugh.


----------



## Briney Eye

rambin said:


> so what would you estimate the cost/difficulties of getting a set up like that for a person that doesn't know  an arduino from an ar$ehole



Quick estimate, about $350 in parts (motor/controller/encoder/microcontroller, miscellaneous electronic bits, pulleys and belts, enclosures etc.).  Some things you have to buy in multiples, and I'm probably forgetting something, so make it $400 for materials.  Of course I've spent a lot more than that in development costs.  I've got a pile of spare electronics, a number of encoders, and quite an assortment of timing belts and pulleys at this point.

I've got a fair number of hours into programming the microcontroller and display.  I've been working on it evenings and weekends since late November.  It's been a significant effort.  Lots of fun, but I've made a career doing this kind of R&D for nearly 40 years now.  It's impossible for me to estimate the degree of difficulty for a novice.

I'm considering putting this together as a kit, but there is a lot to consider.  I could shave some cost.  It might make sense to contract out some fabrication.  There is packaging and shipping.  I would have to support it.  And then there's the big one --- liability.

I did a respiratory monitor for a retired anesthesiologist years ago.  He had the patents on half the ventilators in North America and Europe, and his liability insurance was costing him $250k a year.  Lord knows what it would be now.  He told me that his rule of thumb was that the "retail" cost had to be a minimum of 5X the build cost.  I haven't consulted a lawyer on the limits of my liability, even if all I offered was a download.  I assume that I would have to set up an LLC.

I still have to get it properly installed and a considerable amount of due diligence to make sure it's rock-solid.  Bottom line, I might have to charge $1500 for a kit.  Maybe I could do the download for $200, maybe I could kit the hardware for $500, maybe I could offer all three options.  I would still have to support it, and there would still be liability.  Even if I post it to GitHub and give it away there's liability.

All that, and I don't know how big the market is.  I can't imagine selling more than 100 kits to Logan owners.  Shoot, I probably couldn't sell 100 downloads!  I might be able to broaden the appeal by doing versions for other lathes, but I don't know enough about what's out there.  The Model 200 happens to be the perfect candidate for this.  Anybody have suggestions for other non-gearbox machines?  Or maybe there would be interest in an outboard version that would drive the other end of the leadscrew with the QCGB disengaged.  Still have to get an encoder on the spindle, though.

Sorry, I thought that this was going to be a short post.  Back to the shop!

-Jon


----------



## rambin

well the 700 that I have is very similar to the 200...not even sure what the difference is other then mine was made for wards... I cant see why there would be big liability....with a respirator your talking someones life with this your talking a piece of steel with messed up threads. if your looking to market this and become a millionare theres prbly not enough interested  logan people out there...if your wanting to help out fellow logan owners and make a slight profit then maybe..  at 1500 I wouldn't even think of it.. and im sure moston here are with me on that!


----------



## Briney Eye

Yep, this is the "Hobby" Machinist site, after all.  I'm doing this mostly for my own entertainment, with the reward being my own satisfaction, some validation from like-minded folks, and a lathe that is really nice to use.  If money changes hands I incur liability and expectations of support.

The anesthesiologist was dealing with a lawsuit while I was working for him.  A hospital technician had replaced the air fitting on a ventilator with an oxygen fitting, resulting in a rather intense fire in the operating room, and they went after the staff in the OR, the hospital administration, the manufacturer, and the designer.  Everyone, in fact, except the technician responsible.  Observing what he had to go through made me paranoid.


----------



## rwm

Totally awesome! How does it work for regular feed for cutting?
Robert


----------



## rwm

Can you give us some follow up on this awesome project!?
Robert


----------



## Briney Eye

rwm said:


> Can you give us some follow up on this awesome project!?
> Robert


Had some family health issues to deal with, but I’ll be getting back on it soon. Last thing I did was switch to a “spare” controller from a different source to see how it worked. I expected it to be compatible, but it wasn’t working very well. Lots of noise and resonance, so I’ll have to hook up to the RS232 port and tune it, I guess. I’m hoping a download from Leadshine will provide the utility and guidance, but the documentation is a little sparse on these things. I’ve verified most of the feed rates against a dial indicator and the DRO and everything has checked out so far.


----------



## jh1990

Are you using a thread dial for threading?

Or are you able to run the motor in reverse and have the stepper turn the opposite direction?

I'm sure you could have the arduino keep track of the steps and return to a "zero" point without having to run the motor in reverse especially if you add limits.


----------



## Briney Eye

jh1990 said:


> Are you using a thread dial for threading?
> 
> Or are you able to run the motor in reverse and have the stepper turn the opposite direction?
> 
> I'm sure you could have the arduino keep track of the steps and return to a "zero" point without having to run the motor in reverse especially if you add limits.



I've set it up so everything works pretty much "normally," thread dial included.  The microcontroller just takes the place of the change gears, and adds the ability to do metric, diametral and module pitches.  It does allow switching the lead screw direction on the fly, which is useful for facing.

I've been planning all along to add the ability to set limits, but I've started having second thoughts.  It works so well as it is, and I'm not sure the added complexity would really be worthwhile.  I plan to give it a try and see how it feels, though.


----------



## Briney Eye

I've been neglecting this thread (and project).  I thought that I ought to put up a couple of pictures of what I've got at this point.  The electronics are enclosed.  I extended the drum switch bracket and mounted the touch screen on a friction hinge.  The main box will mount on the leg under the headstock:




The "home" page.  The touch screen and knob make for a very straightforward interface:




There is a setup page for displaying the valid spindle RPM's for a given feed rate and adjusting the screen brightness, and a page for setting feed limits, but I don't have pictures.  Right now I'm re-writing the jog code, but I'll have it all working any day now.  I swear.


----------



## middle.road

What a mod! It is, in my mind at least, still very cool. On an Ol' Logan Model 200 no less. 

Now all that is needed is a complete write up with diagrams, schematics, drawings, and a BOM.  (I'll see myself to the door now...)

Wish I had the talent, not to mention the time, to take this on and do mine up.


----------



## Briney Eye

I could stop right where I am and just have a programmable gearbox, jog, and instant feed reverse, but I think it would be cool to add a couple of "enhancements" while I'm at it.  I was watching Robin Renzetti make a differential screw (look him up on YouTube and Instagram if you haven't already) and thinking how neat this would be for that.  Want 0.001" per turn?  Do one thread at 0.025" pitch and the other at 0.026" and there you are!  Of course, that means that I have to add "custom" feed rates now in addition to the 79 fixed inch rates that I already have.  It's only software, right?


----------



## middle.road

Getting into "differential screws" now -eh? I caught that video of Robin's awhile back. 
Soldering fumes are being ventilated properly aren't they? 
Edgewood is only @6700' so lack of oxygen isn't a factor...

Talk about breathing new life into Old Iron.


----------



## Richard White (richardsrelics)

I would love to be able to thread on a taper, using an older machine, with your setup... Now that would be epic!


----------



## Briney Eye

Richard White (richardsrelics) said:


> I would love to be able to thread on a taper, using an older machine, with your setup... Now that would be epic!



Too bad that Logan taper attachments are so rare, and expensive when they do surface.  The way that I set up the digital scale on my cross slide would lend itself to adding a taper attachment if I ever have a need and decide to build one.


----------



## Richard White (richardsrelics)

I currently have both original end pieces and an original cross slide cover for the correct Logan Taper attachment.. Only missing the bar, need the length to make my own and finally need, well not really... Only need the correct length of the bar as with my Bridgeport I can make the rest...


----------



## Briney Eye

Richard White (richardsrelics) said:


> I currently have both original end pieces and an original cross slide cover for the correct Logan Taper attachment.. Only missing the bar, need the length to make my own and finally need, well not really... Only need the correct length of the bar as with my Bridgeport I can make the rest...



When I bought my 200 it had the cross slide extension for the taper attachment, but the attachment itself was long-since gone.  I gave the extension to someone for the cost of shipping it to him.  I had to make a sheet metal cover for the bracket and digital scale that I added and couldn't use it, anyway.


----------



## greenail

Briney Eye said:


> When I bought my 200 it had the cross slide extension for the taper attachment, but the attachment itself was long-since gone.  I gave the extension to someone for the cost of shipping it to him.  I had to make a sheet metal cover for the bracket and digital scale that I added and couldn't use it, anyway.



are you planning on sharing the source code?


----------



## Briney Eye

greenail said:


> are you planning on sharing the source code?



I'm waffling, because I can't decide whether I want to turn it into an actual product.  Of course, I kinda have to finish it first.  Over the weekend I ripped out the jogging routines and completely re-wrote them.  Much cleaner code, and a better acceleration profile.  It tends to work that way, since on the first (or second) pass you don't really understand the problem.  Then I worked on feeding/threading to a shoulder some more.  It's going to take another pass or two to get that right.  Then I have several other "enhancements" on my list.  Software is never done.


----------



## jwmay

Just wanted to drop a note to say there’s at least one more stranger on the internet that is highly impressed with your project. I’m an industrial electrician by trade, and have often tried to imagine how this could be done. Unfortunately,I’ll likely never be knowledgeable enough to pull it off. It’s easier to identify a broken one(me) than design and implement(you). Lol I read in a trade magazine that Monarch  I think, has put a programmable leadscrew on their newest lathe.

As far as cost of a kit, I’d say you’ll have to come in under 500-600 dollars . Only because that’s the going rate it seems for a QCGB. Your kit though, after complete, looks to add additional,valuable functionality that a person wouldn’t get, even with a QCGB. Anyhow, I’m convinced you’re way ahead of me on that whole thing too, so I’ll stop now. Kudos to you. It’s a great project, and a fine testament to your ability.


----------



## markba633csi

Electronic taper attachment! Now that would be awesome too, since the mechanical ones are so expensive and rare for some machines
Nice work Jon
Mark


----------



## Briney Eye

Thank you for the kind words.  Like I said, I have some "features" to finish.  I've been working on this in fits and starts, but I've been pushing the last couple of weeks to finally get it done (for certain values of "done").  I'm probably going to retire next month and get a detached shop built this summer.  That will give me some room to do things.

I know that there are Hardinge HLV clones now that have been computerized.  I saw something about Monarch buying old 10ee's for the iron and rebuilding and retrofitting them with a modern drive system.  In fact, a 10ee just came up locally, and I was going to try to get a look at this afternoon.  If I buy it I'll have to rent storage for it until I have the shop built, but it would make a great project.

So, my plan is to finish the last bits of the leadscrew "soon" and do a lot of pictures and a video or two.  Threading to a shoulder is really slick, but I'm missing something in the synchronization.  I really want to get that working right and put out a video.  I think that will impress people more than anything else.


----------



## Briney Eye

markba633csi said:


> Electronic taper attachment! Now that would be awesome too, since the mechanical ones are so expensive and rare for some machines
> Nice work Jon
> Mark



It would be interesting, but it's outside the scope of what I'm trying to accomplish.  My goal is something that will bolt on to a stock Model 200 (and maybe some other QCGB-less lathes further on) and give the functionality of a Monarch 10ee with an ELSR.  A full CNC lathe is another animal entirely.


----------



## Richard White (richardsrelics)

"It would be interesting, but it's outside the scope of what I'm trying to accomplish.
My goal is something that will bolt on to a stock Model 200 (and maybe some other QCGB-less lathes further on) and give the functionality of a Monarch 10ee with an ELSR. A full CNC lathe is another animal entirely. "


So how does one go about changing the scope of what you are trying to accomplish???  LOL


----------



## Briney Eye

Richard White (richardsrelics) said:


> "It would be interesting, but it's outside the scope of what I'm trying to accomplish.
> My goal is something that will bolt on to a stock Model 200 (and maybe some other QCGB-less lathes further on) and give the functionality of a Monarch 10ee with an ELSR. A full CNC lathe is another animal entirely. "
> 
> 
> So how does one go about changing the scope of what you are trying to accomplish???  LOL



Feature Creep has already taken it much further than I had originally intended.  When I started I was just going to use a gear motor to drive the cross feed a little slower (I've left the spur gear on the tail end of the lead screw for now as a reminder).  I really, really don't want to get into retrofitting it with ball screws and stepper motors.

Plus, in a few days I may become the owner of a 10EE (without ELSR, with taper attachment) that needs some TLC.  I've got to wrap this up and get pictures and videos of everything actually working because, as everyone knows, if you don't have pictures it didn't happen!

-Jon


----------



## greenail

Briney Eye said:


> I'm waffling, because I can't decide whether I want to turn it into an actual product.  Of course, I kinda have to finish it first.  Over the weekend I ripped out the jogging routines and completely re-wrote them.  Much cleaner code, and a better acceleration profile.  It tends to work that way, since on the first (or second) pass you don't really understand the problem.  Then I worked on feeding/threading to a shoulder some more.  It's going to take another pass or two to get that right.  Then I have several other "enhancements" on my list.  Software is never done.



if you can collaborate via open source you can still sell it as a product and also get help from a community.

I'm trying to understand the russian ELS here: https://github.com/jschoch/electonic_guitar.  I have the manual mode working and one of the automated modes.  

A few thoughts I had:


there are a ton of buttons and controls.  I wonder if bluetooth and a mobile app would be a better way to configure it and then just have a very simple physical button layout.
it requires pre-computation of a threading table.  this is likely due mostly to #1 and the added complexity of adding numerical input to the already complex control scheme.
the mega is slow.  I wonder if ESP32, ESP8266, or STM32F103 are better fits.
I don't have the LCD used and I plan to add an i2c OLED screen to replace the LCD with.  I'm just sprinkling serial prints to understand it now.


Regarding feature creep: I'm really debating the need for feeding the X axis.  All I really need is to set a feed speed and a threading sync.  the rest just gets you on the verge of CNC.  

my particular lathe is pretty FUBAR as the threading tables don't actually work with the banjo and headstock gear the lathe has on it...


----------



## Briney Eye

greenail said:


> if you can collaborate via open source you can still sell it as a product and also get help from a community.
> 
> I'm trying to understand the russian ELS here: https://github.com/jschoch/electonic_guitar.  I have the manual mode working and one of the automated modes.
> 
> A few thoughts I had:
> 
> 
> there are a ton of buttons and controls.  I wonder if bluetooth and a mobile app would be a better way to configure it and then just have a very simple physical button layout.
> it requires pre-computation of a threading table.  this is likely due mostly to #1 and the added complexity of adding numerical input to the already complex control scheme.
> the mega is slow.  I wonder if ESP32, ESP8266, or STM32F103 are better fits.
> I don't have the LCD used and I plan to add an i2c OLED screen to replace the LCD with.  I'm just sprinkling serial prints to understand it now.
> 
> Regarding feature creep: I'm really debating the need for feeding the X axis.  All I really need is to set a feed speed and a threading sync.  the rest just gets you on the verge of CNC.
> 
> my particular lathe is pretty FUBAR as the threading tables don't actually work with the banjo and headstock gear the lathe has on it...



Our local Tech School is having a Maker Space open house next week that I'm thinking of attending.  There certainly ought to be people there who can provide some insight/advice on putting out a product.

1) All of the buttons on other ELS's is why I went to the Touchscreen-plus-Knob.  I offloaded a lot of complexity to the Nextion display so that the Mega could just do the real-time work.  No way I wanted a mess of connections to a front panel.  Been there, done that.  I have a breadboard stacked between a DIN-rail terminal block and the Mega with a couple of RC filters and pullups on it, and a header to consolidate the display/knob connections.  If I do a product, I will make a board to do all of that.

2) Pre-computing is the way to make it efficient and fast.  In fact, I think it would be kind of silly to do it any other way (but I started doing this back when a 6502 was hot stuff, so the Mega looks pretty nimble to me).  The spindle count just provides an index into a lookup table, allowing the interrupt handler to execute in a few microseconds.  At 1500rpm my spindle is interrupting at 20khz, so there is only 50us between ticks to get everything else done.  If you have to do any math at all you quickly get in trouble.

3) So far the Mega is handling my setup pretty well.  I bought a Due just in case, but haven't needed the hardware quadrature decoding.

4) Look at the Nextion lineup.  I ignored their Arduino library and parse everything myself with a couple of simple case statements.  Keep the protocol simple and it leaves you with lots of cycles to do other things.

My Model 200 looks stock until you notice the touch screen and the enclosure under the pan.  I want to keep it that way.


----------



## greenail

Briney Eye said:


> Our local Tech School is having a Maker Space open house next week that I'm thinking of attending.  There certainly ought to be people there who can provide some insight/advice on putting out a product.
> 
> 1) All of the buttons on other ELS's is why I went to the Touchscreen-plus-Knob.  I offloaded a lot of complexity to the Nextion display so that the Mega could just do the real-time work.  No way I wanted a mess of connections to a front panel.  Been there, done that.  I have a breadboard stacked between a DIN-rail terminal block and the Mega with a couple of RC filters and pullups on it, and a header to consolidate the display/knob connections.  If I do a product, I will make a board to do all of that.
> 
> 2) Pre-computing is the way to make it efficient and fast.  In fact, I think it would be kind of silly to do it any other way (but I started doing this back when a 6502 was hot stuff, so the Mega looks pretty nimble to me).  The spindle count just provides an index into a lookup table, allowing the interrupt handler to execute in a few microseconds.  At 1500rpm my spindle is interrupting at 20khz, so there is only 50us between ticks to get everything else done.  If you have to do any math at all you quickly get in trouble.
> 
> 3) So far the Mega is handling my setup pretty well.  I bought a Due just in case, but haven't needed the hardware quadrature decoding.
> 
> 4) Look at the Nextion lineup.  I ignored their Arduino library and parse everything myself with a couple of simple case statements.  Keep the protocol simple and it leaves you with lots of cycles to do other things.
> 
> My Model 200 looks stock until you notice the touch screen and the enclosure under the pan.  I want to keep it that way.



1. I assume you have a phone with a touch screen, so does most everyone else.  If you decouple the interface you can make the dedicated touchscreen an option.  That said, physical buttons are nice when you need to look elsewhere and still feel the controls.  Seems to me that making it modular is worthwhile since there are likely tons of opinions on the interface.

2.  to be more specific, the table could be calculated once on init/startup so that you don't have to re-flash if you want to change one of the parameters.  you still enjoy pre-computation when it is running but can avoid dragging out the laptop and cables to make changes.

3.  the mega is pretty darn slow compared to a 32bit board.  this impacts your spindle encoder resolution and the microstepping settings you can use. bluepill stm32 is like $2 each.  esp32 gives you 2 cores and networking (bluetooth for phone interface).  Making it modular here is a win since everyone will have their own preferences.  HAL work in grbl seems to be an interesting template for hardware abstraction in real projects.

anyway, Hope you share your code!  if not, good luck with productizing it.


----------



## jwmay

Are you two still speaking English? I got lost a couple posts back.


----------



## greenail

jwmay said:


> Are you two still speaking English? I got lost a couple posts back.



sorry to take this to geek land... lots of ways to skin the apple in both hardware and software for one of these projects.  I happened to be digging through another approach commonly known as the "russian ELS" and hoped to collaborate.  Sorry for the tangents i've pulled the thread on.

For anyone interested in the russian ELS I plan to post my source code for the firmware on github once I've documented how it works (lots of translation).


----------



## Briney Eye

Oh, I'm sure you're much more up-to-date on things than I am.  Thanks for suggesting the Blue Pill/STM32.  It certainly beats the pants off of an ATMEGA2560 price/performance-wise.  Is there one in particular that you would recommend?  I might want to give porting my code over to one a try, if for nothing more than the quadrature decoding.


----------



## Richard White (richardsrelics)

I think they are asking for more coffee????


----------



## greenail

Briney Eye said:


> Oh, I'm sure you're much more up-to-date on things than I am.  Thanks for suggesting the Blue Pill/STM32.  It certainly beats the pants off of an ATMEGA2560 price/performance-wise.  Is there one in particular that you would recommend?  I might want to give porting my code over to one a try, if for nothing more than the quadrature decoding.



there are some good guides on stm32duino.com if you want to keep using the arduino IDE. there are a quite a few different chipsets.  the super cheap blue pills are "*STM32F103C8T6 "*



Back to the topic at hand, I've been digging more and I have replaced the LCD with an OLED using i2c.  As I dug into the ISR for the encoder i see that there is a ton of stuff in there including driving the motor.  Are you using external interrupts or are you pollling the encoder via a timer?

I'm also wondering what microstepping you are targeting and why?  I bought a closed loop hybrid stepper to direct drive the lead screw.  I would like to leverage it's smooth microstepping as much as possible.  The russian ELS seems to be targeted at 1/4 microstepping which isn't very smooth.

also i'd love some coffee!


----------



## Briney Eye

I ordered a couple of Blue Pill STM32's, and after a little research decided to get a couple of Maple Mini STM32's as well.  I lost the Monarch 10EE to someone with deeper pockets, so I'll have more time to look at them this summer that I was hoping to spend restoring the 10EE.  I'm very sad about that.  It was dirty, but it ran like a top and had some Manhattan Project history.

My spindle encoder is handled by a pin interrupt, and so is the encoder knob.  The PWM output to the microstepper is built on a Timer4 interrupt that counts the pulses.  Then I use an overflow interrupt on Timer3 to extend it to 32 bits for things like the RPM calculation.  The Arduino serial ports are also interrupt driven, so you just stuff the serial buffer and go do other things.

The microstepper controller I'm using is an HBS57 that I picked up from Banggood with a NEMA 23 motor.  That 2.2Nm motor was too long to fit, so I got a 2Nm Leadshine from OMC Stepper Online that has plenty of torque.  I also got a CL57T driver from OMC but couldn't get it tuned up to work as well as the one from Banggood (without tuning).  I've set the HBS57 to 1000 steps per revolution, it's quiet, barely gets warm, and the motor barely gets warm either.  The CL57T was noisy, and the default settings heated up the motor like crazy.  I tuned it some, but just couldn't get it working as well as the HBS57 right out of the box.  Most of the time you can't hear it.  The whine gets a little more noticeable when jogging the carriage at high speed, but it isn't bad.  It all runs from a 36V/150W Mean Well switcher, which is marginal, but it fits in the enclosure.

I spent the weekend tightening up the code and working on feeding to stops.  I really want that feature because it will be a huge time-saver, but I just can't get my head out of my butt and get it properly synced for threading yet.  It's very frustrating.  Might have gotten it, but had to spend an hour chasing a compiler bug, which didn't improve my mood.  Finally fixed it by adding a completely unnecessary pair of braces in the right place.


----------



## Richard White (richardsrelics)

Maybe it was Expresso he is asking for????
On a side note, I am totally intrigued with this thread, because I know what the machine can do after you guys stop talking Techi...lol


----------



## Briney Eye

Success!  I have threading to stops working properly.  Finally had to impose some discipline and draw the state diagram.  While I'm working on the video here are the other two pages that currently exist in the GUI and an example thread:


----------



## Briney Eye

Here are a couple of *really* *rough* videos.  I'll be working on a proper one.


----------



## greenail

Nice!  

I think i have mine working.  I got the encoder mount setup early this morning and I hope to get a test run in tonight!

I ended up going with an esp32 which has a screen on the board (lolin 32 d-duino-32 clone) and it seems to work great.  I currently have it setup for 1/32 microstepping.  What are you using?  The russion ELS was optimized for 1/4 steps.

My motor has a decimal based microstepping mode (not sure how that actually works).  I wonder which is more accurate?  10 based would seem to work better for metric conversions.

How do your controls work?  Do you set the stops and then it just moves from the right stop to the left stop after you push a button?  

Are you stops physical (limit switches) or do you just record the motor position?  

Have you considered what it does if it stalls?


----------



## Briney Eye

The "arrow" buttons on the touch screen control the feed direction.  I keep track of the leadscrew displacement, display it in real time, and compare it to the limits on each spindle tick.  It stops when it reaches a limit and waits for you to touch the direction button to send it the other way.  The direction buttons also provide a jog function with smooth acceleration when the spindle is stopped.  I jog to the left and right positions and set the limits, then start the spindle.  Zeroing clears the limits.  I really need to get to work on a proper video to demonstrate it all.


----------



## Briney Eye

Okay, I got serious and put together a real video overview of (almost) everything working.  Let me know what you think.


----------



## TomKro

Super nice job packaging the Arduino, power supply, stepper driver, etc. in your main enclosure.


----------



## jh1990

Man this is a cool project. Very impressive work!


----------



## Briney Eye

I've been testing for a couple of days now that I've got things fully functional, and what has become apparent is that this is slicker than bug snot.

Except for one thing --- it's so efficient and fast now, it just cries out for a quick-acting compound lever like a Hardinge HLV, or a crossfeed dial stop like a Monarch.  Any suggestions for an adjustable stop project?


----------



## Richard White (richardsrelics)

I have seen photos of the quick acting tool holder, and I even have a picture I printed off of the one I saw... I have used the Hardinge one, I used it in the Navy on the ship... and it is way cool... I need it for my lathe as well, so if someone finds a set of drawings... PLEASE share!!!


----------



## Briney Eye

Richard White (richardsrelics) said:


> I have seen photos of the quick acting tool holder, and I even have a picture I printed off of the one I saw... I have used the Hardinge one, I used it in the Navy on the ship... and it is way cool... I need it for my lathe as well, so if someone finds a set of drawings... PLEASE share!!!



I know that the HLV had two different types, one a coaxial collar and the other with an eccentric shaft.  The Monarch stop collar might be easier to implement, but I would like to see the guts of all of them for ideas rather than reinvent the wheel.


----------



## fixit

I have very little electronic experience but would be VERY interested in this project PLEASE, PLEASE keep us informed.


----------



## TomKro

Did you happen to see the retractable tool holder in the Sep/Oct 2017 issue of the Home Shop Machinist?  

The plans call for removal of the compound, adds a riser block, and lays out a retractable tool holder that attaches to the side of a quick change tool post.  

It looks like a good bit of milling work, but certainly a nice addition for a lathe.


----------



## Briney Eye

TomKro said:


> Did you happen to see the retractable tool holder in the Sep/Oct 2017 issue of the Home Shop Machinist?
> 
> The plans call for removal of the compound, adds a riser block, and lays out a retractable tool holder that attaches to the side of a quick change tool post.
> 
> It looks like a good bit of milling work, but certainly a nice addition for a lathe.



Thanks for the tip.  I just looked at their web site, and I think you mean the July/August issue?  I've only thumbed through the magazine a few times, and I haven't been to a bookstore in a couple of years now.  Amazon's just too easy.


----------



## TomKro

I failed to mention that it's a two part article.  The Sep/Oct article adds the lever feature.


----------



## Richard White (richardsrelics)

Do they have drawings with the article?  I will buy the magazine to get the prints... I have tools I make that need threaded on a taper and that quick acting tool post will be a BIG help.


----------



## TomKro

There is CAD with the article.  
$6.50 for each magazine, delivered.  
Still in stock, I believe.


----------



## Richard White (richardsrelics)

Would LOVE to order the back issues, but it seems they require my phone number and an email and four blood samples, DNA from my firstborn....All I want is a danged magazine. Part of that statement is not true but so tired of this crap of needing all that info to send a flippin magazine...


----------



## Briney Eye

greenail said:


> there are some good guides on stm32duino.com if you want to keep using the arduino IDE. there are a quite a few different chipsets.  the super cheap blue pills are "*STM32F103C8T6 "*
> 
> 
> 
> Back to the topic at hand, I've been digging more and I have replaced the LCD with an OLED using i2c.  As I dug into the ISR for the encoder i see that there is a ton of stuff in there including driving the motor.  Are you using external interrupts or are you pollling the encoder via a timer?
> 
> I'm also wondering what microstepping you are targeting and why?  I bought a closed loop hybrid stepper to direct drive the lead screw.  I would like to leverage it's smooth microstepping as much as possible.  The russian ELS seems to be targeted at 1/4 microstepping which isn't very smooth.
> 
> also i'd love some coffee!



After looking into it more, I decided to give the Cypress "Programmable System on a Chip" CY8CKIT-059 a try for $15 from Digi-Key.  Their development board plugs directly into a USB port, it has a Cortex M3 core, and 5-volt I/O.  Their IDE looks very interesting, and implementing a quadrature decoder is just a matter of dropping one into the schematic and connecting it up.  Potentially capable of a great deal more, too.

At least I think so.  I hope to have the opportunity to try it out soon.

-Jon


----------



## jh1990

Any updates?


----------



## Briney Eye

jh1990 said:


> Any updates?


A few too many other things going on right now to work on it, but I should soon have a new NEMA 24 motor from Stepperonline and plan to swap it in after Thanksgiving. Then I'll try to get more work done on the code. Thanks for asking.


----------



## Qtron

Briney Eye said:


> Our local Tech School is having a Maker Space open house next week that I'm thinking of attending.  There certainly ought to be people there who can provide some insight/advice on putting out a product.
> 
> 1) All of the buttons on other ELS's is why I went to the Touchscreen-plus-Knob.  I offloaded a lot of complexity to the Nextion display so that the Mega could just do the real-time work.  No way I wanted a mess of connections to a front panel.  Been there, done that.  I have a breadboard stacked between a DIN-rail terminal block and the Mega with a couple of RC filters and pullups on it, and a header to consolidate the display/knob connections.  If I do a product, I will make a board to do all of that.
> 
> 2) Pre-computing is the way to make it efficient and fast.  In fact, I think it would be kind of silly to do it any other way (but I started doing this back when a 6502 was hot stuff, so the Mega looks pretty nimble to me).  The spindle count just provides an index into a lookup table, allowing the interrupt handler to execute in a few microseconds.  At 1500rpm my spindle is interrupting at 20khz, so there is only 50us between ticks to get everything else done.  If you have to do any math at all you quickly get in trouble.
> 
> 3) So far the Mega is handling my setup pretty well.  I bought a Due just in case, but haven't needed the hardware quadrature decoding.
> 
> 4) Look at the Nextion lineup.  I ignored their Arduino library and parse everything myself with a couple of simple case statements.  Keep the protocol simple and it leaves you with lots of cycles to do other things.
> 
> My Model 200 looks stock until you notice the touch screen and the enclosure under the pan.  I want to keep it that way.


Hi Jon, been a bit out of touch lately, 
Hows it all going? Are U close to publishing the code?
One Q I been meaning to ask is, assuming u saw a bit of Clough42's exposé on why he chose the 'big guns' 90 MHz TI Piccolo MCU, which uses the separate hardware based F.P. processor, do you not see the need for similar handling capability, or is his an overkill?
I am MOST interested in your point of view on this..


----------



## Briney Eye

Qtron said:


> Hi Jon, been a bit out of touch lately,
> Hows it all going? Are U close to publishing the code?
> One Q I been meaning to ask is, assuming u saw a bit of Clough42's exposé on why he chose the 'big guns' 90 MHz TI Piccolo MCU, which uses the separate hardware based F.P. processor, do you not see the need for similar handling capability, or is his an overkill?
> I am MOST interested in your point of view on this..



Just got back yesterday from a Mobile, Alabama visit with our daughter and her family. The new Nema 24 motor was in the mailbox, and I am eager to try it out along with a lower gear ratio. Stay tuned. I hope to upload something in the next few days.

I haven't watched Clough42's video on that, so I should go look for it. Our backgrounds must be very similar, so I'm interested in his take. The only place that I might even consider doing real floating point would be in the initialization code when building the lookup tables, and I haven't found it necessary so far. I don't drop steps even when updating the table while running. I've got nothing against math coprocessors, which can be faster than the core processor even on simple algebra, and probably offer some parallelism as well so there is less of a concern with interrupt blocking.

I've thought that dedicated quadrature decoding might be nice, but I have as much resolution on the spindle encoder as I can use right now. There's no significant difference in the price of a 200ppr encoder versus the 800ppr one that I'm using. Years ago that wasn't the case. The noise immunity might be very slightly better with true quadrature logic than the simple scheme that I'm using, but I haven't detected any issues with what I'm doing since reducing the values of the pull-up resistors to get faster rising edges. The internal pull-ups on the Arduino are too slow.


----------



## Qtron

Briney Eye said:


> Just got back yesterday from a Mobile, Alabama visit with our daughter and her family. The new Nema 24 motor was in the mailbox, and I am eager to try it out along with a lower gear ratio. Stay tuned. I hope to upload something in the next few days.
> 
> I haven't watched Clough42's video on that, so I should go look for it. Our backgrounds must be very similar, so I'm interested in his take. The only place that I might even consider doing real floating point would be in the initialization code when building the lookup tables, and I haven't found it necessary so far. I don't drop steps even when updating the table while running. I've got nothing against math coprocessors, which can be faster than the core processor even on simple algebra, and probably offer some parallelism as well so there is less of a concern with interrupt blocking.
> 
> I've thought that dedicated quadrature decoding might be nice, but I have as much resolution on the spindle encoder as I can use right now. There's no significant difference in the price of a 200ppr encoder versus the 800ppr one that I'm using. Years ago that wasn't the case. The noise immunity might be very slightly better with true quadrature logic than the simple scheme that I'm using, but I haven't detected any issues with what I'm doing since reducing the values of the pull-up resistors to get faster rising edges. The internal pull-ups on the Arduino are too slow.


Thankyou kindly for your update,

Sounds like the town of Mobile a long way from U!
 I looked again at your screens on the Nextion display, and am now unsure if my Taiwanese lathe would 'fit' with what you are doing as far as backgears speed selection goes. (BTW, it appears the Clough42 Grizzly lathe doesn't appear to have any!)
Pls see snap of my backgear speeds, (backgears are spur gears & very noisy despite minimal wear
	

		
			
		

		
	



	

		
			
		

		
	
, hate using them).
Cheers,


----------



## Briney Eye

Qtron said:


> Thankyou kindly for your update,
> 
> Sounds like the town of Mobile a long way from U!
> I looked again at your screens on the Nextion display, and am now unsure if my Taiwanese lathe would 'fit' with what you are doing as far as backgears speed selection goes. (BTW, it appears the Clough42 Grizzly lathe doesn't appear to have any!)
> Pls see snap of my backgear speeds, (backgears are spur gears & very noisy despite minimal wear
> 
> 
> 
> 
> 
> 
> 
> 
> 
> View attachment 306954
> 
> 
> 
> 
> 
> 
> 
> 
> 
> , hate using them).
> Cheers,


I'm not sure what you're thinking your problem might be.  Your maximum speed is 1240rpm (unless you've got a VFD).  That, and the spindle encoder resolution, determine your maximum interrupt rate.  I'm easily handling 1500rpm and could push it higher.  The slower the spindle turns the easier things get.

My lathe doesn't have a gearbox.  My ELS provides a complete "virtual" gearbox.  If you're going through a gearbox you will have to approach things differently (like Clough42 has done).  I haven't really watched many of his videos, to be honest.  I'm listening to his very first ELS installment again while typing this.  First thing I notice is that he's chosen 4096 counts per rev on the spindle.  He boxed himself in and probably forced the use of a faster processor right there.  I'm "only" using 800, so my interrupt rate is less than 1/4 of his, and I've still got 32000 counts per inch of resolution at the carriage.  Early design decisions are important.

Eek!  He's doing math on the fly!  Even more processor power required.  I'm way more old-school.  I pre-calculate everything and use the spindle count as an index into a lookup table.  I guarantee that I am never more than 1/32000th of an inch off.

Off the top of my head, if you're using a gearbox, you have two fundamental options.  You can make your ELS simply emulate the gear train between the spindle and gearbox and still use your gearbox normally, or you can implement a more "complete" solution.  I haven't given any thought to how I would do that.  The simplest would be to choose a gearbox setting, leave it there, and derive everything from that.  Or you could have a gear ratio selection option in the ELS.  One advantage of the gearbox is that it provides the mechanical advantage that I have to implement with a fixed ratio between my stepper and leadscrew.  I'll have to watch more of Clough42's videos to see how he approached it.

I'm never going to attempt to cover what I'm doing with the level of detail that Clough42 has, but he really had a product in mind from the beginning.  I considered it, but decided that I didn't want the responsibility or liability and settled on just having fun.  Feel free to ask more questions if you have them, though.


----------



## jh1990

Can you provide more info on how your lookup tables work? Does each thread pitch have a separate lookup table? Does your routine go to the lookup table after every single pulse of the encoder?


----------



## Qtron

Briney Eye said:


> I'm not sure what you're thinking your problem might be.  Your maximum speed is 1240rpm (unless you've got a VFD).  That, and the spindle encoder resolution, determine your maximum interrupt rate.  I'm easily handling 1500rpm and could push it higher.  The slower the spindle turns the easier things get.
> 
> My lathe doesn't have a gearbox.  My ELS provides a complete "virtual" gearbox.  If you're going through a gearbox you will have to approach things differently (like Clough42 has done).  I haven't really watched many of his videos, to be honest.  I'm listening to his very first ELS installment again while typing this.  First thing I notice is that he's chosen 4096 counts per rev on the spindle.  He boxed himself in and probably forced the use of a faster processor right there.  I'm "only" using 800, so my interrupt rate is less than 1/4 of his, and I've still got 32000 counts per inch of resolution at the carriage.  Early design decisions are important.
> 
> Eek!  He's doing math on the fly!  Even more processor power required.  I'm way more old-school.  I pre-calculate everything and use the spindle count as an index into a lookup table.  I guarantee that I am never more than 1/32000th of an inch off.
> 
> Off the top of my head, if you're using a gearbox, you have two fundamental options.  You can make your ELS simply emulate the gear train between the spindle and gearbox and still use your gearbox normally, or you can implement a more "complete" solution.  I haven't given any thought to how I would do that.  The simplest would be to choose a gearbox setting, leave it there, and derive everything from that.  Or you could have a gear ratio selection option in the ELS.  One advantage of the gearbox is that it provides the mechanical advantage that I have to implement with a fixed ratio between my stepper and leadscrew.  I'll have to watch more of Clough42's videos to see how he approached it.
> 
> I'm never going to attempt to cover what I'm doing with the level of detail that Clough42 has, but he really had a product in mind from the beginning.  I considered it, but decided that I didn't want the responsibility or liability and settled on just having fun.  Feel free to ask more questions if you have them, though.


Was thinking of ur backgears screen, https://www.hobby-machinist.com/attachments/img_1974-jpg.287612/
Wasn't sure re my backgears vs yours, and menu settings, as I don't have a clear understanding of your system.. will there be a user manual?
Thankyou again for details.
Looking fwd to JH1990 reply too


----------



## Briney Eye

jh1990 said:


> Can you provide more info on how your lookup tables work? Does each thread pitch have a separate lookup table? Does your routine go to the lookup table after every single pulse of the encoder?


The spindle encoder gives me 800 counts per revolution, so the lookup table has 800 elements.  Changing the pitch/rate repopulates the table.  The total number of steps in one spindle revolution (within 1/32000th) are evenly distributed into the table.  That was a slightly tricky little routine right there.  The spindle encoder generates an interrupt on each pulse and loads a variable with the number of motor steps to generate for that pulse.  One of the counter/timers in a PWM mode generates the step pulses for the motor and counts them in its own interrupt routine.


----------



## Briney Eye

Qtron said:


> Was thinking of ur backgears screen, https://www.hobby-machinist.com/attachments/img_1974-jpg.287612/
> Wasn't sure re my backgears vs yours, and menu settings, as I don't have a clear understanding of your system.. will there be a user manual?
> Thankyou again for details.
> Looking fwd to JH1990 reply too


Oh, that's just an arbitrary collection of spindle speeds that will be different for each lathe.  I mean to have that screen actually indicate valid speed selections for the current pitch, but haven't implemented it yet.  There are fundamental limitations on how fast you can drive the lead screw relative to the spindle speed.


----------



## Qtron

Hiya Jon, 
Just wanted to touch bases with U again ! been too long..
i hope all's well w U & family
Any news?


----------



## Briney Eye

Life is good, thanks for asking.  My wife and I both had the WuFlu in February, along with everybody else it seems, but it wasn't a big deal.  Hardest part was being so exhausted for a week after.  I'm the banjo player in a bluegrass band, we have five gigs this month (one of them tonight), and I have a new Bose sound system set up behind me that I'm figuring out.  We have a third granddaughter due in the next couple of weeks.  Otherwise, not much going on .

I fire up the lathe and do some kind of project every week or so, it seems.  Yesterday I put together a flagpole from 3/4" pipe and some aluminum flag rings I got from Amazon because I was fed up with the flimsy Chinese poles that kept breaking in our persistent winds.  Had to bore out the rings about .050" to fit the pipe, and also had to set up on the mill and bore out the mounting bracket.  This one ought to last.  This afternoon I need to make a mike stand adapter for the new mixer since the local music store is sold out of them.

Hope you are well, too.


----------



## Qtron

sorry so long in replying Jon, Yes all good, thanks
i actually had but got blocked! more on that later..
Anyway glad to hear you are ok, despite the hoorid bug.
hope the gig went ok, with the new Bose system!
my wife would be green re new (or old) granddaughter.
glad u still making chips - therapy! Winds there in New Mexico sound bad..
Am curious as to any new iterations to your ELS firmware --- blue pill STM adventures!!??


----------

