Pages: [1] 2   Go Down
Author Topic: What can the ATTiny85 do?  (Read 4689 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently ordered some ATMegas to play around with but while I was looking around I found some ATTiny85 chips in the shop. For a dollar apiece I thought what the heck, they're cool and small, so a bought a few of them. After doing some research on them after the fact I've found a few things about them that make them cool buys, one being they have an Arduino compatible bootloader (not included) and can be programmed by the Arduino via ArduinoISP. This makes the great for these small projects where a full Mega isn't required.

That being said it seems like there are a few things that I would like to be able to do with them that either can't or just have very little documentation about. My main issue is controlling shift registers and LED drivers. The ATTiny support does have shiftOut() capabilities but because of the number and types of pins (and possibly memory and storage) doesn't seem to support the ShiftPWM(http://www.elcojacobs.com/shiftpwm/) library I enjoy using for PWM over shift registers.

This led me to look at LED drivers such as the TL5940 to drive multiple LEDs, with PWM being a huge plus, but again there seem to be issues with the chip's support for SPI. There seemed to be solutions but not with nearly enough explaination to wrap my head around it.

So really what I want to know is what do people know about solutions to my problems and maybe just some other ATTiny project you've done or seen. It would be nice to use this tiny chip for some cool stuff.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 178
Posts: 8064
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Doesn't the ATtiny85 have SPI hardware and a free timer?  Is that not enough to run ShiftPWM?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ATtinys can do a lot of what ATmegas can. Pins are limited of course. They have fewer peripheral features than the ATmegas, and those features are not all as sophisticated. Still they work well within their limits and are a lot of fun to work with.

I am not aware that ATtinys support bootloaders. They can be programmed via the Arduino IDE using an ICSP programmer or using an Arduino running the ArduinoISP sketch.

There are several "cores" available to enable the IDE to program the ATtinys. I've mostly used this one and can recommend it. I've used this one to a lesser extent, but it was also easy to install and seemed to work fine (I only ran a couple example sketches IIRC).

I'd be interested to know where ATtiny85s can be had for a dollar. Last ones I bought (from Mouser) were around $1.40 in quantities of 10 IIRC.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah okay, I guess I was mistaken that those IDE hacks were bootloaders. I hadn't seen that first one you posted so I'll take a look into that.

From what I read the ATTiny85 doesn't have SPI but can emulate it somehow. Until I find out a definitive answer to thatI have to assume that it can't run ShiftPWM.

Also I checked Mouser just to make sure I had my numbers right and the ATTiny85-20PU DIP is actually 1$(CAD) in quantities of 1. http://ca.mouser.com/ProductDetail/Atmel/ATtiny85-20PU/?qs=8jWQYweyg6OOxtot0UtUEqrf9r0RO67EQK4XVLDlbMc%3d

Jack, do you have any links to projects you did with the ATTinys?

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

one being they have an Arduino compatible bootloader (not included)

No bootloader.

Quote
and can be programmed by the Arduino via ArduinoISP

Yup.  Uploaded a frequency test just seconds ago.

Quote
This led me to look at LED drivers such as the TL5940 to drive multiple LEDs, with PWM being a huge plus, but again there seem to be issues with the chip's support for SPI. There seemed to be solutions but not with nearly enough explaination to wrap my head around it.

This may help...
http://arduino.cc/forum/index.php/topic,90860.msg683277.html#msg683277
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Until I find out a definitive answer to thatI have to assume that it can't run ShiftPWM.

Looks like the Attiny85 has two counters so you should be able to do PWM quite easily. That's nothing to do with SPI.

I would be surprised if you can't do SPI, because you program it using SPI.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand PWM is possible with the basic chip as is, the datasheet indicates two PWM pins if I recall. The issue with ShiftPWM is that it requires specifics pins to work correctly. Because the ATTiny85 lacks a lot of these pins I'm not sure it can be ported to the smaller chip. Maybe it's just a matter of digging around in the code or the datasheet to see what needs to be done to get it to work.

@CD Are you saying that the I2C protocol can be used in place of SPI for controlling these types of chips? Or that they are basically the same?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the datasheet indicates two PWM pins if I recall

There are four.  One of the four is inverted.

Quote
@CD Are you saying that the I2C protocol can be used in place of SPI for controlling these types of chips?

ATtiny processors have "hardware assisted" I2C -or- SPI communications.  The assistance is provided by a single subsystem; the Universal Serial Interface (USI).

Maybe this will bring some clarity...
http://arduino.cc/forum/index.php/topic,104485.msg784508.html#msg784508

Quote
Or that they are basically the same?

No, they are not basically the same.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright thanks for pointing this stuff out. When it comes to very low level hardware stuff I have no idea what's going on.

It seems that if I want to play with these chips using Arduino IDE to code them I best stick with the supported ATMega family. I probably am looking too far ahead for projects on the ATTiny considering what I know about working with them. Small steps for the next while.

Oh I do have another question about the ATTiny. Because of it's small size and application to small projects, does it run well on ~3.3V? Being able to reduce the size of the battery would be nice to shrink a project.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright thanks for pointing this stuff out. When it comes to very low level hardware stuff I have no idea what's going on.

It seems that if I want to play with these chips using Arduino IDE to code them I best stick with the supported ATMega family. I probably am looking too far ahead for projects on the ATTiny considering what I know about working with them. Small steps for the next while.

Oh I do have another question about the ATTiny. Because of it's small size and application to small projects, does it run well on ~3.3V? Being able to reduce the size of the battery would be nice to shrink a project.

Don't be scared off, it literally took me just minutes to download either the Arduino-Tiny or the HLT core, install it, and have something simple (blink sketch) programmed into an ATtiny85 with an ICSP programmer. I was impressed by how quick and easy it was!

There are two flavors of the ATtiny, for example the ATtiny85-20PU can run up to 20MHz but requires 2.7V to 5.5V. The ATtiny85V-10PU can only run up to 10MHz but only needs 1.8V to 5.5V. So the latter is probably the better choice to run on a 3V battery.

Sorry, I don't have any links to 'tiny projects, I've only played with them, really. Nothing too serious. Search around the forum and you might find some though. Also, as ever, GIYF smiley-lol
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Don't be scared off, it literally took me just minutes to download either the Arduino-Tiny or the HLT core, install it, and have something simple (blink sketch) programmed into an ATtiny85 with an ICSP programmer. I was impressed by how quick and easy it was!


Oh don't you worry, I think I just have to take a step back and start small. I realize it works differently than the Megas so I'll just have to start with the basic blinking and work up to bigger and better projects as I get an understanding for it. As I said I bought some ATMegas to build into things, so what the ATTinys can't do, they surely can.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What can the ATTiny85 do?

Just to inspire you:

http://www.ladyada.net/make/tvbgone/



This gadget turns off around 230 different TVs (eg. in shopping malls) and is based around the Attiny85. That requires PWM output for the IR codes, and enough memory to store all those codes, make decisions etc. Pretty impressive.
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Ugi was not declared in this scope
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking at trying an ATtiny85 project and it would be handy to be able to use the Arduino IDE.

I gather that the ATtiny cores don't necessarily support all the features of a full '328 version.  However, does anyone have an idea of what is and is not supported for Arduino on an ATtiny?  Direct port access (port B obviously), for example, or sleep modes, or turning off subsystems such as the ADC?  I'm not entirely sure whether those are controlled by the Arduino IDE or by some deeper level within the compiling process even for an Arduno but they would be particularly useful for small battery-powered ATtiny projects.

Any advice appreciated.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sleep modes and turning off subsystems/peripherals are supported, since these are just controlled via setting registers. See the datasheet. Also AVR-Libc has support for power management and sleep modes (#include <avr/sleep.h>), see the AVR-Libc user manual for more info.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

London
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Ugi was not declared in this scope
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Jack

I had seen from the datasheet that the sleep modes etc were just register settings but it's a case of how to set them! I'll look into LibC.  There aren't all the same sleep modes on the ATtiny as on the ATMega328 but maybe it can handle both types of chip.
Logged

Pages: [1] 2   Go Up
Jump to: