Getting Started with DigiSpark

I bought a pile of DigiSpark devices on a whim (they’re less than $2 each), and the following are just my notes on how to get things up and running with them to do simple testing.  I’ll also note that this was based on the DigiStump connecting tutorial, but I found some gaps in their approach and wanted to document my variations here for posterity.

Here’s the step-by-step on how to get them up and running.

  1. Solder the header pins on.  There should be two sets:
    1. Power Pins:
      1. VIN – Voltage Input, unregulated, should be 9-12V DC
      2. GND – Ground
      3. +5V – Voltage Output, regulated, 5V DC
    2. I/O Pins:
      1. P0 → I2C SDA, PWM (LED on Model B)
      2. P1 → PWM (LED on Model A)
      3. P2 → I2C SCK, Analog In
      4. P3 → Analog In (also used for USB+ when USB is in use)
      5. P4 → PWM, Analog (also used for USB- when USB is in use)
      6. P5 → Analog In
  2. Download and install the Arduino IDE
  3. Download and install the DigiStump drivers (note: just extract the folder, go into it, and execute the “Install Drivers.exe” file; the drivers are signed).
  4. Open the Arduino IDE and choose “File” then “Preferences”, and then in the “Additional Boards Manager URLs” enter:
    http://digistump.com/package_digistump_index.json
  5. In the Arduino IDE choose “Tools” then “Board: ‘Arduino/Genuino Uno'” then “Boards Manager” (Note: assuming this is a fresh install that’s what the Board option will be set to).
    ds-select-board-manager
  6. In the Boards Manager window choose “Contributed” from the “Type” dropdown box and then choose the “Digistump AVR Boards by Digistump” option.  The “Install” button will appear in the bottom right corner of this selection.  Click it and wait for the install to complete.
    ds-install-option
  7. Close the Boards Manager window.  In the Arduino IDE choose “Tools” and then “Board: ‘Arduino/Genuino Uno” then “Digispark: ‘Default (16.5mhz)'”.
    ds-select-ds-board
  8. You may see a note about not running the post-install script.  If that’s the case, run the script manually, e.g.
    ds-post-install

    C:\Users\USERNAME\AppData\Local\Arduino15\packages\digistump\tools\micronucleus\2.0a4\post_install.bat
  9. Enter code of some sort… the below is the default 1 second blinking light example code from Digistump (assumes you have an LED attached to either I/O pin 1 or 0):
    // the setup routine runs once when you press reset:
    void setup() { 
     // initialize the digital pin as an output.
     pinMode(0, OUTPUT); //LED on Model B
     pinMode(1, OUTPUT); //LED on Model A 
    }
    
    // the loop routine runs over and over again forever:
    void loop() {
     digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
     digitalWrite(1, HIGH);
     delay(1000); // wait for a second
     digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
     digitalWrite(1, LOW); 
     delay(1000); // wait for a second
    }
  10. Press the “Upload” button (Note: you do NOT need to have the DigiSpark plugged in at this point).
    ds-upload
  11. Once the project is saved (if not already done) and compiled, you will be prompted to connect the DigiSpark (if it is not already connected):
    ds-connect-board
  12. Watch your blinking light go!

There’s much more that can be done with these little boards, so I’ll write up more later.  For right now, however, you can successfully say that you’re ready to develop with them!

The following sites were referenced in the creation of this article:
http://digistump.com/wiki/digispark/tutorials/connecting
https://github.com/digistump/DigistumpArduino/releases

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: