User Tools

Site Tools


This is an old revision of the document!

Debugging with the Digispark

The DigiSpark is small and inexpensive. To keep it that way it has limited features. One feature that Arduino programmers may miss is the serial monitor window. On the Arduino this is used to send and receive information from the Arduino.

Although the DigiSpark does not support the serial monitor window there are several options available with similar features.


  • The simplest is the DigiKeyboard. You can use this where you would use serial.print with an Arduino. To use this you will need to add the keyboard library. Here are the steps to try out the example:
  1. Start Arduino
  2. open DigiSparkKeyboard, under File > Examples > DigiSparkKeyboard→Keyboard
  3. On windows: Open Notepad, under All Programs > Accessories > Notepad On Mac/Linux open your favorite text editor.
  4. Drag the Notepad/text Editor window to the side
  5. Select Upload
  6. When it asks you to plug in the DigiSpark
  7. Quickly move the cursor into the open Notepad window and click
  8. In a few second “Hello Digispark!” should start appearing in the Notepad/Text Editor - it is acting as a keyboard and so will type in any application that has the focus.

Also see the DigiKeyboard Wiki Page


  • As far as DigiUSB tools packaged with the software the DigiUSB library in conjunction with the digiusbprogram in the DigiUSB Programs folder is the simplest option for full two way communication and debugging.
  • See the Examples→DigisparkUSB→Echo example for how to print a messages back to the computer.
  • Open digiusb.exe once you're device is plugged in - it then should display similar to the Arduino serial monitor, showing messages as they come in and allowing you to send data to the device (if you've set your sketch up to receive it).
  • If you get a message about missing pdcurses.dll download this and place it in the same directory as DigiUSB

See the DigiUSB page for more info.

DigiUSB RubyGem

There is also a RubyGem for communication using the DigiUSB Library

The rubygem is a package install-able using the rubygem package manager. You can download the files from github but you also need to use gem tools to compile it in to a gem and install it.

To install the rubygem, make sure you have libusb 1.x and ruby 1.9.x or ruby 2.0 installed (mac's and many versions of linux come with 1.8 installed, which is no good for this), then open a terminal and run 'gem install digiusb'. You might need to sudo that depending on your platform. Finally, you aught to be able to just type 'digiterm' in your terminal window and it will find the most recently attached digispark, connect to it, and start outputting everything printed via DigiUSB on the device and forwarding keystrokes from the terminal window in to the digispark.

Because of all this complex inter-dependency it might not be a good option for beginners.


The onboard LED and the I2C LCD can also be good debugging options.

LCD Shield Kit Tutorial

One Wire Soft Serial Debugging

Since the last version of <SoftSerial> library (may 2013), <SoftSerial> is an alternative for debugging Digispark just using a single I/O. By declaring a <SoftSerial> object with the same pin for Tx and Rx: it's possible to use a half duplex (request/response) software serial port using a single I/O.


In your sketch, declare a <SoftSerial> object with the same pin for Tx and Rx as depicted below:

Hardware wiring:
                         SERIAL ONE WIRE
                         DEBUGGING CABLE
           /                                       \
 .--------.                                  |    \
 |    GND |--------------------------------+---o5  \
 |        |                           47K  | |   9o |
 |        |                        .--###--' | o4   |
 |  DEBUG |                  4.7K  |         |   8o |
 |  TX_RX |-------------------###--+--|<|------o3   |    ---> To regular RS232 SubD 9 pins Male of PC or Serial/USB adapter
 |   PIN  |        ^               | 1N4148  |   7o |
 |        |        |               '-----------o2   |
 '--------'        |                         |   6o |
  ATtiny85       Single                      | o1  /
 (Digispark)      I/O                        |____/
                                          SubD 9 pins
#include <TinyPinChange.h>
#include <SoftSerial.h>

#define DEBUG_TX_RX_PIN         2 //Adjust here your Tx/Rx debug pin

SoftSerial MyDbgSerial(DEBUG_TX_RX_PIN, DEBUG_TX_RX_PIN, true); //true allows to connect to a regular RS232 without RS232 line driver

void setup()
  MyDbgSerial.begin(38400); //After MyDbgSerial.begin(), the serial port is in rxMode by default
  MyDbgSerial.txMode(); //Before sending a message, switch to txMode
  MyDbgSerial.println(F("\nDebug enabled"));
  MyDbgSerial.rxMode(); //switch to rxMode to be ready to receive some commands

void loop()
    MyDbgSerial.print(F("Received: ");MyDbgSerial.write(;MyDbgSerial.print(F("\n");

If you didn't plan to use DigiUSB in your sketch, this alternative consumes less pin than USB and less program memory. Plug the “Serial One Wire Debugging Cable ” to a native RS232 port or a RS232/USB adapter to your development PC. On the PC, open your favorite Terminal application at 38400,n,8,1: HyperTerminal, Teraterm (Windows) or Minicom, GtkTerm (Linux) and CoolTerm for MAC does the trick.

Trick to be less intrusive: use a “high” data rate (38400 is fine): less time wasted in ISR and for transmitting each character.

“Vintage” serial interfaces are not dead! :-)

digispark/tutorials/debugging.1367708209.txt.gz · Last modified: 2013/05/04 15:56 by RC Navy