Code Monkey home page Code Monkey logo

electronic-leadscrew's People

Contributors

clough42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electronic-leadscrew's Issues

ELS Boost board open source?

Hi clough42, firstly thanks so much for all the work you've made open source. I'm in the process of building one for a tiny lathe which doesn't currently have a lead screw. I plan to drive the topslide to enable threading and power feed that is otherwise impossible.

Sorry if I missed it, but I am just wondering if the ELS boost board is also open source, since shipping to the EU costs more than the board itself. I am also curious about what code you have running on the ELS board and why a simple level shifter wouldn't suffice there. I notice the board has the openHW logo on it but cant find any of the details anywhere.

Best regards
ccspoz

Control Panel up/down button auto increment/decrement.

Here's a tiny improvement to the control panel up/down buttons. See the code below for a description of how the buttons will work.

If you want to try this,

  1. add the file ButtonStateMachine.cpp to the project.

  2. add these defines to ControlPanel.h
    #define NO_ACTION 0
    #define INCREMENT 1
    #define DECREMENT 2

  3. add this to UserInterface.h
    int ButtonStateMachine(bool incrementButtonPressed, bool decrementButtonPressed);

  4. in ControlPanel.cpp, change this line in getKeys to mask off the increment/decrement buttons so they are sent every loop.
    if( (newKeys.all) != (this->keys.all & 0xF8) )

  5. make these changes in UserInterface.cpp
    int action;
    ...
    if( keys.bit.FWD_REV )
    {
    this->reverse = ! this->reverse;
    // feed table hasn't changed, but we need to trigger an update
    newFeed = loadFeedTable();
    }

    action = ButtonStateMachine(keys.bit.UP, keys.bit.DOWN);

    if( action == INCREMENT )
    {
    newFeed = feedTable->next();
    }
    if( action == DECREMENT )
    {
    newFeed = feedTable->previous();
    }

// original code
// if( keys.bit.UP )
// {
// newFeed = feedTable->next();
// }
// if( keys.bit.DOWN )
// {
// newFeed = feedTable->previous();
// }


Here's the code for the button state machine:

// FILE: ButtonStateMachine.cpp
// DATE: 14 Jan 2020
// AUTHOR: Jan (Yan) Woellhaf
// [email protected]
//
// Description:
// When I worked for Ampex in the 80's, I was introduced to a clever way
// to handle an up/down button pair.
//
// I'll describe how the Up button behaves. The Down button works the same,
// but values decrease, rather than increase.
//
// With both buttons not pressed, nothing changes.
//
// When Up is pressed the value immediately increments by one, and the
// initial delay timer starts.
//
// When the initial delay timer reaches its setting, say after one second,
// the value increments by one, and the auto slow delay timer starts.
//
// When the auto slow delay timer reaches its setting, say after a half
// second, the value increments and the auto slow delay timer is reset.
//
// This continues until the Up button is released.
//
// To this point, the action is quite normal. However, the interesting
// action happens when the Down button is pressed as the Up button
// continues to be pressed.
//
// With the direction established by the Up button, holding both
// buttons down accelerates the auto increment. Whereas increments
// were occurring twice per second, they now occur ten times per
// second.
//
// My contribution to this scheme was to create the state machine to
// control these actions. It's a good solution, because it forces the
// designer to consider every possible combination of button configurations
// and actions.
//
// I've seen many, many devices with Up/Down button pairs, but none have
// implemented this simple but effective scheme.

#include "F28x_Project.h"
#include "UserInterface.h"

// delays in units of control panel loops -- change as you prefer
#define INITIAL_DELAY 40 // delay before auto slow increment/decrement begins
#define SLOW_DELAY 18 // delay between changes in auto slow increment/decrement
#define FAST_DELAY 6 // delay between changes in auto fast increment/decrement

#define INPUT_NEITHER_BUTTON_PRESSED 0
#define INPUT_INCREMENT_BUTTON_PRESSED 1
#define INPUT_DECREMENT_BUTTON_PRESSED 2
#define INPUT_BOTH_BUTTONS_PRESSED 3

#define STATE_IDLE 0
#define STATE_WAIT_FOR_AUTO_SLOW_INCREMENT 1
#define STATE_WAIT_FOR_AUTO_SLOW_DECREMENT 2
#define STATE_AUTO_SLOW_INCREMENT 3
#define STATE_AUTO_SLOW_DECREMENT 4
#define STATE_AUTO_FAST_INCREMENT 5
#define STATE_AUTO_FAST_DECREMENT 6

