ATtiny85

I was interested in the ATtiny85 for a project. How do I program it, though, over ISP? Can I use the arduino ide? Or do I need to do it in C++?

Can someone also point me to some tutorials on using it/programming it over arduino ISP?

I found this page a while back. Have not tried it myself.

http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585

I also may need to use I2C comm. with the tiny as a master. Would it just be easier to get an atmega328 and burn the arduino bootloader onto it? It's only $2 more expensive at sparkfun.

baum: I was interested in the ATtiny85 for a project. How do I program it, though, over ISP?

Yes.

Can I use the arduino ide?

Yes.

Or do I need to do it in C++?

That's what you type into the Arduino IDE so the answer is yes.

Can someone also point me to some tutorials on using it/programming it over arduino ISP?

Follow the links here... http://code.google.com/p/arduino-tiny/

This may help... http://arduino.cc/en/Tutorial/ArduinoISP ...be sure to disable autoreset.

baum: I also may need to use I2C comm. with the tiny as a master.

This should help... http://code.google.com/p/arduino-tiny/wiki/TWIMasterLibrary

Would it just be easier to get an atmega328 and burn the arduino bootloader onto it? It's only $2 more expensive at sparkfun.

You haven't said why you want to use an ATtiny85 so there's no way anyone but you can answer that question.

I have a project in which my normal arduino duemilanove is being used up by something else. I need to output a simple sine wave on an I2C and do the something else at the same time. So I though of getting an ATtiny to drive the DAC.

Thanks for all the links. :)

And to clarify:

  1. Upload ArduinoISP to board.
  2. Put 120 resistor 5V--Reset
  3. Hookup up tiny85 as shown in the MIT site.
  4. Download I2C and tiny 85 library/cores
  5. Upload final program and unplug arduino.

Also....

How do I install the tiny85 framework that CodingBadly recommended? I downloaded it, but don't know where to put it!

Were I in your shoes I would treat the ATtiny as a learning experience. If I had the time and motivation, I would use the ATtiny. If I didn't have the time or I was distracted, I would stick with what I know.

The ATtiny85 will very likely do what you need and being able to use an ATtiny processor is indeed a handy tool to have. They can't be beat for solving certain problems.

The 328 processor is lower risk in the sense that many more people on this forum use it so, if you run into trouble, you are more likely to find someone who has direct knowledge.

baum: And to clarify...

Yes. A very good overview.

  1. Put 120 resistor 5V--Reset

Some boards (like an Uno) will also require a capacitor.

  1. Hookup up tiny85 as shown in the MIT site.

You can get away with some things connected to the programming pins (like LED + resistor) but not other things (like a piezo-buzzer). Be aware of what you have connected when programming.

baum: How do I install the tiny85 framework that CodingBadly recommended? I downloaded it, but don't know where to put it!

You will have to modify "boards.txt" to reflect the programmer you are using.

If I remember correctly, the ZIP file includes the "tiny" sub-directory so you should be able to unzip to "{Sketch folder}/hardware/".

The final directory tree should be something like this (some files may not be present)...

{Sketch folder}/hardware/tiny/

boards.txt programmers.txt

{Sketch folder}/hardware/tiny/bootloaders/empty/

empty2313at1.hex empty2313at8.hex empty25at1.hex empty25at8.hex empty45at1.hex empty45at8.hex empty84at1.hex empty84at16.hex empty84at8.hex empty85at1.hex empty85at16.hex empty85at8.hex

{Sketch folder}/hardware/tiny/cores/tiny/

{core files go here}

So I should -NOT- put it inside the Arduino application, but rather put the whole thing in the sketch folder?

And to ask another question:

Should I use the internal or an external clock?

If I should use the internal (it needs to be fairly accurate): The datasheet says the clock is shipped at 8MHz@3V, so how can I change this to 5V?

baum: So I should -NOT- put it inside the Arduino application, but rather put the whole thing in the sketch folder?

Either place works. The recommended location is the one I gave you.

baum: If I should use the internal (it needs to be fairly accurate)

It's impossible to answer your question until you put a definition to "fairly accurate". 100 ppm? ±1%? Good enough for 115200 baud?

The datasheet says the clock is shipped at 8MHz@3V

No, it doesn't. Most (all?) AVR processors ship with the clock set to 1 MHz ( 8 MHz / 8 ). At 1 MHz, you can use any voltage supported by the processor (2.7 V to 5.5 V or 1.8 V to 5.5 V for the "V" version).

so how can I change this to 5V?

So long as you operate the processor within a certain set of boundaries, you can run the processor at any reasonable voltage. Once you change the clock to 8 MHz, the processor will run without any problems at 3 V or 5 V or anything in between.

I may be using the ATtiny for tone generation, so what would be the best bet @ 5V? An external 8Mhz crystal w/ caps?

And how do I set the various fuse bits to change the clock?

I was just reading up on some crystals... Would the SQW output of something like this http://www.sparkfun.com/products/10160 be better? It has a temp. comp. crystal. Or do I not need that much accuracy? Is the internal oscillator good enough for tone gen?

See this. That should help you.

JanD

Thanks! That was helpful. So At the cost of 2 digital pins, (4 left) I can have more accurate timing. Again, though, how do I tell the MCU to use the crystal? Is it default?