[TOC]
Some short demos available on YouTube
https://www.youtube.com/channel/UCVE05OvPm0yVd1yQSVZ0YSA/videos
IMPORTANT NOTE
- Ensure all signal cables are shielded.
- Ensure the shielding is connected to ground at one end, close to the enclosure.
- Ensure the enclosure is connected to power ground.
- Always jog both axes to origin position (0, 0) before starting turning operations
- This ensures any leadscrew backlash is taken care of in the lathe.
- Allows the backlash compensation to kick in, ready for the turning steps.
All hw designs are done in Kicad 6.0.
- hw/els: The main board.
- hw/lcd: The LCD adapter for ILI9481 module
Optional extras:
- hw/buffer: Buffer and pulse shaper, helps keep the PUL signals going to the stepper drivers clean.
- hw/demo-driver: A standalone demo board with drv8825 for testing
- hw/power-clamp: Voltage clamp / suppression board.
Kicad files in hw/els
- Nucleo-F446RE https://www.st.com/en/evaluation-tools/nucleo-f446re.html
- GL850G USB HUB Controller
- CH340C USB UART
- FT24C64A EEPROM
The Nucleo 64 is connected to the main board USB hub with a small cable. Nucleo 446RE will need a fair few jumper changes and soldering to permit the firmware to use the required GPIO pins.
Refer to the GPIO pins listed below in the GPIO Map, the solder bridges for these pins should be setup correctly. See Nucleo 446RE documentation UM1724, Section 6.9 on Solder Bridges for more details. A quick summary for jumper settings and changes I've made.
Jumper / Pad | State | Function |
---|---|---|
SB13 | REMOVE | PA2 for LCD |
SB14 | REMOVE | PA3 for LCD |
SB16 | REMOVE | HSE |
SB21 | REMOVE | PA5 for LCD |
SB50 | REMOVE | HSE |
SB54 | REMOVE | HSE |
SB55 | REMOVE | HSE |
SB62 | ADD | Connects PA2 to D1 on CN9 |
SB63 | ADD | Connects PA3 to D0 on CN9 |
R35 | ADD | HSE, 0R or solder bridge |
R37 | ADD | HSE, 0R or solder bridge |
C33 | ADD | HSE, 18-22pF X7R Capacitor |
C34 | ADD | HSE, 18-22pF X7R Capacitor |
X3 | ADD | HSE, 8MHz HSE Crystal |
D2 (CN9) | WIRE | Wire To CN3 TX for USART2 |
D8 (CN5) | WIRE | Wire to CN3 RX for USART2 |
The main board is primarily a breakout board for the Nucleo F446RE with a USB hub, USB USART controller and additional terminal connectors. You can skip these (GL850G, CH340C and associated passives) and directly wire PA9 and PA10 to the CN3 connectors marked RX and TX respectively. This will allow you to read the serial comms via the onboard stlink CDC device.
The default UART baud rate in firmware is 921600, with 8 bits, no partity & 1 stop bit.
By default the firmware configures the clock to use the HSE. Nucleo 64 boards do not come with the crystal and passives populated. Refer to UM1724 Section 6.7.1 for instructions on using HSE.
The following configuration is needed:
- SB54 and SB55 OFF
- R35 and R37 soldered
- C33 and C34 soldered with 20 pF capacitors
- SB16 and SB50 OFF
It's recommended to use an external crystal for better timing accuracy, but this is optional. If you want to use the
internal oscillator, set the ELS_USE_HSE
directive to 0 in src/clock.c
This is again optional but without an external FT24C64A EEPROM, you will not be able to save the settings and the defaults from constants.h will be used.
Supported TFT 480x320 Displays
- ILI9481
- ILI9486
- ILI9488
AliExpress Links
- ILI9481 TFT LCD, https://www.aliexpress.com/item/1005001288341298.html
- ILI9486, ILI9488 TFT, https://www.aliexpress.com/item/1005001288341298.html
Kicad files in hw/lcd
This primarily a carrier / breakout board with an IDC ribbon cable connector to main board. The main board is connected to the LCD module using an adapter board that breaks out the pins to a 16 pin IDC socket.
Kicad files in hw/buffer
Optional add-on for cleaning up the high frequency pulses from the main board to the stepper drivers. This needs to be powered separately and co-located with the stepper drivers. You may not need this depending on the length of the signal cables from the main board to the stepper drivers.
- CD4050BE, non-inverting hex buffer.
- CRE1S0505SC, isolated dc-dc converter 5v.
I used this because I had an unused one left over from a different project that did not work out. They're not cheap but they're very reliable and resistant to liquids in the workshop. The seller can also laser etch the art for keypads if you're interested.
- IP65 18 Key, PS2 Keypad, https://www.aliexpress.com/item/1005002340320709.html
You can make do with this for trying out the firmware by using UART as an input. To do it, edit src/usart.c and set
ELS_USART_ENABLE_KEYPAD_INPUT
to 1
IMPORTANT NOTE
The spindle encoder PPR, along with the gear ratio and pulses per MM for Z axis determines the maximum spindle RPM and thread pitch you can turn in threading operations. There is currently no warning displayed if the spindle PPR is less than the minimum required PPR.
- Spindle Encoder: Optical 600PPR, https://www.aliexpress.com/item/4000392086291.html
- Hand wheel Encoder / pulser 100PPR 5v 4pin, https://www.aliexpress.com/item/32949618549.html
-
Z Stepper: 24HS40-5004D-E1000
-
Z Controller: CL57Y
-
X Stepper: NEMA23 1.2Nm 3A
-
X Controller: DM556
Supports TTL optical DROs and defaults to the commonly available 5uM resolution versions.
Most TTL optical DROs you get from China operate on a 5V logic level. You need to to get a DB9 panel or PCB socket (male) and break out the 4 wires based on the wiring diagram for your DRO scale.
- +5V
- Ground
- Signal A
- Signal B
PA0 - TFT Data
PA1 - TFT Data
PA2 - TFT Data
PA3 - TFT Data
PA4 - TFT Data
PA5 - TFT Data
PA6 - TFT Data
PA7 - TFT Data
PA8 - UNUSED
PA9 - USART TX
PA10 - USART RX
PA11 - DRO X-A (INTERRUPT)
PA12 - DRO X-B (INTERRUPT)
PA13 - UNUSED
PA14 - UNUSED
PA15 - UNUSED
PB0 - TFT RD
PB1 - DRO Z-A (INTERRUPT)
PB2 - UNUSED
PB3 - Spindle Enc A (INTERRUPT)
PB4 - Spindle Enc B
PB5 - DRO Z-B (INTERRUPT)
PB6 - TFT WR
PB7 - TFT RS
PB8 - TFT CS
PB9 - TFT RST
PB10 - EEPROM SCL
PB11 - N/A
PB12 - UNUSED
PB13 - Z ENA
PB14 - Z DIR
PB15 - Z PUL
PC0 - UNUSED
PC1 - UNUSED
PC2 - Input Enc A (INTERRUPT)
PC3 - Input Enc B
PC4 - PS/2 Keypad CLK (INTERRUPT)
PC5 - PS/2 Keypad DAT
PC6 - Spindle Enc A (Timer in Encoder mode)
PC7 - Spindle Enc B (Timer in Encoder mode)
PC8 - UNUSED
PC9 - UNUSED
PC10 - UNUSED
PC11 - UNUSED
PC12 - EEPROM SDA
PC13 - X ENA
PC14 - X DIR
PC15 - X PUL
PH0 - UNUSED
PH1 - UNUSED
Keymap, left to right.
- Settings
- Lathe Functions
- Special Function Key - F1
- Special Function Key - F2
- Keypad Lock / Unlock
- Encoder multiplier change. Cyles through 1, 10 & 100.
- Feed / Pitch
- Reverse feed direction (not available in all functions)
- Turning
- Threading External
- Stop Operation / Exit setting
- Ready to start / Accept setting
- Z/X axis setting
- Zero Z / X axis
- Jog to origin (depending on choice of Z or X axis setup)
- Unused
- Unused
- Unused
The manual turning and threading functions do not control the X axis / cross slide but allows turning and threading operations at a given feed / pitch to a given length.
The remaining functions are stepper / servo driven on both Z (longitudinal along bed) and X (cross slide) axis.
All function screens display the spindle status at the top
- Clockwise / Counter clockwise direction of spindle and RPM. Chuck icon is shown when RPM = 0
- Angular position of the spindle in degrees. This can be used for any indexing functions.
- Pulse counter, this is a function of the encoder PPR and wraps around. Threading operations synchronise to this value.
NOTE
- Some lathe functions display diagrams where the stock to be removed is displayed in orange.
- The origin (0,0) required for turning operations is displayed using a yellow dot.
X axis stepper / servo pulses per MM. This should include any gear ratios in transmission.
Z axis stepper / servo pulses per MM. This should include any gear ratios in tranmission, especially if you're using the gearbox.
X backlash in microns. You can measure this by using a dial gauge against the cross slide and driving the stepper in one direction for a full rotation and reversing to measure the amount of distance the stepper has to drive the axis before the dial gauge indicates movement.
Z backlash in microns. Measure as above.
Pulses per one revolution of the spindle. Note, this is usually the actual pulses generated by the encoder times any gear ratios in drive mechanism. You can drive the encoder at 1.5-2x the speed of the spindle but pay attention to the maximum RPM rating for the encoder.
Speed at which X axis retraction is done, can be slowed or sped up depending on gear / pulley ratios.
Speed at which Z axis retraction is done, can be slowed or sped up depending on gear / pulley ratios.
If DRO is connected, then uses a simple closed loop traversal for linear movements on X axis. This can be particularly useful for turning stock to a specific diameter but it will depend on the accuracy of your DRO.
If DRO is connected, then uses a simple closed loop traversal for linear movements on Z axis.
Invert direction for DRO on X Axis
Invert direction for DRO on Z Axis
Invert stepper direction on X Axis
Invert stepper direction on Z Axis
NOTE
When soft limits are turned on, with conventional turning the tool is moved from right to left along the Z axis at the set feed rate until the minimum position is reached.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis optionally for DRO.
- Set feed
- Set length and enable soft limit (optional)
- Turn on spindle
- Press Ready to start
- If soft limit is enabled, when the tool reaches the soft limit the feed will stop.
- Back off tool, jog to Z origin.
- Feed in tool and press Ready again
Set feed. The feed rate is independent of the spindle RPM at mm/s.
Reverses feed direction. The usual direction is right to left towards spindle.
- Set Z axis, jogging
- Pressing the button again switches to X axis setting, only used for zeroing the DRO reading (if available).
Zero Z axis or X axis (DRO)
Set the length to turn, Z soft limit target.
Turns on / off soft limits. This will stop Z drive when the position reaches Z min.
Jog Z axis to origin position
NOTE
When soft limits are turned on, with conventional turning the tool is moved from right to left along the Z axis at the set pitch ratio until the minimum position is reached.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set pitch
- Set length
- Turn on spindle
- Press Ready to start
- When the tool reaches the soft limit, it will stop.
- Back off tool, press Jog to origin
- Feed in tool and press Ready again
Choose pitch - the pitch determines the feed rate and this is tied to the rotation of the spindle.
You can pick a standard metric pitch with the displayed thread crest dimension. Pressing the key again will allow you to set an arbitrary pitch value. This can be used to turn approximate imperial threads.
While in pitch settings, pressing reverse feed direction allows you cut left hand threads or right hand threads.
- Set Z axis, jogging and setting min / max positions for virtual stop.
- Pressing the button again switches to X axis setting, only used for zeroing the DRO reading.
Zero Z axis or X axis (DRO)
Set length
Unused
Jog Z axis to 0 position
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set roughing feed and feed for finish pass
- Set the roughing depth of cut and depth of cut for finish pass
- Set length and turning depth
- Turn on spindle
- Press Ready to start
Set feed & depth of cut.
NOTE: The feed rate is independent of the spindle RPM at mm/s.
Press key to cycle through
- roughing feed rate in mm/s
- finishing pass feed rate in mm/s
- roughing depth of cut in mm
- finishing pass feed rate in mm/s
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length
- Press key again to set depth
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed
- Set depth of cut on Z for each pass
- Set length on Z axis to face and depth (radius of stock to face)
- Turn on spindle
- Press Ready to start
Set feed (Xf) & depth of cut (Zs).
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length
- Press key again to set depth
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed (Xf)
- Set depth of cut (radius of stock to part off)
- Set retraction rate (Rx) if needed. e.g. if set to 2mm, this retracts the tool 5mm for every 2mm of in-feed.
- Turn on spindle
- Press Ready to start
Set feed (Xf) & retraction (Rx).
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
Set total depth to part off, this is half the stock diameter ideally.
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set depth and turning radius
- Turn on spindle
- Press Ready to start
- Set feed. The feed rate is independent of the spindle RPM at mm/s.
- Press key again to set depth of cut for turning pass.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set depth
- Press key again to set radius
The diameter of the bore is twice the radius.
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set depth and width for stock removal
- Turn on spindle
- Press Ready to start
Use this if you have drilled a hole or performing boring operation with a through hole.
- Set feed. The feed rate is independent of the spindle RPM at mm/s.
- Press key again to set depth of cut for turning pass.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set depth
- Press key again to set width of stock to remove.
Display DRO or diagram.
Uses a form of bidirectional multi-start threading operation to cut knurls. Given the large pitch sizes required, it's best to hand turn the spindle or use RPM < 30.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set (L) length of the stock to knurl
- Set (d) depth to cut
- Set (D) diameter of stock
- Set (A) lead angle, default to 30 deg.
- Set (N) number of knurls.
- Turn on spindle
- Press Ready to start
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
Sets length, cut depth, diameter, lead angle and knurl count. Press F1 again to cycle through the settings.
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set pitch (and optionally thread height)
- Set length and depth of cut
- Turn on spindle
- Press Ready to start
- Select pitch, cycles through standard metric pitches.
- Press key again to set an arbitrary pitch and thread height / depth.
- Press "Reverse Direction (
</>
)" button to switch between RH and LH threads.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
IMPORTANT: The diagonal infeed hard codes the angle to 26.565° which is only valid for 60° thread profiles.
- Set length of thread
- Press key again to set depth of cut.
- While in depth of cut selection press "Reverse Direction (
</>
)" button to switch between plunge and diagonal in-feed.
Display DRO or diagram.
TODO: add support for LH threads and diagonal in-feed
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set pitch (and optionally thread depth)
- Set length and depth of cut
- Turn on spindle
- Press Ready to start
- Select pitch, cycles through standard metric pitches.
- Press key again to set an arbitrary pitch and thread height / depth.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length of thread
- Press key again to set depth of cut.
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set length and depth of taper. Press F2 - The angle should be displayed in addition to DRO values.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length of taper
- Press key again to set depth of taper.
Display DRO or diagram. This also displays the taper angle.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set length and depth of taper. Press F2 - The angle should be displayed in addition to DRO values.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length of taper
- Press key again to set depth of taper.
Display DRO or diagram. This also displays the taper angle.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set length and depth of taper. Press F2 - The angle should be displayed in addition to DRO values.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set length of taper
- Press key again to set depth of taper.
Display DRO or diagram. This also displays the taper angle.
Glossary:
- (z0, x0) and (z1, x1), intersection of arc with stock.
- Radius: Radius of the arc.
- Depth: depth of arc, x1 - x0
- Length: length of arc, z1 - z0
Varying the radius, length and depth will allow a variety of convex curves to be turned.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set radius, length and depth of arc.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set radius of circle
- Press key again to set depth.
- Press key again to set length.
Display DRO or diagram.
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set radius, length and depth of arc.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set radius of circle
- Press key again to set depth.
- Press key again to set length.
Display DRO or diagram.
Glossary:
- (z0, x0) and (z1, x1), intersection of arc with stock.
- Radius: Radius of the arc.
- Depth: depth of arc, x1 - x0
- Length: length of arc, z1 - z0
Steps:
- Move tool to Z/X origin as required
- Zero out Z and X axis
- Set feed and depth of cut
- Set radius, length and depth of arc.
- Turn on spindle
- Press Ready to start
- Select feed, mm/s.
- Press key again to set depth of cut.
- Z axis jogging.
- Press key again for X axis jogging
Zero Z axis or X axis (DRO)
- Set radius of circle
- Press key again to set depth.
- Press key again to set length.
Display DRO or diagram.
TODO
TODO
TODO