Setting Up the Arduino Firmware
Before using Ardulink-2 from Java, your Arduino board needs the Ardulink firmware. This firmware implements the Ardulink protocol, enabling communication between the Java library and the Arduino hardware.
Quick Upload: WebSerial Flasher
The fastest way to flash the firmware is the browser-based WebSerial Flasher — no software installation required.
- Open the WebSerial Flasher in Chrome or Edge (WebSerial support required)
- Click ↻ Latest to automatically fetch the latest firmware release
- Click Program
- When prompted, select your Arduino’s serial port
- Wait for the upload to complete — you’ll see a success message
If the WebSerial Flasher doesn’t work for your board, use one of the alternative methods below.
Alternative: Pre-compiled HEX Files
Download ready-to-flash .hex files from the Firmware Releases.
Available board variants:
- Arduino Uno
- Arduino Nano
- Arduino Mega
Upload using one of these tools:
| Tool | Platform | Notes |
|---|---|---|
| avrdude | macOS/Linux/Windows | Command-line, most reliable |
| XLoader | Windows | Simple GUI |
| Arduino IDE | macOS/Linux/Windows | Via sketch import |
Using avrdude
# For Arduino Uno
avrdude -p atmega328p -c arduino -P /dev/ttyACM0 -b 115200 -U flash:w:ArdulinkProtocol_uno.hex
# For Arduino Mega
avrdude -p atmega2560 -c wiring -P /dev/ttyACM0 -b 115200 -U flash:w:ArdulinkProtocol_mega.hex
Replace /dev/ttyACM0 with your actual serial port. On macOS it’s typically /dev/cu.usbmodem*, on Windows it’s COM3, COM4, etc.
Alternative: Build from Source
If you want to customize the firmware, build it from source:
- Install the Arduino IDE
-
Clone the firmware repository:
git clone https://github.com/Ardulink/Firmware.git - Open
Firmware/ArdulinkProtocol/ArdulinkProtocol.inoin the Arduino IDE - Select your board under Tools > Board
- Select your serial port under Tools > Port
- Click Upload
Firmware Variants
The firmware repository includes different variants in the variants/ directory and pre-compiled in the examples/ directory. These may include:
- Standard Ardulink Protocol — Default firmware for serial communication
- NodeMCU variants — For ESP8266-based boards with Lua scripting
- Custom examples — Demonstration sketches with additional functionality
What the Firmware Does
Once uploaded, the firmware:
- Listens for commands on the serial port (or other configured transport)
- Parses the Ardulink protocol messages
- Executes commands (set pins, read pins, play tones)
- Sends responses and events back to the Java side
The protocol supports:
- Digital pin read/write
- Analog pin read/write
- PWM control
- Tone generation
- Custom message exchange
- Pin change subscriptions
Protocol Specification
For full details on the communication protocol, see the Ardulink2 Specification.
Firmware Version
The current firmware release is v1.2.0 (February 2025).
Troubleshooting
Upload fails
- Try a different USB cable (some are charge-only)
- Make sure the correct board and port are selected
- On Linux, check serial port permissions:
sudo usermod -a -G dialout $USER - Press the reset button on the Arduino just before uploading
Firmware uploads but Java can’t connect
- Verify the firmware is the Ardulink protocol firmware (not a blank sketch)
- Check that the baud rate matches (default: 115200)
- Ensure no other application is using the serial port
WebSerial Flasher not available
- WebSerial requires Chrome 89+ or Edge 89+
- Must be served over HTTPS (the GitHub Pages URL is fine)
- Try a different browser if issues persist
Next Steps
- Getting Started — Set up the Java side
- Link Types — All available transports
- Ardulink-2 Architecture — How the protocol works