Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 31

Thread: Teensy 4.1 Based CNC Controller

  1. #1
    Senior Member
    Join Date
    Mar 2016
    Posts
    202

    Teensy 4.1 Based CNC Controller

    I have finished my grblHAL CNC Motion Controller board for Teensy 4.1.

    Completed board
    Click image for larger version. 

Name:	R6268724_DxO-1.jpg 
Views:	97 
Size:	256.8 KB 
ID:	20816

    Unkit Version
    Click image for larger version. 

Name:	R6288808_DxO-1.jpg 
Views:	71 
Size:	337.6 KB 
ID:	20817
    Features:
    • 5 Axis control outputs – 5V compatible.
    • Independent enables for each axis.
    • 10 Opto-isolated inputs including standard GRBL controls and limit switches for all axes.
    • 7 Relay Outputs – Spindle, Mist Coolant, Flood Coolant, Dust Collector and 3 auxiliary relays. Each output can control a relay coil directly or 5V TTL (SSR compatible) devices.
    • Dust Collector relay support. Activated by spindle enable.
    • Separate control of Dust Collector relay via pin header.
    • Relay coil voltage switchable between 5V and 12V.
    • Standard GRBL spindle control outputs – 5V compliant.
    • 0-10V spindle control output for driving VFDs.
    • Screw Terminals for reliable connections available for most I/O.
    • 4 Digital Inputs – EMI protected, 15.9KHz low pass filter, Schmitt Trigger.
    • I2C header.
    • EEPROM footprint for SOIC8 devices.
    • LED indicators for 5V and 12V.
    • USB interface.
    • Ethernet interface.
    • Serial I/O Header


    This runs grblHAL, a 32 bit ARM port of GRBL. The source code is here.

    Schematics can be found here.

    I've uploaded a shared board to OSHPark here.

    Though, to be honest, it would be cheaper to take the gerbers and order the board from a Chinese fab like JLCPCB. Gerbers can be found here.

    I have a small number of boards with all the surface mount components (except the eeprom) already soldered on - AKA the Unkit Version. If interested, you can get one here.

    I have a manual near completion and will post it on the github page here when done. It includes a BOM and assembly instructions.

    In addition, the PCB has the footprint for an Ethernet MagJack. The hardware works but Ethernet for grblHAL on the T4.1 is not completed. I am hoping to get that working within a week or so. Check the github page for status.
    Last edited by PhilB; 07-01-2020 at 05:36 AM.

  2. #2
    wow, that is a piece of art.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,519
    Awesome board. Have you connected to any machines yet? Any chance for a photo of it in "action"?

  4. #4
    Junior Member
    Join Date
    Apr 2020
    Location
    Brazil
    Posts
    10
    So nice !! What is the maximum step clock frequency ? Have you tested with Mach3 ?

  5. #5
    Junior Member
    Join Date
    Apr 2020
    Location
    Brazil
    Posts
    10
    Runs over ethernet ?

  6. #6
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by PaulStoffregen View Post
    Awesome board. Have you connected to any machines yet? Any chance for a photo of it in "action"?
    I've tested it against steppers. An earlier version is running several machines and grblHAL is running quite a few machines with various processors (STM32, ESP and others). I'll be doing a "pretty build" in the next few days.

  7. #7
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by Logs View Post
    So nice !! What is the maximum step clock frequency ? Have you tested with Mach3 ?
    Mach 3 isn't needed. grblHAL takes it place and is free. And, better. This uses a PC mainly for feeding G-Code. grblHAL running on the T4.1 does all the motion control, planning and manages the inputs. It is possible to run it off-line with an SD card supplying the G-Code though that's problematic for physical card reader access in machine environment.

    Max step rate is uncharacterized but it is faster than a physical stepper motor can go.

  8. #8
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by Logs View Post
    Runs over ethernet ?
    It will. That's the next step. I've tested the hardware and it runs T4.1 Ethernet apps, both Native and lwip. grblHAL works with lwip on other processors. we are porting it to the T4.1 right now though my time is in short supply these days.

    This is important because Ethernet is more reliable for feeding G-Code than USB. USB is more susceptible to EMI than Ethernet.

  9. #9
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by KrisKasprzak View Post
    wow, that is a piece of art.
    Thanks. Kind of you to say. I take some pride in making my PCBs look good - clean layout, 45 degree bends, clear and helpful silk screen legends. That's make them work any better, though...

  10. #10
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    The User Guide is now available here

  11. #11
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    There was a question about max step rate supported. After some testing, I have been able to produce a 180kHz step pulse stream. Minimum pulse width is 3 uS. You can get to 300 kHz but that probably violates min pulse separation for your stepper drivers - it looks like a spec of 2.5 uS is fairly common, even on higher end drivers. So, 2.5 uS separation and 3 uS pulse width gets you 181.818 kHz. Note that acceleration/deceleration will make that step rate relatively infrequent when running a job. Here's a screen shot of a 148.8 kHz stream.
    Click image for larger version. 

