To upload a sketch to an M-Duino Arduino PLC or Ardbox Arduino PLC from the Linux shell, use Arduino CLI to compile and upload the .ino in one command, arduino-cli compile --upload -p /dev/ttyACM0 --fqbn industrialshields:avr:mduino:cpu=mduino42plus MySketch, or use avrdude to write a .hex file that is already compiled. In both cases your user needs access to the serial port (group dialout) and the right port name, usually /dev/ttyACM0.
This guide shows the Linux steps: find the port, install Arduino CLI with the Industrial Shields boards, compile and upload, and the avrdude commands with the tools that the Arduino IDE 2 already installed.
What you need
- An Arduino PLC from the M-Duino Arduino PLC or Ardbox Arduino PLC families and its USB cable.
- A PC with Linux (Ubuntu, Debian or similar) or a Raspberry Pi with Raspberry Pi OS.
- Your user in the
dialoutgroup, so it can open the serial port withoutsudo:
sudo usermod -aG dialout $USER
Log out and in again so that the new group applies.
How do you find the serial port of the PLC?
Connect the PLC by USB and list the serial devices:
ls /dev/ttyACM* /dev/ttyUSB*
The M-Duino Arduino PLC and the Ardbox Arduino PLC usually appear as /dev/ttyACM0. If you are not sure, run the command with the PLC disconnected and again connected: the new device is the PLC. With Arduino CLI installed, arduino-cli board list shows the ports with the board it detects.
Method 1: compile and upload with Arduino CLI
Once Arduino CLI and the Industrial Shields boards are installed (the guide below explains how), compile and upload with the FQBN of your model and your serial port:
arduino-cli compile --fqbn industrialshields:avr:mduino:cpu=mduino42plus MySketch
arduino-cli upload -p /dev/ttyACM0 --fqbn industrialshields:avr:mduino:cpu=mduino42plus MySketch
Complete Arduino CLI guide. The full guide, with the example sketch, the FQBN of every model and the serial monitor, is in Arduino CLI for Arduino PLC: compile and upload on Windows and Linux.
Method 2: upload a .hex file with avrdude
avrdude only writes compiled files. Get the .hex with Sketch > Export Compiled Binary in the Arduino IDE 2 (it goes to a build folder inside the sketch folder) or with arduino-cli compile -e.
You do not need to install avrdude from the distribution: the Industrial Shields core installs the version that its boards use, with its configuration file (the version folder depends on the core):
AVRDUDE=~/.arduino15/packages/industrialshields/tools/avrdude/6.3.0-arduino17
ls $AVRDUDE/bin/avrdude $AVRDUDE/etc/avrdude.conf
M-Duino Arduino PLC (ATmega2560, protocol wiring, 115200 baud):
$AVRDUDE/bin/avrdude -C $AVRDUDE/etc/avrdude.conf -p atmega2560 -c wiring -P /dev/ttyACM0 -b 115200 -D -U flash:w:MySketch.ino.hex:i
Ardbox Arduino PLC (ATmega32u4, protocol avr109, 57600 baud): its bootloader starts when the port is opened at 1200 baud, and then the port can change for a few seconds. Open it at 1200, check the port again and run avrdude at once:
stty -F /dev/ttyACM0 1200
ls /dev/ttyACM*
$AVRDUDE/bin/avrdude -C $AVRDUDE/etc/avrdude.conf -p atmega32u4 -c avr109 -P /dev/ttyACM0 -b 57600 -D -U flash:w:MySketch.ino.hex:i
| Option | Meaning |
|---|---|
-C | avrdude configuration file. Use the one next to the avrdude that you run |
-p | Microcontroller: atmega2560 on M-Duino Arduino PLC, atmega32u4 on Ardbox Arduino PLC |
-c | Bootloader protocol: wiring on M-Duino Arduino PLC, avr109 on Ardbox Arduino PLC |
-P | Serial port of the PLC |
-b | Speed: 115200 on M-Duino Arduino PLC, 57600 on Ardbox Arduino PLC |
-D | Skip the full chip erase before writing, as the Arduino IDE also does |
-U flash:w:file.hex:i | Write the file to the flash memory, in Intel HEX format |
The old version of this guide installed avrdude from a third party PPA. That is no longer needed, and the avrdude of your distribution can be a different version from the one that the Industrial Shields boards use, so the commands above use the avrdude of the core.
How this guide was checked. The FQBN, microcontrollers, protocols, speeds and the avrdude folder come from the boards.txt and platform.txt files of the Industrial Shields AVR core 1.2.1, downloaded from the official boards URL on 27 October 2026, and a test sketch compiled for these FQBN with that core on Ubuntu 24.04. The upload commands were not run on a PLC for this update.
FAQ about uploading from the Linux shell
Why does the upload fail with "Permission denied" on /dev/ttyACM0?
Your user is not in the dialout group yet, or you did not log out after adding it. Check it with groups.
Why does avrdude stop with "not in sync" or "butterfly_recv"?
The port, the protocol or the speed do not match the PLC, or another program has the port open. On Ardbox Arduino PLC, run avrdude right after the 1200 baud reset.
Can I program an M-Duino Arduino PLC from a Raspberry Pi?
Yes. Arduino CLI has ARM builds, and the Industrial Shields index includes the compiler and avrdude for ARM 32 and 64 bit Linux.
Can I upload over Ethernet?
Yes, with a binary file and a remote reset. See upload a sketch to a PLC using Ethernet, step 2: binary file.
More about programming Arduino PLCs
- Upload a sketch to an Arduino PLC from the Windows command line
- How to install Industrial Shields boards in the Arduino IDE
- How to configure the serial port on industrial Arduino IDE
- Choosing an industrial controller
See the models in the Arduino PLC family, for example the M-Duino 42 or the Ardbox Analog.