Swarm robots/ATtiny2313

From XinCheJian
Jump to navigation Jump to search

Introduction

This explains how to use an Arduino as a programmer to program the microcontroller selected for our project, the ATtiny2313.

Preparing Arduino to be used as a programmer

Upload this to the Arduino (Uno, Dueminalove) from Arduino IDE:

https://raw.github.com/adafruit/ArduinoISP/master/ArduinoISP2.pde

IMPORTANT:

(see attachment .zip for the folder)

  • Save file into a folder called ArduinoISP2
  • Open the project ArduinoISP2.pde in Arduino IDE
  • Select the Tools > Board = Arduino Uno (or Dueminalove)
  • Select the Tools > Serial port of your Arduino Uno (or Dueminalove)
  • Upload

Connecting the Arduino to the ATTINY2313

Insert the 10uF capacitor between Arduino RESET and GND pin (longer pin in RESET).

Connect the Arduino to the ATtiny2313:

Arduino   Attiny2313

13        19 PB7/SCK
12        18 PB6/MISO
11        17 PB5/MOSI
10        1 PA2/Reset
5v        20 VCC
GND       10 GND

Uploading a program to the ATtiny2313

  • In Arduino IDE, change the configuration to ATtiny2313.
    • Tools > Board: ATtiny2313, 8Mhz
    • Tools > Port: your serial port
    • Tools > Programmer: Arduino as ISP
  • Open the blink sample.
  • Change PIN from 13 to 0
  • Upload

ATtiny2313 full pinout

Use this as a reference:

RST - - VCC

P0 -        - P16
P1 -        - P15
P2 -        - P14
P3 -        - P13*
P4 -        - P12*
P5 -        - P11*
P6 -        - P10
  • P7 - - P9

GND - - P8