int ButtonStateMachine(bool incrementButtonPressed, bool decrementButtonPressed)
{
static Uint16 loopCount = 0;
static Uint16 state = STATE_IDLE;
char buttonConfiguration;
int returnValue = NO_ACTION;

++loopCount;

    // get button configuration for input to state machine
if (decrementButtonPressed && incrementButtonPressed)
{
    buttonConfiguration = INPUT_BOTH_BUTTONS_PRESSED;
}
else if (decrementButtonPressed)
{
    buttonConfiguration = INPUT_DECREMENT_BUTTON_PRESSED;
}
else if (incrementButtonPressed)
{
    buttonConfiguration = INPUT_INCREMENT_BUTTON_PRESSED;
}
else
{
    buttonConfiguration = INPUT_NEITHER_BUTTON_PRESSED;
}

// set default returned action
returnValue = NO_ACTION;

switch (state)
{
    case STATE_IDLE:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_INCREMENT;
                returnValue = INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_DECREMENT;
                returnValue = DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                    // It would be difficult to press both buttons simultaneously
                    //   enough that one would not be read first.
                state = STATE_IDLE;
            break;
        }
    break;
    case STATE_WAIT_FOR_AUTO_SLOW_INCREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                if (loopCount >= INITIAL_DELAY)
                {
                    loopCount = 0;
                    state = STATE_AUTO_SLOW_INCREMENT;
                    returnValue = INCREMENT;
                }
                else
                {
                    state = STATE_WAIT_FOR_AUTO_SLOW_INCREMENT;
                }
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_DECREMENT;
                returnValue = DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                loopCount = 0;
                state = STATE_AUTO_FAST_INCREMENT;
                returnValue = INCREMENT;
            break;
        }
    break;
    case STATE_WAIT_FOR_AUTO_SLOW_DECREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_INCREMENT;
                returnValue = INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                if (loopCount >= INITIAL_DELAY)
                {
                    loopCount = 0;
                    state = STATE_AUTO_SLOW_DECREMENT;
                    returnValue = DECREMENT;
                }
                else
                {
                    state = STATE_WAIT_FOR_AUTO_SLOW_DECREMENT;
                }
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                loopCount = 0;
                state = STATE_AUTO_FAST_DECREMENT;
                returnValue = DECREMENT;
            break;
        }
    break;
    case STATE_AUTO_SLOW_INCREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                if (loopCount >= SLOW_DELAY)
                {
                    loopCount = 0;
                    returnValue = INCREMENT;
                }
                state = STATE_AUTO_SLOW_INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_DECREMENT;
                returnValue = DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                loopCount = 0;
                state = STATE_AUTO_FAST_INCREMENT;
                returnValue = INCREMENT;
            break;
        }
    break;
    case STATE_AUTO_SLOW_DECREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_INCREMENT;
                returnValue = INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                if (loopCount >= SLOW_DELAY)
                {
                    loopCount = 0;
                    returnValue = DECREMENT;
                }
                state = STATE_AUTO_SLOW_DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                loopCount = 0;
                state = STATE_AUTO_FAST_DECREMENT;
                returnValue = DECREMENT;
            break;
        }
    break;
    case STATE_AUTO_FAST_INCREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                // the decrement button has just been released
                // stop the auto fast increment and return to auto slow increment
                loopCount= 0;
                state = STATE_AUTO_SLOW_INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                // the increment button has just been released
                // stop auto fast increment and go to auto slow decrement
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                // continue auto fast increment
                if (loopCount >= FAST_DELAY)
                {
                    loopCount = 0;
                    returnValue = INCREMENT;
                }
                state = STATE_AUTO_FAST_INCREMENT;
            break;
        }
    break;
    case STATE_AUTO_FAST_DECREMENT:
        switch (buttonConfiguration)
        {
            case INPUT_NEITHER_BUTTON_PRESSED:
                state = STATE_IDLE;
            break;
            case INPUT_INCREMENT_BUTTON_PRESSED:
                // the decrement button has just been released
                // stop auto fast decrement and return to auto slow increment
                loopCount = 0;
                state = STATE_WAIT_FOR_AUTO_SLOW_INCREMENT;
            break;
            case INPUT_DECREMENT_BUTTON_PRESSED:
                // the increment button has just been released
                // return to auto slow decrement
                loopCount = 0;
                state = STATE_AUTO_SLOW_DECREMENT;
            break;
            case INPUT_BOTH_BUTTONS_PRESSED:
                // continue auto fast decrement
                if (loopCount >= FAST_DELAY)
                {
                    loopCount = 0;
                    returnValue = DECREMENT;
                }
                state = STATE_AUTO_FAST_DECREMENT;
            break;
        }
    break;
    default:
        state = STATE_IDLE;
    break;
}
return returnValue;

}

