0% found this document useful (0 votes)
1K views21 pages

Digispark Rev.3 ATTiny85 - EN

The document provides instructions for setting up and using the AZ-Delivery Digispark Rev.3 microcontroller board based on the ATTiny85 chip. It includes specifications, pinout diagrams, schematics, and steps for configuring the Arduino IDE to program the board. Additional drivers may need to be installed for Windows or Linux to interface with the onboard USB port. Example sketches are provided to demonstrate using features like analog inputs, PWM outputs, and interfacing protocols.

Uploaded by

gamesreplys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views21 pages

Digispark Rev.3 ATTiny85 - EN

The document provides instructions for setting up and using the AZ-Delivery Digispark Rev.3 microcontroller board based on the ATTiny85 chip. It includes specifications, pinout diagrams, schematics, and steps for configuring the Arduino IDE to program the board. Additional drivers may need to be installed for Windows or Linux to interface with the onboard USB port. Example sketches are provided to demonstrate using features like analog inputs, PWM outputs, and interfacing protocols.

Uploaded by

gamesreplys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Welcome!

Thank you for purchasing our AZ-Delivery Digispark Rev.3 with ATTiny85. On
the following pages, you will be introduced to how to use and set-up this
handy device.

Have fun!
Table of Contents

Introduction....................................................................................................3
Specifications................................................................................................4
Features of ATTiny85....................................................................................5
The pinout.....................................................................................................6
The schematic...............................................................................................8
How to set-up Arduino IDE..........................................................................10
Additional setup.......................................................................................14
Windows drivers......................................................................................16
Linux drivers............................................................................................17
Sketch examples.....................................................................................18
ADC and PWM sketch.............................................................................19

-2-
Introduction

The Digispark is a compact microcontroller development board based on


ATTiny85 chip. The ATTiny85 is a high performance, low power 8-bit
microcontroller chip with 8kB of a programmable flash memory for program
storage. The flash memory has an endurance of at least 10 thousand
write/erase cycles.

The Digispark has an on-board USB port and can be plugged into a PC
USB port without the necessity of an additional cable. It can be powered
directly from the USB port. The second way that the module can be
powered on is via three additional power supply pins.

The Digispark has six general purpose input/output (GPIO) pins which have
multiple functions, for example, USB functions, ADC functions, I2C interface
pins, SPI interface pins, etc. This can be seen on a pinout diagram image
(later in the text).

To make the Digispark operational, the micronucleus bootloader has to be


loaded into the internal memory, which leaves 6kB of operational memory
for the programs.

The Digispark programming is supported from the Arduino IDE. It is


required to add several addons and settings, the procedure is explained on
the following pages.

-3-
Specifications

Operating voltage 2.7V - 5.5V


External power supply voltage 6V - 12V (VIN pin)
Operating current 300µA
Operating temperature -40°C to 85°C
Input/Output pins 6 multipurpose pins (analog, digital)
Interface support SPI, I2C
Memory capacity 8kB
Dimensions 20x19x6mm(0.8x0.7x0.2in)

The Digispark has two on-board LEDs. One is for power indication, and the
other is connected to the pin 1 (PB1).

-4-
Features of ATTiny85

High Performance 8-bit microcontroller


8kB In-System Programmable Program Memory Flash
512B In-System Programmable EEPROM
512B Internal SRAM
8-bit Timer/Counter with prescaler and two PWM channels
8-bit High speed Timer/Counter with separate prescaler, two high
frequencies PWM outputs
USI – Universal Serial Interface
10-bit ADC ADC noise reduction
4 single ended channels
2 differential ADC channel pairs (with programmable gain 1x,
20x)
Programmable Watchdog timer with separate on-chip oscillator
In-system programmable via SPI port
External and internal interrupt sources
Internal calibrated oscillator
Enhanced Power-on Reset circuit
Low power idle and power-down modes
Six programmable I/O lines
Operating voltage: 2.7 – 5.5V
Low power consumption active mode: 1MHz – 1.8V, 300uA
power-down mode: 0.1uA at 1.8V

-5-
The pinout

The Digispark has nine pins. The pinout is shown on the following image:

The Digispark has total of 9 pins and USB connector. There are 6 GPIO
pins, 3 additional pins for external power supply and the USB (OTG - On
The Go type) connector. Two pins (2 and 3) are connected to the USB port
data pins. To utilise pins (2, 3) as GPIO pins, USB must be disabled.

The pins with a (PB) designations on the pinout image are the actual pin
names that are used when addressing the pins from the code in the Arduino
IDE.

-6-
To use the RESET pin to reset the microcontroller, the pin has to be driven
LOW. To do this safely, use the push down button with pull down resistor
connected between the RESET pin and GND. By default the RESET pin I/O
function is disabled by the micronucleus bootloader code and as such can
not be used as the GPIO pin, only as RESET pin. There are other methods
to disable reset function of the pin and make it usable as I/O pin but that is
not in the scope of this eBook.

-7-
The schematic

The schematic diagram shows the simplicity of the Digispark circuit. The
circuit consists of an ATTiny85 chip, voltage regulator, diodes, few resistors,
capacitors and LEDs.

The Digispark has 3 additional pins (JP2) for external power supply, the VIN
voltage input pin and it can be supplied with voltages from 6V to 12V. The
voltages are regulated by an on-board 5V voltage regulator. The voltage
regulator current limit is 500mA.

-8-
The 5V pin is a voltage output pin and can supply other peripheral devices
connected to Digispark. The overall current consumption should not exceed
the limit (500mA) of the voltage regulator, otherwise damage may occur.

-9-
How to set-up Arduino IDE

If the Arduino IDE is not installed, follow the link and download the
installation file for the operating system of choice.

For Windows users, double click on the downloaded .exe file and follow
the instructions in the installation window.

- 10 -
For Linux users, download a file with the extension .tar.xz, which has to
be extracted. When it is extracted, go to the extracted directory and open
the terminal in that directory. Two .sh scripts have to be executed, the first
called arduino-linux-setup.sh and the second called install.sh.

To run the first script in the terminal, open the terminal in the extracted
directory and run the following command:
sh arduino-linux-setup.sh user_name
user_name - is the name of a superuser in Linux operating system. A
password for the superuser has to be entered when the command is
started. Wait for a few minutes for the script to complete everything.

The second script, called install.sh, has to be used after the installation
of the first script. Run the following command in the terminal (extracted
directory): sh install.sh

After the installation of these scripts, go to the All Apps, where the
Arduino IDE is installed.

- 11 -
Almost all operating systems come with a text editor preinstalled (for
example, Windows comes with Notepad, Linux Ubuntu comes with
Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text
editors are perfectly fine for the purpose of the eBook.

Next thing is to check if your PC can detect a microcontroller board. Open


freshly installed Arduino IDE, and go to:
Tools > Board > {your board name here}
{your board name here} should be the Arduino/Genuino Uno, as it can
be seen on the following image:

The port to which the microcontroller board is connected has to be selected.


Go to: Tools > Port > {port name goes here}
and when the microcontroller board is connected to the USB port, the port
name can be seen in the drop-down menu on the previous image.

- 12 -
If the Arduino IDE is used on Windows, port names are as follows:

For Linux users, for example, port name is /dev/ttyUSBx, where x


represents integer number between 0 and 9.

- 13 -
Additional setup

For the Arduino IDE to be able to recognize the Digispark, several settings
has to be set. When the installation is finished, open the Preferences
window, with the following menu command: File > Preferences

The following link text has to be copied in the Additional Boards Manager
URLs text box: http://digistump.com/package_digistump_index.json
as on the following image:

Click OK to finish.

- 14 -
The Digispark board support has to be installed in Arduino IDE. To do so go
to:
Tools > Board > Boards Manager...
when new window opens, under the Type (drop-down menu), select the
option Contributed as on the following image:

Next, in the search box type digistump and search for Digistump AVR
Boards as on the following image:

Click on Install button to proceed with the installation.

In order for Linux operating system to be able to detect the module, in


Ardunio IDE the different programmer must be selected:
Tools > Programmer > Micronucleus

- 15 -
Windows drivers

To use the Digispark with the Arduino IDE on Windows, the USB driver for
the Digispark has to be installed. The driver can be downloaded from the
following link. Extract the downloaded file and open the folder where the file
is extracted. Double click the installation file called DPinst64.exe. For the
32bit version of Windows, execute the file called DPinst.exe.

- 16 -
Linux drivers

Open terminal and run the following commands:


sudo apt-get install libusb-0.1-4:i386

and
sudo apt-get install libusb-0.1-4

After the installation of these apps, the Arduino IDE is able to detect the
USB port on which the Digispark module is connected. If it still can not
detect the Digispark module, restart the system after installation of these
apps.

- 17 -
Sketch examples

Blink sketch

void setup() {
pinMode(1, OUTPUT);
}

void loop() {
digitalWrite(1, HIGH);
delay(1000);
digitalWrite(1, LOW);
delay(1000);
}

In the setup() function mode of the digital pin 1 is set to OUTPUT. The
on-board LED is connected on the pin 1. In the loop() function the delay
time is set and the on-board LED turns ON and OFF in intervals of one
second.

- 18 -
ADC and PWM sketch

#define PWM_PIN 1 // on-board LED pin


#define ANALOG_PIN 1 // PB2 pin - ADC1 pin
void setup() {
pinMode(PWM_PIN, OUTPUT);
}
void loop() {
uint16_t value = analogRead(ANALOG_PIN);
// analog value is in the range from 0 to 1023
// pwm value is in range from 0 to 255
// just divide analog value by 4 and
// use it as pwm value
value = value / 4;
analogWrite(PWM_PIN, value);
delay(100);
}

- 19 -
The sketch starts with creating two macros that represent the digital I/O
pins.

The first macro defines the pin to witch the on-board LED is connected and
the PWM signal is outputted. The second macro represents the analog pin.
The resistance of the potentiometer that is read through this pin changes
the PWM value.

Next, in the setup() function the mode of digital pin connected to an on-
board LED is set to OUTPUT and initialized.

After that, the function called analogRead() is created. The function has
one argument and retruns an integer value. The argument is an integer
value and represents the analog input pin from which the analog voltage is
read. The return value, also an integer value, is the digital representation of
the read analog voltage. This value is in the range from 0 to 1023 (10bit
resolution of ADC converter of the ATTiny85 chip). The PWM value is an
8bit value, and integer value in the range from 0 to 255. To use the value
returned by analogRead() function to set the PWM value, the
analogRead() value has to be divided by 4, an integer division. This is
done with the following line of code:
value = value / 4;

At the end of the sketch, the delay of 100ms is set. This is the time interval
between two analogRead() measurements.

- 20 -
Now it is the time to learn and make your own projects. You can do that with
the help of many example scripts and other tutorials, which can be found on
the internet.

If you are looking for the high quality microelectronics and


accessories, AZ-Delivery Vertriebs GmbH is the right company to get
them from. You will be provided with numerous application examples,
full installation guides, eBooks, libraries and assistance from our
technical experts.

https://az-delivery.de
Have Fun!
Impressum
https://az-delivery.de/pages/about-us

- 21 -

You might also like