Jump to content

Potential of various interfaces and communication systems in 3D printers


Recommended Posts

Hi everyone!

Something someone said... "R.I.P. CANBUS" got me thinking....

The originator of this comment was apparently much in favor of USB communication over that of CANBUS and correctly pointed out that CANBUS is often implemented through a USB to CAN adaptor of some kind anyway, so why have the CAN at all?

I have a history with both CANBUS and USB to some degree.  CANBUS has been the premier high speed and high reliability champion of the Automotive world for decades now.   USB has also been around for decades, but a premier solution? Hardly.  I once did a fair bit of video editing which entails both relatively high-speed capture data streams and very large file sizes. For these uses, USB has always been inferior to its closest rival, first FireWire and more recently Thunderbolt.  As USB has evolved and improved so has its rivals, keeping their lead or even extending it.  Oddly, the latest iteration of Thunderbolt has a USB3 compatible connector  even though the two standards are worlds apart from a performance perspective. The cheaper and ubiquitous USB3 cables plug right in to Thunderbolt ports and cause much disappointment and confusion. 

So, I'm kind of an anti-USBer.  But yet, our Vorons generally use something like a Raspberry Pi to control it, and the easiest way to connect it up is with the USB ports, which generally do an adequate job.   But this need not be the case!

The Raspberry Pi can also communicate with an SPI interface, and there are SPI - to - CANBUS hats for the Pi.  Many of our controller boards have a CANBUS interface built in, so rather than bridge the USB to CAN, could we not just eliminate the USB altogether?   Or perhaps a computer with a Thunderbolt port could be used and use that instead of CAN or bridge to CAN?  

One thing for certain: As we find more and more stuff to hang on our toolheads and connect up to our printers generally, having discrete wiring for every device will increasingly be a less desirable situation, as it was in the Automotive world, which is what inspired CANBUS in the first place.

Maybe someday there will be an entirely CANBUS arrangement with a CAN capable Pi or equivalent, CAN steppers, CAN lighting, CAN Fans, a CAN Solid State Relay for heaters, CAN displays and of course the already existing CAN toolhead boards. At that point the main control board could be eliminated, leaving just the CAN Pi and a Power Supply for the power, logic and control.  Of course, you could probably replace CAN with Thunderbolt as it does Daisy Chain, unlike USB...

  • Like 2
Link to comment
Share on other sites

Let's do some calculation...
CANBUS can't be compared to serial over USB or RS232. Because CANBUS uses frames, and a frame is the smallest information. And CAN uses huuuuuuge frames that are bandwidth hogs (overhead).

1Mb/s means nothing. We have to think frames/s.
The calculation is here : https://electronics.stackexchange.com/questions/121329/whats-the-maximum-can-bus-frame-message-rate-at-125-kbit-s

Below, for the maximum 1Mbps theorical bitrate.

 

For data length 1 you would have to calculate with

55 Bits (minimum overhead + 8 data bits + 3 interframe space)

--> maximum frame frequency for 1 Mbit is about 18181.8/s (1/0.000055)

For data length 0 (can be also an information) you would have to calculate with

47 Bits (minimum overhead + 3 interframe space)

--> maximum frame frequency for 1 Mbit is about 21276.6/s (1/0.000047)

 

Now, lets calculate what Klipper/MCU has to send in terms os step pulses / second.

 

rotation_distance = <full_steps_per_rotation> * <microsteps> / <steps_per_mm>
<steps/mm> = <full_steps_per_rotation> * <microsteps> / rotation_distance

 

 

Voron 2.4, 0.9° steppers (400 steps), 32 µsteps, 100 mm/s, rotation_distance = 40

<steps/mm> = 400*32/40 = 320 steps/mm

100 mm/s -> 320*100 = 32 000 steps/s, i.e. 32 000 frames/s

We have a problem... (unless Klipper sends multiple step pulses per frame, wich sounds a bit weird, unless a timing information is sent with the pulse count)

 

Another one : the extruder.

Voron Stealthburner, 1.8° stepper (200 steps), 32 µsteps, 40 mm/s on a retraction rotation_distance = 22

 

<steps/mm> = 200*32/22=290.9091
40 mm/s -> 290*40 = 12 000 frames /s

Should work (we all know it works)

 

In the Klipper documentation, we can read :

Even at a CAN bus frequency of 1000000, there may not be sufficient bandwidth to run a SHAPER_CALIBRATE test if both the XY steppers and the accelerometer all communicate via a single "USB to CAN bus" interface.

 

Very unlikely we will see all devices (effectors and sensors) daisy chained on a single BUS. Up to 7 steppers... (polling sensors is negligible in terms of bandwidth, tiny bits of data, low polling rate)

Unfortunately.

 

Edited by YaaJ
Link to comment
Share on other sites

CAN isn't used in 3D printing because "CAN is better than USB." It's not. It's just a different system with some strengths that make it particularly useful for connecting remote MCUs such as those on toolheads and MMUs.

CAN is a shared bus. Any number of devices can be connected, and they can all talk to each other over the same two-wire interface. There are well-defined mechanisms that make devices behave politely and not talk over one another. USB can't do this! It's a point-to-point link with exactly two endpoints. Sure, there are hubs that multiplex or split USB traffic, but these are separate pieces of hardware with complex internal logic. As far as I'm aware, there's currently no good off-the-shelf way to run a single USB cable to your toolhead and have it control two different devices.

CAN is great for umbilicals because all you need are the two data lines, ground, and +24V. USB is standardized at 5V, so you'll need to provide that voltage level even if you have no actual need for 5V. More specifically, USB has a low and strictly defined capacity to deliver power, even at 5V. In addition to running your USB cable, you'll also need to run a separate ground and +24V line. You can't just use the ground in the USB cable because it's not capable of handling the current for a stepper motor or heater, even as a return path. So you need at least 5 lines, but more likely 6, depending on the cabling options available.

As far as bandwidth, yes, CAN is slow. But it's sufficient. If you're interested, you can take a look at the MCU commands defined by Klipper and the wire protocol used for communication. Klipper can pack multiple commands into each frame, and individual commands can result in multiple actions, e.g., multiple steps on a motor over time. Klipper also uses data compression in the wire protocol. And commands are not synchronous - Klipper has a send queue and the MCU has a work queue from which commands are executed at their scheduled times. Klipper tries to keep the queues filled well in advance of the time at which commands actually run. It's like video buffering on Netflix.

 

  • Like 3
Link to comment
Share on other sites

It seems that Duet3D has implemented CANBUS on their Duet 3 boards using Reprap firmware.

Perhaps this is a better, or at least easier implementation of CANBUS than Klipper + BTT / MellowFly has been so far?

Has anyone tried the Duet 3 CAN FD system?

  • Like 1
Link to comment
Share on other sites

"Now, lets calculate what Klipper/MCU has to send in terms os step pulses / second.

rotation_distance = <full_steps_per_rotation> * <microsteps> / <steps_per_mm>
<steps/mm> = <full_steps_per_rotation> * <microsteps> / rotation_distance

Voron 2.4, 0.9° steppers (400 steps), 32 µsteps, 100 mm/s, rotation_distance = 40

<steps/mm> = 400*32/40 = 320 steps/mm

100 mm/s -> 320*100 = 32 000 steps/s, i.e. 32 000 frames/s

We have a problem... (unless Klipper sends multiple step pulses per frame, wich sounds a bit weird, unless a timing information is sent with the pulse count)

Another one : the extruder.

Voron Stealthburner, 1.8° stepper (200 steps), 32 µsteps, 40 mm/s on a retraction rotation_distance = 22

<steps/mm> = 200*32/22=290.9091
40 mm/s -> 290*40 = 12 000 frames /s

Should work (we all know it works)"

 

No no no,

Stepper driver get commands like "make 200 steps"
and make it.
MCUs do not send separate commands for any step.
And yes, SHAPER send all Data over CAN life, and it can be a problem.


P.S.
CAN use "Error detection and correction" almost like TCP/IP, USB not.

Edited by Sergey
  • Like 1
Link to comment
Share on other sites

Reprapfirmware has been using CAN-FD for several years - ever since Duet3d implemented it in their 3rd generation boards(now supported in many Mellow and BTT boards as well). It's extremely robust and simple to use. I can put 20+ boards off the same bus. You use any other CAN-FD board as an expansion board. And it all require ZERO configuration on my part other than one time setting a board ID (if using multiple boards of the same type) Jut put the board address before the pin/driver I wish to access. No PI no USB->CAN or Firmware compiling or patching BS breaking everything 2 times a month just wire and go.  So CANBUS might be dead for Klipper with toolheads under 2m but its been in RRF longer than Klipper's implementation and here to stay. -Remember RRF does CNC as well so its in some pretty large machines out there.

Edited by Nurgelrot
  • Like 2
Link to comment
Share on other sites

4 hours ago, Nurgelrot said:

Reprapfirmware has been using CAN-FD for several years - ever since Duet3d implemented it in their 3rd generation boards(now supported in many Mellow and BTT boards as well). It's extremely robust and simple to use. I can put 20+ boards off the same bus. You use any other CAN-FD board as an expansion board. And it all require ZERO configuration on my part other than one time setting a board ID (if using multiple boards of the same type) Jut put the board address before the pin/driver I wish to access. No PI no USB->CAN or Firmware compiling or patching BS breaking everything 2 times a month just wire and go.  So CANBUS might be dead for Klipper with toolheads under 2m but its been in RRF longer than Klipper's implementation and here to stay. -Remember RRF does CNC as well so its in some pretty large machines out there.

Thank you for your reply… I was hoping someone with Duet experience would reply.  The constant “updates “ that break Klipper CAN is a valuable learning experience, but I also want to be printing stuff.  To this end I already ordered a Duet 3 board and toolhead as I don’t really see the point of wasting a perfectly good Pi on a printer with a fully capable mainboard… I'm happy to hear of your experience.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
1 hour ago, Sleepster said:

Go easy on me I was looking at going can for the tooth head on my 2.4 as a new build using a pi and the ezy max and ebb2209 2040 am I heading down the wrong path and if so what should I do 

Thankyou in advance

If you mean the BTT Octopus Max EZ, I don’t see any reason why this shouldn’t work.  The Pi will need some kind of CAN interface… either a U2C will work or you could operate the Octopus in “bridge mode “ to accomplish this.  My suggestion is to run a ground/ earth lead to the hot-end when using this toolboard

  • Like 1
Link to comment
Share on other sites

2 hours ago, Sleepster said:

I was looking at going can for the tooth head on my 2.4

What is a tooth head?

The Octopus Max EZ is a more luxury version of the Octopus boards. So it is able to handle everything we do with the Octopus boards. Also when it comes to the CAN interface

The combination of Octopus MAX EZ, RPi, U2C (also works without), EB2209 (2040) will make it very easy to set up a CAN system on your new Voron 2.4 printer. -So: right path 🙂

If you make a build log, we will be able to follow along and give you more advise.

Link to comment
Share on other sites

4 hours ago, ChicagoKeri said:

If you mean the BTT Octopus Max EZ, I don’t see any reason why this shouldn’t work.  The Pi will need some kind of CAN interface… either a U2C will work or you could operate the Octopus in “bridge mode “ to accomplish this.  My suggestion is to run a ground/ earth lead to the hot-end when using this toolboard

I hope this isn't a hijack BUT I'm wondering how i would run an earth lead?  I will be using Leviathan/Rapido2 UHF on my build.  I have some ideas but want the collective input so as not to bias the options/opinions.

Link to comment
Share on other sites

You all are comparing CAN to USB as USB existed decades ago.  Modern USB can push gigabytes of data per second, it can also silly up to about 200 Watts of power over the USB cable.  It can have multiple end points too.  For example I can daisy chaind the USB cable first to an external disk drive then to my monitor and the port on the computer sees both video and disk data.    Then there is Isochronus mode if you need "real time" frames send at a defined rate.

 

Of cource, the Pi3 was designed for low cost and has low-performance USB. But even USB2 on the Pi3 is fast enough.  And as said above if you like real-time frames with a defined bandwidth, USB2 cover that with it's isochronus mode.

 

CAN is a shared bus.  But really, on a printer the toolhead has to be the LAST node on your network, otherwise you have to run the cable back and have two runs or abuse the CAN standard and "fork" the bus in which case it is no longer CAN but rather a one-off  star-topology buss you invented

 

New printers will have multiple toolhead, ether IDEX or tool changers (or possibly both) and they might have other sensors emo one the toolhead (I want to install accelerometers in several locations and I'm thinking of easy ways to sens filiment motion at the 0.01 mm level

 

I can imagine a printer that is 5X more comples and loaded with sensors and using closed loop motion control.    CAN is good for if you many low data rate sensors and can run the wire daisy chard.   Other connections are best for faster data transfer

 

let's not forget about "'wireless".  The ESP32 chip makes it darn easy and cheap to design a toolhead that has just power and filiment and no data cables.

Link to comment
Share on other sites

Thanks for the extra information @chrisalbertson.

I am really not interested in a fight between which communications method is better. I never liked discussions of whose is bigger / better / shinier. What matters is if it works and works well or not.

I also do not exactly understand your reference to the 'decades' ago. As I understand, CAN bus has been around since 1985 and USB since 1995. I do remember the era before 1996, and we had very thick cables in cars, hidden well but still visible. And it took a huge time to line up a single line to the back of the car, for a light. I also do remember the pcs before USB, you needed a huge PCMCIA card for every additional peripheral, which all costed a lot. So I am happy with both of them.

I can undestand that you refer to the latest usb specs, 4.0, which seems to be around since 2019. Last month I had to buy a laptop for my son and a new hard disk for my server. But USB 4 was not inside the laptop, and neither was I able to buy a usb 2.5 inch 5TB hard disk with USB 4.0. 
And also as you well put, those ports are also not on the RPi, the computers that drive our printers.

20 years ago I had to pay 100 euros per person to eat Sushi, but nowadays I just watch a youtube video and I can make my sushi with fresh fish for about 5 euros. So I have not a single bit of experience on any of these interfaces, except as a user over the years and as someone who likes to learn. 
And I have just set up 1 single CAN bus on my printer and have immediately added a node to the Toolhead PCB. The Toolhead PCB is NOT terminated, but my Cartographer probe that is connected to the Toolhead PCB is. The producing company, does not recommend a circulation to the toolhead. And to be honest, I do not understand why the toolhead PCB has to be a final node: please enlighten me 🙂

Anyway... If I may express my opinion, from what I have seen around, between the CAN BUS toolheads and the new USB toolhead that came recently on the market: They have the same chips on board, they have to be flashed similarly. So they are very very similar. Just the method of communication is different. 

The other communication methods mentioned in this thread... I hope to see them around one day 🙂

 

Link to comment
Share on other sites

7 hours ago, sntlewis said:

I hope this isn't a hijack BUT I'm wondering how i would run an earth lead?  I will be using Leviathan/Rapido2 UHF on my build.  I have some ideas but want the collective input so as not to bias the options/opinions.

 Details in this thread as to why I think it's a good idea and how to accomplish  

 

Link to comment
Share on other sites

15 hours ago, ChicagoKeri said:

If you mean the BTT Octopus Max EZ, I don’t see any reason why this shouldn’t work.  The Pi will need some kind of CAN interface… either a U2C will work or you could operate the Octopus in “bridge mode “ to accomplish this.  My suggestion is to run a ground/ earth lead to the hot-end when using this toolboard

Yes that is the board I mean and thankyou for the help

  • Like 1
Link to comment
Share on other sites

15 hours ago, Dirk said:

What is a tooth head?

The Octopus Max EZ is a more luxury version of the Octopus boards. So it is able to handle everything we do with the Octopus boards. Also when it comes to the CAN interface

The combination of Octopus MAX EZ, RPi, U2C (also works without), EB2209 (2040) will make it very easy to set up a CAN system on your new Voron 2.4 printer. -So: right path 🙂

If you make a build log, we will be able to follow along and give you more advise.

Thankyou and what is the best way of doing the build log I am still learning were all the different sections are on this forum 

  • Like 1
Link to comment
Share on other sites

Is the heater cartridge bonded to one side of the power supply? OK, I just checked.  No, the heater is insolated from both leads.

I never thought of it before but it seems the hot end is left to float unless you have an all metal toolhead and frame, then it would be (poorly) grounded through the bearings.

If it were needed, it would be easy enough to run a wire from the hot end mounting screws to the frame ground point.  There are rules that are generally accepted about grounding.  One is that earth grounds shall all go with one unbroken run of wire to one point.  That point is "close" to where the AC mains power cord enters the enclosure and the connection is made to the frame with a screw that is not used for any other purpose. (It is not part of the structure.). This applies to just about everything that uses a 3-conductor power cord., TV sets, toaster overs and I guess printers.  If more than one wire is used you should use a ground bus bar that is bonded to the frame.

 

The big question is "Does it matter?"   If the printer runs on 24 volts is it not a safety issue..  But 48 volts (or ACmains power) is above the threshold and for safety reasons you'd need a ground if you were to be selling printers commercially with high voltage heaters.   But I think most hot ends are 24V or less.

Is there a print quality issue?   The floating hot end might (maybe?) put a charge on the plastic.   But does this cause any print issues/

 

  • Like 1
Link to comment
Share on other sites

Posted (edited)

 

I acquired a Duet3D 6HC (1.02) mainboard, a Duet3D 1LC CANFD toolhead board and a Duet3D Paneldue 5i with the thought of trying it out on the Voron 2.4 at some point.

Some initial impressions:

The CANFD system is implemented much more nicely than our Klipper / BTT / Mellow CAN.

The system can be built as either Standalone or with a Single Board Computer such as a Raspberry Pi.   When using a Raspberry Pi, the interface between the Pi and the 6HC is a dedicated high-speed SPI bus.  USB is only used to power the Pi.   CANFD is the primary interface between any expansion boards or even CAN-enabled steppers.  A specially-formatted SD card is included, it is formatted to be used in either the 6HC as Standalone or in a Raspberry Pi in connected mode. 

The 1LC board come without the RepRap firmware installed.  This is quite easily installed, by merely copying the appropriate file to the Firmware folder in the system SD card which is installed in either the Mainboard or an attached SBC, in my case a Raspberry Pi 4b.  Starting the system causes the unflashed board to find and install the pre-compiled firmware and... that's it. Done in a very few seconds.  Duet Web Control can be easily found and accessed through a browser and the Firmware files can be uploaded this was as well.   The time from unboxing to running the test setup was fairly short and uneventful.

The Paneldue 5i (integrated)  communicates over UART for the display and SPI for the front-mounted SD card reader used for offline printing.  Again, it just plugged in and worked with no drama.   One could also use a display connected to the Pi as well, either with the HDMI port or the DSI port.

 

Some thoughts on things not related to the communications interfaces:

The build quality of the boards does not seem appreciably better or worse than our BigTreeTech or MellowFly boards. They are not, for example, built to the ruggedized quality of Automotive boards.

The 6HC is intended to be used equally well in things other than 3D printing such as CNC machining or other robotics.

The 6HC, as in High Capacity, mainboard does have substantially larger connectors for stepper motors and outputs for increased current capabilities as well as connectors for speed sensed fans.  The fuse holders seem well made and the fuses themselves appear to be quality, branded parts.   The board is rated up to 48 Volts, with Stepper Drivers rated up to 6.3 Amps, an 18 Amp output usable for a Heated Bed and three 6 Amp outputs, a bunch of other outputs and even an Earthing lug. This is gross overkill for a Voron 300!

The 1LC CAN Toolhead board has provisions for speed-sensing fans as well.  The overall layout is more general-purpose than our Octopus and Stealthburner boards and again, has provision for Earthing, a feature of particular interest to me.

The Configuration settings are a bit different that Klipper's printer.cfg.    The easiest way to configure the thing is to use the online Configuration Wizard  which will generate the necessary files to be installed on the System SD card.   

The breadth and depth of Duet documentation is impressively large but represents a considerable investment of time to study.

 

Perhaps this should be its own thread?

 

Edited by ChicagoKeri
Example set
  • Like 2
Link to comment
Share on other sites

Glad to see people trying RRF out on their Vorons I've been running it on mine for a long time now. Once you get the hang of the "Gcode Everywhere" config aproch (and keep https://docs.duet3d.com/User_manual/Reference/Gcodes bookmarked 🙂 ) it really becomes easy to set printers up. The one area RRF falls behind is in development. Very small teams working on the code and nowhere near the number of people trying stuff out and reporting bugs or submitting patches. Add to that an older develpment platform (at least for the Duet3d boards) and development of new features takes a time hit... But if you want a printer that "just works" and can wait on some bleeding edge feature its awesome.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...