Question about basic functions

Hi James,

My ELS is functional! Thanks for your initiative in realizing this project!
However, having watched your vlogs several times I was unable to find an answer to three basic questions:

Are the following functions already implemented?

  • Power on/off. If so, it doesn’t work on my system.
  • Set function. Pressing it returns a "No Setting” message. Is it supposed to do more at this stage or is it Work in Progress?
  • Eprom function: What is (or will be) the purpose and how does (will) it work?

I am not sure if this is the right place to ask questions like these. If not please advise.
Kind regards,

Hans

STEPPER_RESOLUTION in SanityCheck.h

why are the max stepper resolution set to 2000?

I run a hybrid stepper servo with a resolution at 1600. and er gear ratio 2:1
so my resolution in software would be 3200.

i just change the setting in the SanityCheck.h file, but could there be some problem in that.?
is the hardware capable to do the math fast fast enough..?

Connector on front of display board interferes with mounting in box

The pin headers on the front of the display board will not allow for a connector to be attached when the display is mounted inside the enclosure.

From the video where James is engraving and mounting the box, it looks to me like he has moved the connector to the back of the display board.

I noticed in one scene, the display board he is using on his breadboard has the connector on the top. So it seems, that he has the same type of board that I do.

Jody

Cheap Power Alternative

Thinking this could be useful to anyone that doesn’t have a proper bench power supply (and doesn’t already know about these). It’s a cheap way to get your 3.3v / 5v / 12v / 24v rails all in one shot. Just need an old ATX PSU and one of these breakout boards.

http://dangerousprototypes.com/blog/2014/09/19/atx-breakout-board-bench-top-power-supply-build/

Most PSUs are probably not stout enough to drive a stepper long-term, but it should be good enough for testing. These are available for a few bucks everywhere.

Feed Rate/Threading calibration issue

Finished up an install, and noted that the feed rate was way too slow, and when doing some initial testing of threads, double checking my setup several times, ie 1:3 gear ratio, on a 1000 pulse servo, 8 tpi screw (Precision Mathews 1022V), I was for a tpi of 8 (had to use the coarsest pitch to get a match), I was actually getting a 26 tpi. Simple math fix of 3.25 fixed it for me, and every thread pitch I did in either standard or metric is now spot on with a thread pitch tool check. My final settings where 1000*9.75 (3 for the gear ratio, 3.25 for the calibration fix).

Also, during setup, and before I got the servo programming cable, there seemed to be a very odd interplay with what I set for the encoder settings, as it was 4x off (my encoder was a 1K, but i had to set it to 250 to get a reading the same as the rpm already on machine. This seemed to be because of the feedback of the 1K i was using for my servo (which had the default 4K setting from factory). When I set it to 1K, then my encoder setting had to be set back to normal (as it was now 4x too high), and all seemed to be good.

Is there a setting you used for your built in servo encoder, I left it at the 4K factory default, only changing the pulse count from 4K to 1K as you mentioned in your video.

Feature Request: Simple dividing head readout

Hi James et al,

I am gauging interest for a feature idea. Would we also want the control board to have a 'dividing head' mode? Something where, suppose a brake is fitted to the spindle, one can rotate the spindle around a certain number of encoder counts for simple divisions and engage the brake. Useful for simple divisions of a circle for cross drilling holes, or slotting. If one were desperate, they could also use it for involute cutting a gear using the carriage like a shaper, though I question how accurate this would really be.

I am willing to work on writing this. I figure, given there is already an encoder on the spindle, and a spare button or two on the control board, perhaps this is doable.

If the interest is not all that high, I'll just put some optocouplers in as buffers and fanout the encoder to a second board for my own DRO project.

target

I am unable to connect to ti board. Receiving "error connecting to target" when trying to flash board.
I am completely new to this environment, so bear with me. Little guidance would be appreciated.

win 7 64 bit, port is recognized by computer

thanks
archie

formula calculation

I have see all your videos , I have a point which is not clear to me.
The rotation of the spindle is transferred to the encoder via 2 set of gears :
42 tooth gear (spindle) >>> 62 tooth (1st shaft) , ratio is 42/62 = 0.6774…. ) and
40 tooth (1st shaft) >>> 60 tooth (encoder shaft) , ratio is 40/60 = 0.6666…..
So the ratio for the gears is not exactly 1:1. Also , stepper motor to leadscrew is calculated have ratio 3:1. I know you have enter all these ratios to your final calculating formula.
In may case is difficult to use 42/62 tooth gear (ratio 0.6774....) to read the spindle rotation, this means other ratio , Let me know please how can compensate this calculation error ? Need to change any multiplier at configuration file ?
For example if I use: 60/80 tooth (ratio 0.75) ( instead of 42/62 ratio=0.6774....... ) for the 1st set gear and 40/60 for the 2nd set the calculations will be not correct. I need a "compensation. What will be the compensated value and where I shall declare it ?
Thanks for helping

