Digispark - Program Atmel ATtiny microcontroller with Arduino IDE
June 17, 2016Digispark is a programmable platform that uses ATtiny processors and is compatible with Arduino. It could be described as an Arduino just with a different processor. How to start using Digispark?
Digispark is based on the ATtiny microcontroller, which is small, cheap, not very powerful and with few outputs, but it's enough for some basic tasks. In addition, it already includes USB, so there is no need for a USB serial converter. Digispark includes a bootloader which is used to conveniently load a program into the microcontroller.
Beliefs
Digispark
Digispark contains ATtiny85 microcontroller. The main parameters of Digispark are:
- 6 I/O Pins
- 8k Flash Memory
- I2C and SPI
- PWM on 3 pins
- ADC on 4 pins
- Power LED and Test/Status LED
Digispark Pro
Digispark Pro contains the ATtiny167 microcontroller.
- 16KB Flash Memory
- 14 I/O Pins
- I2C, true SPI, UART, LIN and USI
- ADC on 10 pins
- Power LED and Test/Status LED
Operating
After connecting Digispark to PC via USB, the virtual serial port does not appear in the system as we are used to with Arduino. There is no need to install another module(driver). At least this is the case with Linux. When programming, you probably access the USB device directly.
Description The operation of the Digispark extension on the Arduino IDE is illustrated on the official website. Just click through and in Boards Manager add board support to Digistum.
In order for a non-privileged user to use this USB device, you need to add a subsystem The event rule for Dispark is again all clearly visible in the official manual. Another option is to add the user to a group that already has access rights to USB devices.
Uploading a program to Digispark works in the order: start upload then connect the device.
Starting Digispark Pro
Uploading code to Digispark Pro didn't work for me. The Arduino IDE reported this problem:
Warning: device with unknown new version of Micronucleus detected. This tool doesn't know how to upload to this new device. Updates may be available. Device reports version as: 2.2The micronucleus utility used to upload a program to the microcontroller was old. Therefore, I used the following commands to download the current version of the micronucleus source code. I compiled the program and copied the resulting binary to the location where the Digispark extension was installed.
git clone https://github.com/micronucleus/micronucleus.git cd micronucleus/ cd commandline/ make cp micronucleus ~/.arduino15/packages/digistump/tools/micronucleus/2.0a4/micronucleus
Program
The first use can be easily tested with the diode flashing program.Digispark (Model A ) and Digispark Pro both have an LED on Arduino Pin 1. Digispark Model B has the led on Arduino Pin 0. The code to flash the LED is as follows:
void setup() { pinMode(1, OUTPUT); } void loop() { digitalWrite(1, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(1, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Programming Digispark using the Arduino IDE development environment can be seen in the following figure. The listing shows the progress of uploading the program to Digispark.
Those who have experience with Arduino can quickly develop programs for microcontrollers. All this is provided by the Wiring library and the large availability of libraries for various peripherals. Moreover, it is no longer necessary to limit oneself to one processor and one manufacturer. Now the Arduino experience can be easily applied not only to the many processors from Atmel (recently acquired by Microchip), but also to ARM microcontrollers and on IoT SoCs ESP8266.
RGB LEDs
Articles on a similar topic
Analysis of assignment and pricing of software project development
Python program to control Docker using the API
How to use MailCatcher to test emails
Python OpenAI API
Creating a WebSocket web application and setting up a proxy
Project management: agile software development
How to run old PHP applications
What a good programmer should know
Rust programming language
NodeJS: development, server configuration
Nette security bug CVE-2020-15227
REST API: platform API
Custom web and mail hosting with ISP Config software
Programming in SQL: PostgreSQL, MySQL/MariaDB
HTTPS: secure web
NoSQL database Mongo DB
Connecting to Microsoft SQL Server from Linux
What is the job description of a programmer
Python application localization
Which mail and web hosting to choose
Development for ARM processors with Arduino IDE
How to program the ESP8266 WiFi processor
Open smartphone with Linux - Openmoko Neo FreeRunner
Newsletter
If you are interested in receiving occasional news by email.
You can register by filling in your email
news subscription.
+