Introduction: LittleBits Arduino As ATtiny Programmer
This instructable will show you how to program an ATtiny85 chip from a littleBits Arduino. There are a variety of ATtiny chips; I will be focusing on the ATtiny85. It's a great way to make an inexpensive, permanent version of your prototyped project, like my new "controllable RGB led" module (If it gets 1,000 votes in the next 45 days, they will make it an official bit, so please for it on the new bitLab).
My three main sources of information are:
- The littleBits Arduino discussion forum post "Getting Started" by Matt_littleBits. The littleBits Arduino module pins and features image came straight from there.
- The Hi - Low Tech research group at MIT Media Lab <-- open this in another tab and keep it open!
- PeterVH - ArduinoISP on the Leonardo
You do not need an additional Arduino or programmer board for this project!
Materials and Tools:
- littleBits Arduino, which is available individually or in a starter bundle.
- any littleBits led
- a littleBits power
- ATtiny85 chip. Sparkfun is a good source. Get a few.
- solderless breadboard and jumper wires
- one led paired with a resistor for testing blink.ino
Recommended but not required: header pins , solder, soldering iron (I recommend that you solder header pins to the pinholes on your littleBits Arduino, but it's not absolutely required for this project. I'm sure you could use male jumper wires and tape them to the board to keep them secure.)
Step 1: Installing Support Files
1) From the Hi - Low Tech page, download the ATtiny-master.zip file and follow their steps under "Installing ATtiny support in Arduino"
2) Find the ArduinoISP.ino file in the "File > Examples" menu. In ArduinoISP.ino, change this line:
#define RESET SS
into:
#define RESET 10
3) For Windows users... As recommended by RoystonS , in your newly created sub-folder called “hardware” in the sketchbook folder, create a new folder called "leofix", and create a text document called "programmers.txt" with the following four lines in it:
arduinoispleo.name=Arduino as ISP (Leonardo)
arduinoispleo.communication=serial
arduinoispleo.protocol=arduino
arduinoispleo.speed=19200
4) Restart the Arduino IDE, and you will see “Arduino as ISP (Leonardo)” in the “Tools > Programmers” menu. (see image for reference). Don't select this option yet. For now, stick with whatever programmer you had been using for the littleBits Arduino - "AVRISP mkII". Select the Arduino Leonardo board under Tools > Board.
5) Attach a littleBits led to pin 9 and power up. Compile and upload ArduinoISP.ino to the littleBits Arduino (Leonardo). The led on pin 9 will make a heartbeat pulse to confirm that your littleBits Arduino is ready to act as a programmer.
Step 2: Pinouts / Making Connections
There are 12 pinholes on the littleBits board. The six center pinholes are referred to as a group as the ICSP, which stands for in-circuit serial programming. To make contact with these pinholes, you can solder header pins.
LittleBits ICSP:
.........................GND --> O O <-- RESET
Digital Pin 16 / MOSI --> O O <-- Digital Pin 15 / SCK
..........................VCC --> O O <-- Digital Pin 14 / MISO
ATtiny85 Pinout:(see diagram image, and locate the little circle, which indicates top left corner of the chip).
Make Connections: Remove power from your littleBits Arduino module, and make these connections:
littleBits Arduino to the ATtiny chip
GND --> GND
MOSI --> MOSI
VCC --> VCC
SCK --> SCK
MISO --> MISO
D10 --> RESET
Step 3: Blink
1) In blink.ino, change
int led = 13;
to
int led = 0; // This is the bottom right pin on the ATtiny85.
2) Burn Bootloader: Reconnect power to your littleBits Arduino module. Select Tools>Board>ATTiny85@ 8MHz and then burn the bootloader by selecting Tools>Burn Bootloader. If you get a couple errors that say "PAGEL" in them, that is ok. You only need to do this once per chip, so skip ahead to step 3 if you already did this step on a previous load.
3) Select the "ATtiny85 (int 8 MHz clock)" under Tools > Board, and select "Arduino as ISP (Leonardo)" under Tools > Programmer // I like 8 MHz; I think it depends upon what program you expect to put on your chip.
4) Reconnect power to your littleBits Arduino module, compile and run blink.ino. If you have avrdude out of sync errors, check your jumper wire connections and your COM port. If you have a couple PAGEL errors, that probably means success!
5) Keep the VCC and GND jumper wires from the littleBits Arduino, but remove the rest. The ATtiny will be powered by the Arduino for now. Connect an led with a resistor from pin 0 (the bottom right pin) on the ATtiny to GND. The led should blink. You have now demonstrated you can program your ATtiny chip with the littleBits Arduino. What will you program it to do next?