Best of both float and int calculatons

Here is a simple, fast way to keep the loop timing loop short using the hardware floating point AND eliminate the round off errors created as the count runs for a longer time. By periodically computing an error difference in the result from the floating point and numerator/divisor integer calculations: Then adding this error in the floating point interrupt code.

In core.h
#ifdef USE_FLOATING_POINT
//******************* add an error adjustment calculated in extra cycles using Int ******************
return ((float)count) * this->feed * feedDirection + error;


Then in extra cycles in the main loop (outside the interrupts)
count_grab=count; //make a copy of the volatile counter constantly being changed by hardware
error = ((long long)count_grab) * feed->numerator / feed->denominator * feedDirection
- ((float)count_grab) * this->feed * feedDirection ;

//make sure int error=0 at startup

The error will change rather slowly and can be updated every few seconds. By adding the calculated error in the floating point loop the microstep error can be reduced to 1.

Interface PCB available?

Just looked at your eBay page in regards to the "boost" PCB (?) or as I call it interface PCB and you are still out of stock. So are there any more on the way or better yet (for me that is) I sure could use a schematic of this PCB and where it connects to the TI board but I have not found any. If I had that I could create my own PCB to my own tastes but I do like the way it plugs into the TI PCB. I can probably find a drawing that shows the dimensions of those 2 connectors on the TI board so I can do the same.
So are PCB's available now or where can I get a drawing/schematic of the same PCB?
Thanks for a great project!
Bruce

Encoder wiring

James, Hi. I have the software and hardware to the test status. There are no wiring details on the wiring sequence for the encoder to the TI board. I am using identical components to your set up. There are 18 possible ways to connect the encoders 3 wires to the three input pins on the board. Please enlighten me to the correct sequence. Thank you, Richard. PS It works as described bar the forward/ reverse does not work.

Mini-Lathe

Has anyone converted the Harbor-Freight 7x14, SIEG style lathes and have documentation on it as to the steps you took?

Using a LUT

One example you gave in youtube comments was 13 tpi with a 12 tpi lead screw.

I'll start with a 12 tpi to 12 tpi example:
4096 pulses = 1600 steps
So in the init use LUT[n] = map(n, 0, 4096, 0, 1600) to fill a look up table to use in the interrupt.
( 0 or 1 to start the range? Anywho... (actually I'm pretty sure this is really important to keep accuracy but then I'd actually have to write code and do a unit test or something) )
This is the best accuracy you can get.

Now the 13 tpi to 12 tpi example:
4096 pulses x 12 rev = 1600 steps x 13 rev
49152 pulses = 20800 steps
you don't want a LUT this big maybe?
gcd( 49152, 20800) = 64
768 pulses = 325 steps
so do the map again LUT[n] = map(n, 0, 768, 0, 325)

Oh hey, maybe we should've done a gcd for the first example
gcd(4096, 1600) = 64
hmm... you don't think? Nah, couldn't be important.
so LUT[n] = map(n, 0, 64, 0, 25)
and stranger ratios will just increase your LUT size.

I won't be able to implement this until next week, but I have a teensy, stepper, encoder, and drive motor to test it on. The G0602 is in storage though :(

Automatic stop with limit switch

Turning to a shoulder confidently will be awesome!

Automatic Stop idea -

If we add a GPIO input to a touchprobe on a magnetic base - we might be able to set an automatic stop when the singlepoint enters the relief at the end of the thread.

  • Connect probe (3.5mm audio jack)

  • Enable probe in UI - verify probe with touch led.

  • Magnetic base on probe

    • Set probe on ways, touching the lathe carriage after manually driven to the proper location.

Concerns -

  • Tip of probe should be lightly sprung to prevent damage when the carriage contacts the probe.
  • Magnet/arm on probe needs to be rigid - but a mini-noga arm may be rigid enough, and widely available at low cost.

Configurable ratios for stepper / encoder pulleys / gears

Hello,

Maybe I’m missing something simple again- but where would we configure the ratio for the pulleys (1:2 stepper driving lead screw, for example)? I would actually prefer to use gears in my setup, if at all possible. Would something more like a teeth setting ratio be possible (120:127 gears) to drive the leads screw?

I expect my encoder to be a 1:1, but curious if that configuration parameter exists (or will exist) as well?

Thank you again for this project! I’m pretty close to actually testing mine (especially if I can use gears;).

PCB Files

James, what an awesome project and they way you explain stuff, is way above most anyone else I've seen. I'm not sure how else to get in touch with you, I did leave message in Youtube but you may not have seen it, under Video 8. Please let me know of a better way to ask a question. I have all my parts, I have started building mounts for the encoder and servo, If you would be willing to share the gerber files for the small board you designed I could get it ordered and on the way and build it. I do have a reflow oven as well.

Sincerely, Kelly

Known good configs in the Wiki?

As title - how about a known good config section, where we can share lathe, leadscrew, encoder and motor configurations that have been implemented and shown to work? Pics of hardware placement as well.

Might be of use to those starting out, or thinking of moving their current setup to a new lathe.

Problem with Circuit Board

I got the circuit board on the first batch and put the connectors on it and powered it up. Thought I would, just for the record, measure the voltages and make sure all was OK. Found the 5v a bit high, 5.37v and measured about 35mv of ripple on both the 5v and the 3.3v. Somewhat high, so I put the scope on it to take a look; found some strange kind of oscillation that looked like 'ringing' with a pulse of it about every 15 or 20 milli-seconds. Not large but running about .5-volts at the maximum. It looked like the regulator was oscillating, but weird even for that. For this I was using the brand new transformer 5v supply that was listed by the design.

Just to be sure, thinking maybe it was somehow a defective board, I went ahead and ordered another board, but in the meantime thought I would do some checking. I didn't like the 5v being at 5.3 volts, so, I connected up another 'wall-wart' 5v supply I had just to see what it would do. Lo and behold, no oscillations. Five-volts was 5.1v, which is exactly what it should be and 3.3 was 3.27v and ripple measured zero -- scope showed 'straight-line' with sensitivity at 5mv/div.

Connected back to original supply and the oscillations returned. Somehow it seems that the wall-wart was causing the oscillations?? I have never seen that, but II will not use that supply and now I have a spare PC-board that I hope I don't need. I don't know that the oscillations would have affected the operation of the system, but with low-voltage digital, you never know; half a volt of 'garbage' is pretty significant to a 3.3v signal.

Error on Stepper Driver and no motor movement

Greetings all. I've got my rig set up to test, I have the Launchpad XL, James' interface board, and the Hybrid Stepper and controller he recommends KL-23N-1000 and KL-5080H, OMRON Encoder E6B2-CWZ6C, and the LED/Key interface board. I flashed the Launchpad after changing the TPI of the leadscrew to 8 (Logan 14x40). The Interface displays CLOUGH42 upon bootup and ELS 1.0.0.3.
I've got a Toroidal Power supply putting out 46V going into the Hybrid Controller.
I get a green LED on the 5080H, but after spinning the encoder a few times, the red error LED comes on, flashing 7 times, pause, then repeats, indicating a positioning error. The motor will give a little jerk maybe once or twice before the error, otherwise, the motor doesn't move. I've double checked my wiring, and honestly am at a loss as to the issue.
I've tried it in TPI, Metric and SAE, and none of that seems to matter. If I press the 'Set' button, the display shows "NO SETTINGS"... Did I miss something? Probably something silly, but I can't seem to see the forest through the trees. Any thoughts or direction to go would be much appreciated.

Thanks!

Add max speed protection

There should be a limit to how fast the ELS will dry to drive the physical leadscrew. Without protection, it's possible to set the ratio for 8TPI (4mm?) and then spin the lathe up to 3000RPM. This is completely unrealistic and may cause loss of synchronization or even physical damage.

