This lesson will help you install the necessary software to enable your computer to communicate with your Brain Board.
This guide will take you step by step in setting up the software you will need to connect your Brain Board to your PC or MAC in order to program it.
Step 1: Gather your Hardware and USB Cable
- your Brain Board,
- USB Cable
- computer or laptop
Step 2: Download and Install the Arduino IDE
We need to install the Arduino Integrated Development Environment (IDE) to connect to the Brain Board. IDE is just a fancy name for the software that will let you write our code and program the Brain Board.
If this is the first time , don’t worry. It is as easy any app you have used before.
- Download the software for your MAC or PC: http://arduino.cc/en/Main/Software
- You want to use the current Arduino 1.6.4 or higher
- Unzip the file and run the Installer or Setup.exe
- Run the Arduino application
If you have any issues, see this page: https://www.arduino.cc/en/Guide/HomePage
Step 3: Open the Arduino IDE Application
When the IDE loads you should have a screen like this. This is where we will write our first sketch later.
Step 4: Install support for the Brain Board
The Brain Board uses the Micronucleus Bootloader Tiny85 v2.02 on the included ATtiny85 in your kit.
We need to set up Arduino to recognize the Brain Board via USB so we can download our sketches to it.
The Micronucleus Bootloader is an open source project can be found on GitHub: https://github.com/micronucleus/micronucleus
One of the early adoptions of Micronucleus was in the Digispark by the folks at Digistump. Digistump not only contributes to the Micronucleus project, but they also have contributed to the community the Arduino IDE connectors.
Arduino has a Board Manager which allows developers to add support for other hardware platforms that use the Arduino architecture and language.
To install the Board Manager connectors we need, we will direct the Arduino IDE to the Digistump Arduino Board Manager libraries.
Configure Arduino IDE Configuration and Install Digistump Board Manager:
- If you have not done so already, launch Arduino.
- Arduino on Windows go to FILE -> PREFERENCES
- Arduino on MAC go ARDUINO -> PREFERENCES
- In the box labeled “Additional Boards Manager URLs” enter:
- Click OK
- In the Arduino menu, go to TOOLS -> BOARD -> BOARD MANAGER
- In the Boards Manger, type DIGISTUMP in the box
- Click on the Digistump AVR Boards
- Click on the Install button
- When the install completes, click Close or OK.
- See the animated GIF below to see the process.
Step 5: Configure the Board Settings
We know need to set the correct board.
Select Tools -> Board -> Digispark (Default 16.5mhz)
Step 6: How to Upload a Sketch to Brain Board
- Write your sketch in Arduino. (we will walk through this in the next lesson)
- Disconnect the Brain Board from USB.
- Click the Upload Button and then connect the Brain Board back to USB.
Micronucleus works a little different than an Arduino
The ATTiny85, is just that, TINY.
It has only 8K of Flash memory and runs at a rate of 20Mhz. This is plenty of power for what we will do and plenty of power for hardware. BUT! When you compare it to the CPU of the computer you are on it is minuscule!
Because of its small memory and slower processing power, we have a few limitations we need to account for. One of those limitations is that the USB software connection only runs on startup of the chip.
The Brain Board ATTiny is pre-loaded with the Micronucleus Bootloader Tiny85 2.02. The bootloader allows us to connect the board to a computer via USB.
This means that when you power on the Brain Board, the first thing the ATTiny bootloader does is to see if it is connected to USB. If so, it begins communication with your computer.
If it is not connected, it continues onto running the next set of instructions, such as your Arduino sketch.
This is one of the reasons the Micronucleus Bootloader is very good for our platform. It will not spend any unnecessary cycles trying to communicate via USB.
We have to use the Brain Board a little different than other Arduino boards when we program it.
Normally, you would connect your Arduino via USB to your computer. The computer would sense the Arduino Board and add a serial (com) port that the Arduino IDE could connect to.
You would write your sketch and then hit the UPLOAD button. The Arduino Software would tell the board to “wake up” and accept this new code, and then reboot.
With the Brain Board, after it boots up, it looks to immediately download the sketches from Arduino and if there are none, it moves on. That means that we have to work a little different in Arduino.
The Digistump Board Manager libraries we installed will fix this for us. It makes the Arduino upload process wait for the board to connect and then it sends the code to the Brain Board as soon as it senses it.
In the Next lesson, we will write your first sketch and upload it to the Brain Board.