Name:	86495805-b40bb480-bd2f-11ea-8c8f-c6f4f6308d50.png 
Views:	19 
Size:	23.0 KB 
ID:	20850

  12. #12
    Junior Member
    Join Date
    Sep 2014
    Posts
    16
    Awesome. Just ordered one. Thanks

  13. #13
    Junior Member
    Join Date
    Apr 2020
    Location
    Brazil
    Posts
    10
    Quote Originally Posted by PhilB View Post
    There was a question about max step rate supported. After some testing, I have been able to produce a 180kHz step pulse stream. Minimum pulse width is 3 uS. You can get to 300 kHz but that probably violates min pulse separation for your stepper drivers - it looks like a spec of 2.5 uS is fairly common, even on higher end drivers. So, 2.5 uS separation and 3 uS pulse width gets you 181.818 kHz. Note that acceleration/deceleration will make that step rate relatively infrequent when running a job. Here's a screen shot of a 148.8 kHz stream.
    Click image for larger version. 

Name:	86495805-b40bb480-bd2f-11ea-8c8f-c6f4f6308d50.png 
Views:	19 
Size:	23.0 KB 
ID:	20850
    That's good, thank you

  14. #14
    Junior Member
    Join Date
    Apr 2020
    Location
    Brazil
    Posts
    10
    Quote Originally Posted by PhilB View Post
    It will. That's the next step. I've tested the hardware and it runs T4.1 Ethernet apps, both Native and lwip. grblHAL works with lwip on other processors. we are porting it to the T4.1 right now though my time is in short supply these days.

    This is important because Ethernet is more reliable for feeding G-Code than USB. USB is more susceptible to EMI than Ethernet.

    When the ethernet support be available, the actual board version is ready to be populated with the ethernet components (MagJack, etc..) ?

  15. #15
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by Logs View Post
    That's good, thank you
    After looking at this a lot more, I've decided to put the max step rate specification at 160 kHz. Quite a bit better than the old 8 bit GRBL of 30 kHz. It can go higher but I don't feel confident of 100% repeatability above 160K. That will support 5000mm/min movement and higher. Of course that depends on stepper drivers, motors, gearing and microstepping being set correctly.

  16. #16
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by Alex Stahl View Post
    Awesome. Just ordered one. Thanks
    Thank you - email sent.

    There is just one left but I ordered another batch which should be here next week.

  17. #17
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by Logs View Post
    When the ethernet support be available, the actual board version is ready to be populated with the ethernet components (MagJack, etc..) ?
    Yes, that is the plan. Of course it needs testing and characterization. I will post back when we have some results. And the unkit just needs the magjack and the header connection for the Teensy 4.1, all the other components are already on it.

  18. #18
    Junior Member
    Join Date
    Feb 2015
    Location
    Airdrie, Alberta
    Posts
    10
    Would like to acquire. Can you recommend a few external stepper drivers?
    using grbl on protoneer 2.6
    i am building my second cnc router, with high power spindle 2 lead screw on x-axis and 4 amp CUI steppers.
    quite new to cnc

  19. #19
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Since you have the stepper motors picked out, you should size the drivers to them. But before that, you should probably decide on what voltage you want to run them at. I'd be temped to go to 48V so need to get drivers that can handle that with some margin - 60-70V. That will be more expensive. But you could run them at 36V or even 24V which would give you less expensive driver options. 36V is kind of the mid-range sweet spot. The higher the voltage, the faster feeds possible and more cutting power (ie, deeper DoC). Leadshine is a pretty good quality brand though their prices have risen. The DM556 is great up to 36V. I am spec'ing out a bigger, more powerful machine for my shop and am looking at the stepperonline store. Chinese company so I take their specs as optimistic (derate by 25% or more) but they have good prices even with derating. They have a clone - DM556T that goes for $30ish. They claim 50V but I wouldn't push 48 through it - stick with 36V.

    Before embarking on designing your electronics cabinet, take a look at the Avid/CNCRouterParts nema 23 electronics package - really well done and lots of great ideas in it. Take a look at their pdf instructions. You will learn a lot. I like that company and if I knew nothing about electronics would go with their package in a heartbeat, even at that price.

    By the way, I would consider setting up with Ethernet. It's working quite well now - I have switched my small machine over and have run a number of jobs with it. Very happy with the results. Will be posting a build log/blog/whatever soon.

  20. #20
    Junior Member
    Join Date
    Feb 2015
    Location
    Airdrie, Alberta
    Posts
    10
    wow... much appreciate your guidance.
    says lots about you.
    will order a few boards.
    I will keep you updated on my setup...

  21. #21
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Yes, please post your progress and feel free to contact me directly if you have any questions.

  22. #22
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,067
    They have a clone - DM556T
    Cool, now the chinese are even cloning chinese (Leadshine) products :-) Anyway, I use an original Leadshine DM556 and can confirm that this is a really good driver.

  23. #23
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Lol. There are a number of DM556 clones out there. In fact, I would be surprised if you can actually buy a real one. As soon as there is any product that sells well, the counterfeits are not far behind. They don't care if the originator is next door or half way around the world. Anything to make money. Equal opportunity pirates...

    It's like the "blue pill" STM32F103 board. You have a very hard time finding one with the real STM32 on it or other weird issues like wrong pullup resistor value. One of the reasons I went with Teensys is that when you buy a Teensy, you get exactly that. I didn't want to be forever chasing some random variant induced bugs. Life is too short for that.

  24. #24
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,067
    Your board looks good by the way. I used GRBL (the AVR version) some years ago to automate my lathe but it didn't support lathes very well then. E.g. no possibility to cut threads. Did this change by now or is it still mainly 'mill focused'?

    I don't know where you are based but here in Germany, Sorotec https://www.sorotec.de/shop/CNC-Cont...pping-Drivers/ is THE source for good CNC parts. If you are looking for a really good driver you should have a look at the BEAST series. Good old german engineering and good old german prices ;-). Anyway, the CNC guys here swear by it...

  25. #25
    Senior Member
    Join Date
    Mar 2016
    Posts
    202
    Quote Originally Posted by luni View Post
    Your board looks good by the way, I used GRBL (the AVR version) some years ago to automate my lathe but it didn't support lathes very well then. E.g. no possibility to cut threads. Did this change by now or is it still mainly 'mill focused'?

    I don't know where you are based but here in Germany, Sorotec https://www.sorotec.de/shop/CNC-Cont...pping-Drivers/ is THE source for good CNC parts. If you are looking for a really good driver you should have a look at the BEAST series. Good old german engineering and good old german prices ;-). Anyway, the CNC guys here swear by it...
    Yes the German CNC stuff is topnotch! Uber Alles! I'm in the US though about 1/3 of my customers are in Germany.

    grblHAL is definitely "not your father's GRBL". The author, Terje Io, has done an outstanding job of separating the core motion control and input switch management from the actual machine interface via a Hardware Abstraction Layer (thus grblHAL). This makes it easy to add new features and move to different processors. It took less than a week to move it to the iMXRT 1062. Similarly to the STM32F401. The system runs on 13 different processors and support mills, lathes, multi-axis machines, lasers. Terje has some videos that show cutting threads on a lathe so I'm pretty sure that is no longer an issue. He has used LinuxCNC as his model and the result is a powerful system similar to LinuxCNC without the endless complexity of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •