I have a PC upstairs running my 3D printing slicer program (Simplify 3D). In the basement, I have several USB-enable 3D printers. My PC upstairs has a USB-to-RS-232 serial adapter. The serial side of that USB-to-Serial adapter connects to the Serial port of a Moxa Nport 6150 RS232-to-Ethernet protocol adapter. I get those Moxa devices for free when they break at work and then fix them for a couple of dollars.

The other side of the Moxa connects to my home computer network router. In the basement I can plug another Moxa into an ethernet cable on my home network and the serial RS232 output I need to connect to the Micro-USB jack of the 3D printer. How can I use an Arduino Nano (or Uno or Mega if required) to convert the RS232 data to the USB input of my 3D printer?

So I have PC->(RS-232)->[MOXA(RS-232)->Moxa(Ethernet)]->Router->[Moxa(Ethernet)->Moxa(RS-232)]->[Arduino(RS-232)->Arduino(USB)]->3D Printer(USB)... How can I get the Arduino to do that function? Items within [ and ] brackets are single devices performing a protocol conversion.

I know people use Raspberry Pi's and a program called OctoPrint to remotely control their 3D printers but I get the Moxas for free and Uno's or Nanos are dirt cheap. RPi's are more expensive and for several 3D printers it can start adding up. Any ideas? enter image description here

  • 1
    The Nano can't take RS-232: it takes logic-level serial. You will need some kind of level shifter, like the MAX232 chips. Commented Apr 28, 2021 at 18:08
  • Hmm.. something like that MAX232 chip is the part I replace in the MOXA's to fix them. If I took the serial output of the Moxa through a MAX232 chip, then the TTL serial to the RX and TX of the Arduino... that's where I get lost.
    – ABNormal
    Commented Apr 28, 2021 at 18:12
  • 1
    RX and TX directly to D+ and D- is a no go. Different protocol, different voltage levels and different functions of the pins.
    – chrisl
    Commented Apr 28, 2021 at 20:10
  • 1
    This depends entirely on what protocol your 3D printer expects over its USB port. When you plug in your 3D printer, what does it appear as? A native USB device with its own device driver? As a USB/RS-232 UART that presents a virtual COM port? If the 3D printer is not controlled by RS-232 then this is hopeless, and it's hopeless anyway because it has its UART already hidden behind a USB converter, so you would need to send the USB frames and not the raw RS-232 data. Needs more info.
    – J...
    Commented Apr 29, 2021 at 11:05
  • 1
    If the printer is an RS-232 protocol with a built-in USB converter, then one solution would be to open up the 3D printer, hack the RS-232 signal off of the UART, and connect the moxa directly to the printer's internal RS-232 lines. The arduino RS-232/USB converter only works one way - the USB is the host side, not the device side.
    – J...
    Commented Apr 29, 2021 at 11:07

4 Answers 4


Its not as easy as you think. An Arduino will not be enough for connecting the USB of the 3D printer. The USB protocol is strictly divided into slaves and masters. A USB(us) has exactly one master, which totally controls, what the slave can do. The slave itself cannot do much of its own.

Your 3D printer is a USB slave device. That enables a USB master (like a computer) to control it. The Arduino is also a USB slave device. If you connect both, you have a USB connection without a master. Nothing will happen. So you need to implement a USB master on the Arduino, which can handle the UART communication; all in software. That is generally possible, but I wouldn't recommend it. Also you definitely need extra hardware, because D+ and D- on USB are also electrically totally different from the TTL lines RX and TX (and also from the RS232 lines). They work differentially. So you need extra hardware to do that.

The easiest way with an Arduino would be to buy a USB host shield. With that you may be able to build, what you want.

But I would dispute, if this really makes sense. The cheapest USB host shield for Arduino, that I could find at amazon is around 10€, plus the price for an Arduino and the hassle of getting it all to work. A RaspberryPi Zero W only costs 10€. If you don't want to use wifi, you can add a USB to Ethernet adapter. And depending on the used software and its installation you might even be able to handle multiple printers with only one Pi (I use the Repertier Server, which has the ability to control multiple printers, I think). (Though depending on the number of printers and the resulting load you might wanna step up the game to a full Pi4)

There might be an additional way, depending on your printers. The printers microcontroller board might break the TX and RX pins out for you. Then you could connect the Arduino to them, no need for USB in that case. But that might not be an option. If the used microcontroller has a direct USB interface, there are no RX and TX pins to break out.


The Nano, like the Uno, has an onboard serial ↔ USB converter. If you can get a logic level serial from the Moxa, then you can use the Nano to convert that to USB:

  1. Load a do-nothing sketch in the Nano
  2. Connect the Moxa TX to the Nano's Tx through a 1 kΩ resistor, and the Moxa RX to the Nano's RX.