Suggest an RPM limit in Configuration.h.

The ELS should hard-limit the speed and display a warning on the control panel.

Stuff you will need issues

In the project wiki, the list of stuff you need has bad links. The servo/stepper hybrid motor and the motor driver are dead links. Could you either post updated links or enough specs on both so I can source them?

Import tax an handling

When ordering at Mouser.com you have to choose an address remember that at the bottom of the page under "delivery type" to choose "commercial" now you can choose DDP
Carrier Cost
DDP (Duty and customs fees paid by Mouser)
FedEx International Priority
I had to pay $ 15.57 in sales tax and $ 23.73 in customs clearance.
Regards Jorgen Denmark

Launch Pad j12 connection

I broken two traces on the Launch Pad at J12. I can't find documentation or schematic from TI web site on specific traces. What would it take to move to J13 if possible? Or can you tell me where J12 1A 1B and 1I trace too? Any help would be appreciated

Control panel update frequency -- question

With version 1.1.02 running in Release mode, When I measure the time pin 75 of J8 stays high, I get about 1.5 ms. That should be the time required to update the panel.

The pulse's repetition period is about 17 milliseconds, but I expected it to be about 11 ms.

It appears line 149 {DELAY_US(1000000 / UI_REFRESH_RATE_HZ);} in Main is not working as expected.

UI_REFRESH_RATE_HZ is 100, so the delay should be 10,000 us, or 10 ms.

What am I missing?

Servo/Stepper wire diagram to the KL-5080H

I know there are documented on the automation web page found here
https://www.automationtechnologiesinc.com/products-page/hybrid-servo-system/hybrid-servo-drive-kl-5080h/

From the web page:
U to Brown
V to Blue
W to Black

My wires are not the same they are the following colors,
Black, Blue, Yellow, and a RED wire. the Red wire was cut flush to the end of the cable.
I have tried
W to Black
V to Blue
U to Yellow

When I try and test my rig, using the programming cable thru a USB cable no matter what configuration I config the test with, it only moves slightly, then does absolutely nothing the fault light on the driver lights up red, and an Alarms "Position Following Alarm".
Can anyone shed light on this? From other posts I noticed that I need to rewire my encoder connection to the rocket board. I'll do that once I am done at work, and send an update in a few hours.

3.3V display board

When I was doing my implementation, and had issue with my display board, I went to test it out, and found most all references for the use of it just used 3.3V supply, foregoing the level shifter all together. When I got a few replacement ones, they worked happily that way out of the box, so a simpler circuit where the display connects directly to the TI board was all that was needed.

Comment Code or Add Default Feed Table variables

Noted, i had to hunt around on how default values where set for the feed table (factory), ended up adding this message to the Tables.cpp code above 'FeedTableFactory::FeedTableFactory(void):' line:

// Last section of each factory definition is the default value used when initializing that table,
// zero based count of course. Values from that point are sticky, ie whatever user set last.
FeedTableFactory::FeedTableFactory(void):

