Pages: 1 [2]   Go Down
Author Topic: Wanting to programme a Tiny 85 20pu using arduino  (Read 1102 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you have a parallel port you could make a programmer with some basic parts.
http://nerdralph.blogspot.ca/2013/08/tiny-programmer-for-attiny85.html
Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Dannable,

Frankly, no I don't need it to run at 20Mhz. I just can not get my hands on any through hole tiny85's at anything other than 10 or 20Mhz.
The Attiny85 has an internal 8Mhz RC oscillator, and the factory-default fuse settings use a divisor of 8 for a 1Mhz clock.  Using the internal PLL you can run it at 16Mhz, or with an external crystal officially up to 20Mhz, but unoficially they overclock well (25-30Mhz is common).

They're a nice little chip, but rather limited with only 5 usable pins (6 if you disable the reset pin), and not compatible with many Arduino libraries (like serial and SPI), so you may find yourself having to adapt Arduino code or write it from scratch.

Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so you may find yourself having to adapt Arduino code

With the advent of Digispark and Trinket, a lots of code has been adapted to the Attiny85.  Trinket does not disable Reset but the Digispark does and therefore gains another pin.  Both products have active forums and code on github.  I think Digispark is the more stable product and their "viral bootloader" is way ahead of Adafruit's Trinket in stability.


ray
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so you may find yourself having to adapt Arduino code

With the advent of Digispark and Trinket, a lots of code has been adapted to the Attiny85.

But it's not plug-and-go like any of the ATMega328 boards available, and the documentation sucks.  For example it took me over an hour to get TinyDebugSerial working on a Digispark.  One of the few pages I found covering it is here:
http://www.ernstc.dk/arduino/tinycom.html
However that page says output is on PB3 while it's actually on PB2 when F_CPU is >8Mhz.

The micronucleus bootloader is a hack job (and Jenna Fox doesn't deny it).  After 15 days of going through the micronucleus code I barley understand how it all works, while understanding Optiboot only took 15 minutes.

I haven't been able to get nRF24l01 modules working with the digispark which is an example of the kind of problems you can expect to run into.  Part of the problem is specific to the ATTinyx5 (USI instead of SPI on the ATMega), and part is because 2 of the 6 available ports on the Digispark are crippled by the USB pullup resistor and zener diodes.

Eric pitches the Digispark as a beginner-level plug-and-play arduino compatible device.  Just download their patched version of The 1.04 IDE and go.  But the IDE isn't well patched.  Look in the libraries directory and you'll find Arduino_SPI instead of SPI85.  Although you'll find TinyWireM_Digispark, there's still a copy of Arduino_Wire to make things confusing.  Both Arduino_SPI and Arduino_Wire should have been deleted from the Digispark version of the IDE; something that's really simple to do but wasn't done.  I suspect it is so Eric wouldn't keep his kickstarter supporters waiting.

With some work someone could make a decent Tiny85-based Arduino.  Patch the IDE so all the compatible libraries are included and the incompatible ones removed.  Have it emmulate a USB serial port connected to a STK500 compatible bootloader, and include a fully-compatible version of the Serial class.  But that's a lot of work to save ~25c (cost difference between the Tiny85 and Mega8A), and with the upcoming availability of the LGT8F88A, I think we'll see that cost gap get smaller.

I'd say the trinket is well named.  They're more of a cute toy than a practical hardware platform, and they're more than double the price of a Pro Mini ATMega328 board.  I plan to give my DigiSpark to a friend who likes cute electronic toys and do my hacking on Pro mini boards.
Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But it's not plug-and-go like any of the ATMega328 boards available, and the documentation sucks.

Dude, your expectations may be a bit demanding, IMO.  I said
Quote
With the advent of Digispark and Trinket, a lots of code has been adapted to the Attiny85.
But I surely did not mean to suggest that the t85 was an Arduino-class uC.  It is not.  The low-end of the current Arduino line is the UNO with 2K SRAM and 32k flash.  The Atmega328P-PU is officially supported and I guess an argument could be made that grandfathered support goes all the way back to Atmega8.

In any event, there is not an official t85 Arduino product, so to have 100% compatibility is not something that is likely to happen; with only 512 Bytes of SRAM and 8K of flash, it really is a nice "utility" that can sometimes be programmed with the Arduino GUI and some standard libraries.  I use it when it makes sense, but I use ISP for 99% of this need.  I think the Trinket and Digispark are fun toys - if a few folks get bitten with the Arduino bug and move up the food-chain, then all the better.


Ray
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the Trinket and Digispark are fun toys ...
That we can agree on.
Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

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

OK, I have the same setup as the original poster.  I am trying to program my ATiny85 chip to flash a couple of LEDs.  I followed the 11 steps and have the LED blinking on 4 and 5 while hooked up to the Arduino Duo, but when I remove the 5V power and GND leads from the Duo and apply power to them directly I don't get the blinking.  I started with a 9V (whoops...the input voltage on the ATiny85 is 1.8 to 5.5) and this made the light blink really quickly a couple times and then stay on.  I quickly removed the power and tried hooking up to a lead from my USB giving me 4.5v.  This made the LED stay on constantly but very dim.  I *think* i got the sketch uploaded to the ATiny85, but didn't use a capacitor as I didn't have one...maybe this is my problem?  I didn't get an error in the interface when I uploaded, however.  Can anyone help?
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
whoops...

I would say, "BIG whoops!"  Sounds like the output driver in the t85 uC is fried; that is, you exceed the current source/sink for the CMOS driver by applying a higher voltage which caused the LED to draw more current.  This would account for the very bright LED for a very short time.

Fortunately, a t85 is under $1 in quantity of 25 which is the way I buy 'em.  (Newark)


Ray
Logged

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

I have more of them.  If I plug the arduino board back into power and leave everything else hooked up the same except move my VCC to the 5v pin on the Duo and my GND to the GND on the DUO everything works back the way it was originally...everything flowing through the AtTiny85 and the LED blinks..does this still indicate that the attiny85 is fried?
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
LED blinks..does this still indicate that the attiny85 is fried?

If it is now working it is not kaput  smiley-wink

Is it OK?  My guess is that it is marginally damage from current stress.  I usually put a dot of red fingernail polish on the chip to remind me to use that in the breadboard only; that is not put it into a final project.  Eventually, it is inevitable that some of the magic smoke is released!  It can go into the trash at that time.

Stress to the uC from ESD (static), heat, over voltage, over current, putting an output pin to the power rail, etc. are hard to characterize if the device comes back to the living side.  It's a coin toss.


Ray
Logged

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

OK, but still the light doesn't blink unless I have the ATiny85 plugged into the arduino board.  How do I know if the program blink program actually got written to the 85 chip? 
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and have the LED blinking on 4 and 5 while hooked up to the Arduino Duo, but when I remove the 5V power and GND leads from the Duo and apply power to them directly I don't get the blinking. 

I am confused.  You used ArduinoISP to program the t85 (First, you set the fuses for 8 or 16MHz internal RC). After program loading, You should then remove the jumpers, install the 2 LEDs and 2 resistors for current limitation, and supply +5V and power Gnd.  The +5/Gnd can come from the Arduino or you can use a 4.5 Volt pack made of 3 AA/AAA batteries.

Example:
http://www.instructables.com/id/ATTiny85-Traffic-Light/?ALLSTEPS

Ray
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Fortunately, a t85 is under $1 in quantity of 25 which is the way I buy 'em.  (Newark)

Just looked at newark, and their pricing is a tiny bit higher than digi-key and mouser.  I couldn't find anything about shipping rates on their site though.  Do they charge you more than $8 (digi-key's flat rate)?
Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1434
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do they charge you more than $8 (digi-key's flat rate)?

Last order totaling > $100 was free shipping.  They do this from time-time.
Previous order was $6.93.

Logged

Pages: 1 [2]   Go Up
Jump to: