Save gcode files on Printer SD card fast via WiFi / LAN , end of slow tranfer times

Initial situation:

I've got an Ender 3 Pro connected to latest OctoPi / Octoprint running on Raspi Pi 4 B (8gb)
For complicated gcode running jobs through Octoprint => Printer USB (serial connection with 250k baud rate) printing time usally increased by ~20-25%.
Even for (a lot of) small prints while "prototyping" I was quite annoyed with a few minutes longer printing times.
I ended up with saving everything on the SD card and print it from there.
As saving on SD is of course very slow through OctoPrint (thx to serial connection again), I was juggling SD cards in and out.

Trying to solve it the easy way...:
I looked for WiFi enabled SD cards and use such a thing with a SD to MicroSD adapter.
Two things prevented my doing it:

  1. Toshiba FlashAir Card are not available at all in germany or even more expensive that the solution I came up with.
  2. Bad reviews for all the chinese crap cards - I tried it anyway with different cards and couldnt get it working.

So I gave up this idea and had in mind that there should be some kind SD Emlulator / adapter... what ever.
And I found the interesing (open hardware) project SDWire: https://wiki.tizen.org/SDWire
The idea is quite simple:

  1. MicroSD card slot for the media
  2. USB connection to the host system
  3. MicroSD shaped part of the board goes to the "client" (printer)

By a piece of software you can switch the card access between host and printer.

As I'm completly incapable of soldering I checked for preassembled version and found exaclty what I was looking for ... in an blog entry: OctoPrint.org - Automating OctoPrint's release tests

It's referring to a kind of expensive (tiny) piece of hardware, but exactly what I was looking for:
USB-SD-Mux

The USB-SD-Mux switches a SD-Card between your Device Under Test (DUT) and a host PC. Therefore plugin the SD-Card manually is no longer necessary.

Orderd, arrived fast, connected, tested manually on console - working!

But as my laziness is endless, of course I made a very simple bash script for automate that stuff.
A plugin for OctoPrint would have been the better solution, but I wanted something that I can realize I a few minutes.

The final hardware setup:

  • Ender 3 connected by USB to Raspi / OctoPrint
  • USB SD Mux inside of Ender 3 MicroSD slot
  • USB SD Mux connected to Raspi by USB

Software:

  • Standard OctoPrint
  • Incron monitoring Octoprints upload folder
  • Bash script transfering incoming files to printer SD card

I made some simple "rules" just based on the uploaded filenames.
When a file is moved to the upload folder Incron triggers my bash script.
If filename is prefixed with "sd-" or "ap-" script will run (if printer is idle):

  • Switch SD Mux to host
  • Mount SD card volume
  • Copy renamed file to SD card
  • Unmount SD card
  • Switch SD Mux to printer
  • Some API calls to OctoPrint (Init printer sd card, load file, start printing if filename started with "ap-")

Runtime for that process is about ~8-10 seconds.

From Cura to printer SD card and direct start of the print with just seconds of transfer time is now possible and exactly what I was looking for.

Hopefully this will also work with a MicroSD to SD adapter (although SD Mux manual says it shouldn't be done because of possible EMC issues) as I already ordered and waiting for my new printer (Prusa i3 MK3S)

3 Likes

When I wrote that blog post I certainly did not expect anyone to use these devices for that kind of workflow (given their cost). Awesome stuff though!

I'm kinda surprised that you couldn't get the flashair stuff here, back when I experimented with these they were really available. Too bad.

1 Like

I swore someone here on the forum had designed a special PCB that would do just that, allow switching between having the SD card mounted over serial vs connected in printer and flip back and forth.

Found it...

this is my project, unfortunately when it was launched many did not understand its usefulness / operation or judged the product too expensive with the octoprint plugin (70 €) and the project was finally canceled. however, at the time I had added an octoprint hook ("sdcard") which still works just as well with my prototype. this hook can therefore be used for the development of a new dedicated plugin