I did modify mine to start with an initial inch feed rate of .01 instead of .005, and was really easy to modify tables to my liking. Note, my thread rates are actually set around UNC/UNF for for 1" down to 6 size screw, other entries where insanely small. For metric, used M3 on up, as the ones below are sooo tiny. Note I did kill the ones above 3.0 (which are > 1" equivalent size anyhoo), as those where insanely large, and fairly hard on drive mechanism (ie swap over to those rates would cause servo fail mode if you wheren't at zero speed, and even at start up, you would need to be going very slow, ie 50-100 rpm, not to cause a fault) .

My own preferences.

Hack to make Set button change brightness -- until James adds its functionality.

To reassign the Set button to change display brightness circularly, make these three changes:

  1. In <ControlPanel.h> add
    // increment brightness circularly
    void incrementBrightness(void);
    after
    // set a brightness value, 0 (off) to 8 (max)
    void setBrightness(Uint16 brightness);

  2. In <ControlPanel.cpp> add
    void ControlPanel :: incrementBrightness( void )
    {
    ++this->brightness;
    if (this->brightness > 8)
    {
    this->brightness = 1;
    }
    }
    after
    void ControlPanel :: setBrightness( Uint16 brightness )
    {
    if( brightness > 8 ) brightness = 8;
    this->brightness = brightness;
    }

  3. In <Userinterface.cpp> change
    if( keys.bit.SET )
    {
    setMessage(&SETTINGS_MESSAGE_1);
    }
    to
    // change Set key to increment brightness circularly
    if( keys.bit.SET )
    {
    controlPanel->incrementBrightness();
    }

Note: Because of the screwy way the TM1638 controls brightness in steps of 1/16, 2/16, 4/16, 10/16, 11/16, 12/16, 13/16, and 14/16, there are really only four distinct levels. I think I'll change
void ControlPanel :: incrementBrightness( void )
{
++this->brightness;
if (this->brightness > 8)
{
this->brightness = 1;
}
}
to
void ControlPanel :: incrementBrightness( void )
{
++this->brightness;
if (this->brightness > 4)
{
this->brightness = 1;
}
}

(Sorry about the odd formatting. GitHub changes what I type to what it likes, I guess.)

Software installed and working 👍

James
Software installed and encoder & hybrid stepper working ok. The next phase is to get the hardware mounted on the lathe using suitably designed brackets/mountings. I will be using this on a metric lead screw with a 3mm pitch.

I’ve incorporated the Jon Woellhaf fast scroll/ auto increments mods (#48) to the code which works well.

Great project...

Best regards
John 🇬🇧

New feature idea: Electronic thread indicator for hybrid thread cutting.

Hello James,

After watching your video about complications of cutting hybrid threads, I got an idea.

So during hybrid thread cutting it is not possible to use thread indicator because conversion math between inch and millimeters does not produce whole number on thread indicator.

But since ELS already know position of the lead screw at any time you can calculate ideal position to reengage half-nut.
And then present this in the UI in form of "progress bar" of some kind so user can anticipate and lock half-nut in correct position.

New feature: encoder driven hand-wheel

Hello James,

Is it possible to add following feature:
Switching between encodes input base on lead screw engagement leaver. Something like in this clip: https://www.youtube.com/watch?v=lMS2DAUD_DA .I have a small metric lathe during retrofitting to your ELS and wanted to use ball-screw with closed loop stepper around 8.5N.m remove split nut. It would be nice to know what you thing of that idea.

Thanks!

Hybrid Stepper not moving properly - SOLUTION

OK,

I spent way too much time down electrical rabbit holes on this one....

KL-5080H Hybrid Servo Drive / KL23-2N-1000 Nema 23 hybrid stepper

Problem: everything works, but the hybrid stepper only moves a few steps in either direction at very slow speed, and then stops moving. Holding the stepper frame, you can feel the step pulses continuing, but no more rotation, until re-powering the driver.

Solution: Unplug the stepper encoder from the driver, and plug it into the 6' cable that came with it. Apparently the pinout from one end of the cable to the other is not straight-through. Plugging the motor directly into the drive causes the problem.

Gear Ratio

Mr Clough,
I have Grizzly G9972 lathe. I have been trying to get the ratio for threading right. So far no luck.The Configiration.h file reads:
Encoder uses 1:1 ratio from the spindle(45T to Idler 45T) to 60T stacked on the idler and 60T on the encoder. Resolution set to 4096
Servo motor same as yours 1000 P/R
Servo motor 24T to 72T L/S 3:1 ratio
Stepper Resolution 1000
Microsteps 3
Lead screw TPI set to 8
What am I missing? Any help would be greatly appreciated.

Thank you,
Vrossi8050

build progress

is it acceptable to post build progress pics in this section? links to you tube videos?
thanks
archie

Software Direction toggle

When I got my install done, I noted that because of not going through any gears at all, I think my default direction is backward, and after power on, i have to reverse the direction to get it to feed in. Possible to add this to the configuration.h file as a flag?

SUCCESS!! Well, with a problem -- help

OK. I have the ELS built and working, well essentially working, on the workbench. Basically using James' configuration with the servo; and it all works -- almost like it should. My servo is turning only about 1/8th proper speed. I am using the motor and controller package from Automation Technologies and here is what is happening:
With the ELS set for 12 threads/inch, if you rotate the encoder one revolution, by my thinking the servo should rotate 3 revolutions (assuming a 3:1 gearing ration, servo to Lead Screw); it only rotates about 1/4 of a revolution. The servo speed tracks as you vary the settings mostly as it should but just too slow
Am I missing some adaptation parameter? Or do I need to go into the servo driver and change something? I do have the programming adapter and I can see the motor on my computer; I have not changed any parameters on the motor/driver.

Anyone???

defect voltage regulator?

Hi James,

today I started soldering the parts on the PCB (following your video no. 12). First i soldered the power connector and motor connector and checked for 5V and 3.3V.
I am measuring 12.2V at the 5V connection, and 11.3V at the 3.3V connection. My powersupply supplies 12.2V. The PCB starts to get warm after a few seconds.

I have some basics in electronics but i am surely not experienced as you. I cant see anything on the board, so I think the voltage regulator is defect but I also know that you check all of your boards. On the pictures you can see the PCB. Is there anything I can do or look for?

thanks again for sharing your project :)

regards,
Ilhan

PCB top
PCB back
PCB measure 5V
PCB measure 3V3
PC measure powersupply

Use standard metric unit

Thanks for your video series, I stumbled across one yesterday evening and have been binge-watching from the beginning since..!

A minor suggestion though, that might avoid some confusion for metric users, rather than using 'made-up unit' hundredths of a millimetre 'hmm', 1.5mm = 150hmm, you could instead use the SI unit of micrometres (aka microns) 'μm' (or 'um'), 1.5mm = 1500μm.

Thanks again, really enjoying the videos, just thought that might be a slight usability improvement for some people that maybe you weren't aware of/didn't think of being used to working in Imperial and more explicit fractions. Cheers.

(PS: I don't even have a lathe, but I'm still enjoying the idea of making an electronic leadscrew for one 😄. Maybe future series will teach me to build the rest of the machine? 😉)

Review code comments from Mike Lawrence

Mike left a comment on YouTube:

Mike Lawrence • 2 hours ago
@clough42

Did a quick look at the code. Would you prefer comments on GitHub?

Since this interrupt is modifying
this->currentPosition--
don't you need synchronization (a semaphore, volatile, atomic_int, etc);to prevent main thread calls to
incrementCurrentPosition(1)
from losing the ISR change?

this->currentPosition--;

I noticed floating point constant expressions in your code.

if( count > _ENCODER_MAX_COUNT/2 ) {

rpm = count * 60 * RPM_CALC_RATE_HZ / 4096;

Check the assembler code to see if it's doing the division at runtime. Some compilers defer floating point math to runtime to avoid losing precision. If that's true then you can eliminate this work by doing the divide during initialization.

create a new constants (not macros) for these values and set once:
_ENCODER_MAX_COUNT/2
60 * RPM_CALC_RATE_HZ / 4096

You can shorten

if(reverse ) {
this->feedDirection = -1;
} else {
this->feedDirection = 1;
}

to
this->feedDirection = reverse ? -1 : 1;

switch( this->state ) {

you can do a fast exit if no work
if( this->desiredPosition == this->currentPosition ) return;

This code is not needed since the next line set previous:
if( rpm > 2000 ) { previous = current; }

Implementation experiences

Might it be an idea to start a section where implementation issues (and solutions) can be listed?

I for one had an interference issue making the system extremely unstable. This was resolved by disconnecting (in my electronics box) the ground of the 3V/3.3V and 24V motor power supply.
I also spent considerable time trying to figure out where I could alter the start-up settings to my preferences: metric, thread and reverse direction . I finally found that changing "false" to "true" in UserInterface.cpp line 60 did the trick.
I suspect several of your enthusiastic followers might have start up experiences worth sharing!

Hans van der Veer

Add smooth acceleration for speed changes

The ELS firmware should protect against abrupt speed changes. When making big speed or direction jumps (like switching from feeds to threads, or from forward to reverse) the leadscrew should accelerate and decelerate smoothly.

Without smooth acceleration, it's possible to shock the system, causing synchronization loss or physical damage.

Hi Mr Clough42

I am mounting the display with bottoms for operations. Then I see the arrows keys are turned 180 degrade so the arrow up (plus) is mounted in the position off the arrow down(minus. I did not put names on.
I have looked in the configuration code but I am not a programmer . I can not find the place where s6 and s8 is mentioned. Is there a easy way to change this. Thank you for your fantastic work. I have seen all your videos many times. Jorgen Denmark

Collaboration

I wasn’t sure of the best way to contact you, or where to post. I did get all the hardware and your most recent firmware up and running last night - thank you for this project!

I also have a G0602, so I’ll probably start experimenting with some physical mounting options next. I’m happy to bugtest, maybe create some docs, or whatever else I can do to help.

https://youtu.be/h5dqeUOXpvM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.