Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.

Arduino IDE Digispark Setup in Linux Mint

Created on: 19 July 2020

Part 3 of the Digispark Arduino Tutorial Series

This part of the Digispark Arduino tutorial series shows how to set up the Arduino IDE to program Digispark ATtiny85 boards in Linux Mint, and should work with other Linux distributions such as Ubuntu. After setting up the software, the board is tested by loading a Blink sketch to it that blinks or flashes the on-board LED.

The basic steps that must be followed to program a Digispark board using the Arduino IDE in Linux Mint are 1) download and install the Arduino IDE, 2) install board support in the Arduino IDE, 3) add your Linux user name to the dialout group, 4) add udev rules to the system and 5) test the installation by loading a sketch to the Digispark board.

Digispark and compatible boards, as shown in the image below, can be programmed from the Arduino IDE in Linux Mint and other Linux distributions such as Ubuntu after following this tutorial.

Digispark and compatible boards

Instructions in this tutorial and in the video that follows are based on the Digispark programming instructions on the Digistump Wiki and the Linux Troubleshooting page on the Digistump Wiki that includes Ubuntu and Arch troubleshooting steps. Either watch the video below, or follow the instructions below the video.

Can't see the video? View on YouTube →

Arduino IDE Digispark Linux Mint Setup Tutorial Steps

The following steps show how to set up a Digispark board for programming with the Arduino IDE in Linux Mint.

1. Install the Arduino IDE

Go to the Arduino website and download and install the Arduino IDE.

Download the Linux 64 bits file for 64-bit Linux Intel systems or the Linux 32 bits file for Linux 32-bit Intel systems. There are also equivalent files for 32-bit and 64-bit ARM systems. Unzip the downloaded file, and extract the folder found in the zipped file to a convenient location, such as the Desktop. To run the Arduino IDE application, open the extracted folder and double-click the Arduino executable file.

The image below shows the contents of the folder extracted from the downloaded zipped file, with the Arduino application selected. Simply double-click this file to start the Arduino IDE application.

Unzipped Arduino IDE folder with Arduino application highlighted

After double-clicking the Arduino executable file, a dialog box pops up, as shown below. Click the Run button in the dialog box to start the Arduino IDE application.

Arduino run dialog box in Linux Mint

2. Install the Digispark Board Support Package

Start the Arduino IDE application that you downloaded in the previous step.

Open Preferences Dialog box

From the top menu of the Arduino IDE application, select File → Preferences to open the Preferences dialog box.

Paste the following in the Additional Boards Manager URLs: box of the Preferences dialog box.

The image below shows the Additional Boards Manager URLs field of the Preferences dialog box.

Additional Boards Manager URLs field of the Arduino IDE Preferences dialog box

Click the OK button to close the dialog box.

Open Boards Manager Dialog Box

In the Arduino IDE, use the top menu to navigate to Tools → Board → Boards Manager... to open the Boards Manager dialog box.

Type Digispark into the search field at the top of the Boards Manager dialog box that contains the text "Filter your search..." to easily find the Digispark package.

After filtering the packages, Digistump AVR Boards is displayed in the Boards Manager dialog box. Click the Install button at the bottom right of the Digistump item in the dialog box, as shown in the image below.

Digispark board support package in the Arduino IDE Boards Manager dialog box

After clicking the Install button, the package will start installing. This may take a while, depending on the internet speed.

When installation completes, click the Close button at the bottom right of the dialog box.

Books that may interest you:

C Programming with Arduino Book Ultimate Arduino MEGA 2560 Hardware Manual Ultimage Arduino Uno Hardware Manual

3. Add Linux User Name to the Dialout Group

In order to be able to program any board from the Arduino IDE, the Linux user must be added to the dialout group.

Open a terminal window in Linux and enter the following command:

sudo adduser $USER dialout

Enter your Linux password when prompted.

You will need to log out and then log back in, or reboot, for the changes to take effect.

4. Add udev Rules to the System

To be able to program the Digispark board from the Arduino IDE in Linux, udev rules must be added to the system. This is done by creating a file in /etc/udev/rules.d/ that contains the rules.

Create a text file called 49-micronucleus.rules in /etc/udev/rules.d/ and add the following rules to it.

# UDEV Rules for Micronucleus boards including the Digispark.
# This file must be placed at:
# /etc/udev/rules.d/49-micronucleus.rules    (preferred location)
#   or
# /lib/udev/rules.d/49-micronucleus.rules    (req'd on some broken systems)
# After this file is copied, physically unplug and reconnect the board.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.

In order to be able to create this file in the file system, you will need root permission. This can be done by opening a terminal window and entering:

sudo nano /etc/udev/rules.d/49-micronucleus.rules

The above line opens a new file called 49-micronucleus.rules with root permission from /etc/udev/rules.d/ in the nano command line text editor.

After running the above line to start the nano editor, copy all of the udev rules code from the listing above and paste them into the nano editor using the keyboard combination Ctrl + Shift + V.

In the nano editor, press Ctrl + O and then press the Enter key save the file and then Ctrl + X to exit the application.

Finally enter the following in the terminal window to reload the udev rules.

sudo udevadm control --reload-rules

5. Testing the Digispark Linux Mint Installation

Uploading a sketch to a Digispark board works differently from other Arduino boards. The board must not be plugged into a USB port, but must first be selected in the Arduino IDE. No port is selected. The sketch is uploaded, and when a prompt appears in the Arduino IDE, the board is plugged into a USB port. The following tutorial steps show how to load a sketch to a Digispark board.

Digispark Blink Sketch

The following sketch works on both Model A and Model B Digispark boards. The difference is that Model A boards have the on-board LED connected to pin 1, while the Model B boards have the on-board LED connected to pin 0.

Copy the following sketch and paste it into the Arduino IDE window. Save it as digispark_blink or a name of your choice.

void setup() {                
  pinMode(0, OUTPUT);      // LED on Model B
  pinMode(1, OUTPUT);      // LED on Model A   

void loop() {
  digitalWrite(0, HIGH);   // Turn the LED on
  digitalWrite(1, HIGH);
  delay(1000);             // Wait for a second
  digitalWrite(0, LOW);    // Turn the LED off
  digitalWrite(1, LOW); 
  delay(1000);             // Wait for a second

Select the Digispark Board in the Arduino IDE

From the top menu in the Arduino IDE, select Tools → Board → Digistump AVR Boards → Digispark (Default - 16.5MHz) to select the Digispark board.

Load the Blink Sketch to the Digispark Board

Click the Arduino Upload button on the top toolbar before plugging the Digispark board into a USB port.

Wait for the prompt at the bottom of the Arduino IDE window, as shown in the following image.

Arduino IDE with Digispark uploader prompting for device to be plugged in

When the prompt Plug in device now... (will timeout in 60 seconds) appears, plug the Digispark board into a USB port of the computer.

After the sketch finishes uploading, a success message running: 100% complete and >> Micronucleus done. Thank you! appears at the bottom of the Arduino IDE window, as can be seen in the following image.

Arduino IDE displaying Digispark upload success message