<p>One option would be to have your printer controlled by an Octoprint server.  You would then use the <a href="https://github.com/chunkysteveo/OctoPrintAPI" rel="nofollow noreferrer">Octoprint Api plugin</a> to use your arduino to send commands to octoprint - and from there, your printer.  Octoprint has a fairly fully-featured rest api that allows you to send arbitrary GCODE to your printer (<a href="http://docs.octoprint.org/en/master/api/printer.html#send-an-arbitrary-command-to-the-printer" rel="nofollow noreferrer">see here</a>).  You would then hook up your buttons to some code that sends the gcode commands to the printer when pressed.  It's certainly not as simple as installing a plugin - you'll have to write some interface code, but it looks like those APIs should be able to do what you want, without interfering with the standard controls at all.</p>

CC BY-SA 4.0
2018-12-24T16:22:55.073Z
Thanks, I will definitely look into that ...................................................................................................................................................  Would there be any way to do it without a raspberry pi? Like using the Arduino to send serial commands the same way we do with the serial console in the Arduino IDE?
cds333
CC BY-SA 4.0
2019-05-26T17:05:48.757Z
Yeah after looking into that I would not want to use octoprint. There are still way too many bugs.
cds333
CC BY-SA 4.0
2018-12-20T14:24:49.597Z
2018-12-20T14:24:49.597Z
Tal
<p>There's already Arduino inside the printer (to be precise: the printer board with spare pins). Im sure its possible to hook up a switch then change firmware to send G-codes; 1 pin per series of commands?</p>

CC BY-SA 4.0
2020-06-23T19:47:12.247Z
Are you sure, or are you asking?
Davo
CC BY-SA 4.0
2021-09-05T17:18:19.867Z
Where would you add the code? In which file(s)?
Greenonline
CC BY-SA 4.0
2020-06-23T09:44:42.140Z
2020-06-23T10:39:12.380Z
2020-06-23T10:39:12.380Z
Simon Dyer
<p>I want to hook up an Arduino to my Creality printer running Marlin firmware, such that I can have a few physical buttons mounted on the machine that will execute commands such as preheat, home, disable steppers, and so on, so that I don't have to navigate through the clunky LCD screen.</p>
<p>Ideally it would work in addition to the normal LCD and serial functionality, so it would not impede me from using Ultimaker Cura to print via USB, etc.</p>
<p>What is the best way to do this?</p>

CC BY-SA 4.0
2018-12-21T15:36:47.430Z
How many pins are still free on your Arduino Uno)
Trish
CC BY-SA 4.0
2018-12-24T16:20:49.933Z
All of them....
cds333
<marlin><diy-3d-printer><firmware><arduino>
How to make physical buttons send G-code?
cds333
# How to make physical buttons send G-code?

(Asked by: username_0 on 2018-12-20)

I want to hook up an Arduino to my Creality printer running Marlin firmware, such that I can have a few physical buttons mounted on the machine that will execute commands such as preheat, home, disable steppers, and so on, so that I don't have to navigate through the clunky LCD screen.

Ideally it would work in addition to the normal LCD and serial functionality, so it would not impede me from using Ultimaker Cura to print via USB, etc.

What is the best way to do this?

**Tags:** marlin, diy-3d-printer, firmware, arduino
> **Comments:**
> **username_1**: How many pins are still free on your Arduino Uno)  
> **username_0**: All of them....  

---

## 2 answers

### Answer by username_2 on 2018-12-20. Score: 4

One option would be to have your printer controlled by an Octoprint server. You would then use the [Octoprint Api plugin](https://github.com/chunkysteveo/OctoPrintAPI) to use your arduino to send commands to octoprint - and from there, your printer. Octoprint has a fairly fully-featured rest api that allows you to send arbitrary GCODE to your printer ([see here](http://docs.octoprint.org/en/master/api/printer.html#send-an-arbitrary-command-to-the-printer)). You would then hook up your buttons to some code that sends the gcode commands to the printer when pressed. It's certainly not as simple as installing a plugin - you'll have to write some interface code, but it looks like those APIs should be able to do what you want, without interfering with the standard controls at all.

> **Comments:**
> **username_0**: Thanks, I will definitely look into that ...................................................................................................................................................  Would there be any way to do it without a raspberry pi? Like using the Arduino to send serial commands the same way we do with the serial console in the Arduino IDE?  
> **username_0**: Yeah after looking into that I would not want to use octoprint. There are still way too many bugs.  

---

### Answer by username_3 on 2020-06-23. Score: 0

There's already Arduino inside the printer (to be precise: the printer board with spare pins). Im sure its possible to hook up a switch then change firmware to send G-codes; 1 pin per series of commands?

> **Comments:**
> **username_4**: Are you sure, or are you asking?  
> **username_5**: Where would you add the code? In which file(s)?  

---

