Tuesday, 10 January 2012

History - Getting Started With ATTiny85

Background

An Arduino Pro Mini costs ~£15. A Bluetooth module costs ~£27. This sounds fairly cheap until you consider deploying 5-10 wireless sensor nodes. If these were all Bluetooth Arduino modules this would cost at least £42/module!

There has to be a cheaper way! Thankfully there is!

An ATTiny85 costs less than £2/unit (so long as you buy at least 10). This is much less powerful than an Arduino but is much more suitable to simple low power wireless sensors.

In place of a Bluetooth connection I plan to use a simple RF Link using one way RX and TX modules. The transmitter costs less than £2.

Plan

To produce a wireless sensor will actually require a few more components:
  • Some Stripboard
  • 8 pin DIL socket
  • battery holder (either watch battery or multiple AA)
  • battery(s)
I am hoping that including all these items I can produce a wireless sensor for <£15/node including battery(s).

Getting Started

An ATTiny can be programmed from the Arduino UI. To make this work requires a few steps. I followed these steps.

1) Program the Arduino to act as a programmer for the ATTiny. The correct sketch can be loaded by selecting File -> Example -> Arduino ISP.

NOTE: The example included in Arduino 1.0 didn't work for me. I used the copy from Arduino 0.22 instead and this worked great.

2) Download ATTiny support. This needs to be unzipped into your project folder in the following structure.

\hardware\attiny

3) Select the correct Board and Programmer.

Tools -> Board -> ATTiny 85 (internal 1Mhz clock)
Tools -> Programmer -> Arduino as ISP

4) Wire up the ATTiny as per this diagram.


EDIT: The linked page was down the other day so here are the crucial diagrams. Firstly, the pin layout.
And here is the wiring.

Pin connections:
  • ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer)
  • ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer)
  • ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer)
  • ATtiny Reset Pin to Arduino Pin 10 (or RESET of another programmer) 
This is what the final result looks like,
    You're ready! To test whether the programming is working you should load the Blink example, replace pin 13 with pin 0 and download it to the ATTiny.



    No comments:

    Post a Comment