Send G-Code from Arduino to Duet Wifi 2

  • Hello, I already tried to find something about the topic but unfortunately I wasn't really successful. The plan is easy: I want my DIY-Controller with buttons to communicate with the Duet Wifi 2 Board. If I press Button X, I want to home Axis X.. if I move the Joystick, I want the toolhead to move... Somehow I need the arduino to send g-Code to the Duet Board. Any suggestions/tutorials/help is more than welcome. I want to know how to start and not break my lovely Duet Wifi Board. ^^
    Thank you

  • @flipil Hi, you have a lot of options, but one interesting thread which discussed it is Your requirement reminds me of a CNC Pendant, so this discussion may help you.

    If you connect Arduino, you have to find a protocol and if it's a 5 V based Arduino (most are), you often need to use a level shifter between Arduino and Duet. You could avoid it by using a ESP8266 shield with Arduino and transmitting G-Code through WiFi. But this may be too slow for you. It depends on your requirements.

  • Imo the easiest is to just use an esp8266 board (with the esp8266 core in Arduino IDE) and connect to the PanelDue serial port if this is free. The port provide 5v supply voltage and the esp8266 has 3v3 logic so no shifting is needed. Wemos d1 mini is cheap and compact, my preferred board for small projects.

    If the PanelDue port is in use then esp8266 with http or telnet over tcp/ip is another solution. Or you could also use something like a raspberry pi that connect to your duet with usb, to control the duet over a usb serial port. You could then use a cheap usb gamepad to control the pi, that in turn send g-code to the duet.

  • administrators

    @flipil there are a lot of options discussed. My start question is do you have a PanelDue connected, if not, and you are comfortable using an Arduino then you can use the PanelDue header and send serial gcodes from the Arduino. As already mentioned the logic is different voltage. 3.3V to 5V logic level shifters are fairly cheap in easy to use modules like this one:

    on the arduino you will need to establish a serial connection using a UART to the panelDue port and send gcodes and listen for the responses.

  • Another option to avoid level shifting if the esp8266 route isn't an option is to get a 3.3v arduni (usually a pro mini). It will run off 5v supply, and use 3.3v for logic.

    Or if you prefer the arduino uno type, there is this that can be used as 5v or 3.3v by setting a jumper i find them quite convenient.

  • Guys! Thank you so much. You really saved my life. And yes: Pendant is the word I was looking for(sorry my english is not really good) + I had no clue that I have to use 3.3V Logic. I almost started trying out to connect my Arduino with the Duet: thanks to you I DIDN'T! ^^ I'll post my results here in a couple of weeks. Shouldn't be a big problem. Again: Thank you so much!

    @T3P3Tonly: no I do not have a PanelDue connected. Could you post a picture/sketch of the wiring I have to do when using the Duet Wifi Pins(for the PanelDue) with an ESP8266?

  • @flipil here is some documentation of the PanelDue connection: and here:
    There is an interesting usage of the PanelDue connection with SmuFF, you could use it for an own ESP32 application yourself (ESP32 are really cheap): and
    I thought about using ESP32 with a camera and transmit the data to the Duet this way, but the ESP32 has not enough memory for 5 or 8 MP image data and camera usage is slow, so I will use Raspberry instead. But managing camera data aside, ESP32 is a great processor.
    BTW for ESP8266 and ESP32 there are two great eBooks from Kolban, which is a "pay what you want" principle, and are very detailed.

Log in to reply