Yes, the second step looks backwards. The reason is that the labels RX and TX refer to the ATmega328P that runs your sketches on the Nano. Internally, the pin labeled RX is connected (through a resistor) to the TX pin of the serial ↔ USB converter, and this is thus the pin you want to connect the Moxa's RX. And similarly for the pin label TX (it's the RX of the onboard converter).

Step 1 is important because you do not want the 328P to open its serial port. The resistor is needed for the short time when the 328P is running the bootloader, and has its serial port open.

  • 1
    +1 Jumping RESET to GND is typically what I do, although putting the do-nothing sketch on there is a good idea also. With it held in reset, the bootloader doesn't get an opportunity to play with the serial lines either.
    – timemage
    Commented Apr 28, 2021 at 18:36
  • That's great! So I already have some of these RS232 to TTL converter boards I bought from Amazon: smile.amazon.com/gp/product/B07PFB4MHR/… I can then take the TX from that converter board to the TX of the Nano (running something like the Blink sketch) and the RX from the converter board to the RX of the Nano and then connect the Mini-USB of the NANO to the Micro USB of my 3D printer.
    – ABNormal
    Commented Apr 28, 2021 at 19:19
  • @ABNormal connect the Mini-USB of the NANO to the Micro USB of my 3D printer. No, that can never work. USB is a host-driven protocol. You can't just connect two devices together at the business end without a host.
    – J...
    Commented Apr 29, 2021 at 11:11

There's not enough information to provide a general solution at this time. As chrisl rightly says, the 3D printers are expecting a connection from a host. That host connection depends on whether the USB-serial interface inside the printer is supported. These are typically FTDI or WCH (QinHeng) chips, and would need the appropriate system driver for each type. This would be hard to implement on a USB host shield for Arduino.

Most 3d printers are, in essence, an Arduino inside. The typical 8-bit controller on the vast majority of 3d printers uses a very similar ATMega microcontroller. Some newer machines use 32-bit ARM microcontrollers, which are typically 3.3 V logic compared to the Arduino's (typical) 5 V. To add a standard RS-232 port you'd need to find the RX, TX, GND and Vcc points on each printer controller board and connect the right pins of your RS-232 to TTL converter boards to those points. This would bypass the USB ports on the printers entirely.

You might experience issues with flow control and buffering with multiple ports sending from one PC and Serial-Network-Serial latency. Marlin-style Gcode printers (= most filament printers that aren't Makerbot or Flashforge, approximately) don't use flow control: the printer sends back ok when it's ready for the next command. If your serial ports send data too slowly, the printer will pause and print quality may suffer. 3d printers don't need a really fast serial connections (under 20 kbit/s per printer, if using Gcode) but they need the data when they're ready to print.

OctoPrint can be quite an expensive option. The minimum supported platform is a Raspberry Pi 3b+ (+ power supply, SD card, USB cable, case, ...) dedicated to each printer. While you can run a very cut-down OctoPrint on a Raspberry Pi Zero, the author does not recommend it, and you have to click through an Unsupported Configuration: Use at your own risk dialogue.


If we take the following configuration PC(only pseudo serial like by old laptops without USB) -> Arduino -> USB printer, than all what is important is Arduino 'xxx.ino' pseudo ;) code:

//do all necessary setups 
(((( loop
    oh, some bytes on serial     //Nano detect some activity on serial port
    I'm dividing that in commands,status and cargo. //Nano parse this stream and determine what to do with what.
    huh, now repack that in USB protocol and send out // most probably this are data an commands to sent to printer over USB with appropriate protocol
    hey printer, here is some feed for you //Nano announce upcoming data event
//printer --> Arduino
    thanks, want more input    // printer certainly react with acknowledge, (success or error) and request or not next data
//Arduino --> PC
    let's send some more, he like it //Nano request next data package from sender PC
))) //end loop         and repeat until all done

But somehow more detailed.

I hope you understand that this id ;) "humor/joke/nonsense" pseudo code that show only organization of data flow how to make some functions/procedures. The concrete usable code is up to you. Once more, it shows only that is possible to do it with Arduino. It is certainly needed more than 5 minutes to write the comment.

I'm not sure if CR/LF come through correctly but anyone that can write code in C would be able to properly format this text and may be start filling the sections with real code

  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – VE7JRO
    Commented Jul 26, 2023 at 17:46
  • Welcome to Stack Exchange! It will probably be more helpful, and get you more reputation, if you answer more recent questions. I imagine this question, from April 2021, is no longer particularly relevant to the OP.
    – Nick Gammon
    Commented Jul 29, 2023 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.