Pages: [1] 2   Go Down
Author Topic: Help with attiny 85  (Read 3462 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm going through this tutorial here:

http://hlt.media.mit.edu/?p=1695

Using an UNO running IDE 1.0  All looks well but the attiny board isn't showing up.

I went through this process:



But couldn't get the blink sketch to even compile. After it didn't work I deleted the "hardware" file and tried to start over but still no joy.

Any input?

Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

If the board isn't showing up in your list then you're not going to get to program your ATtiny until that's sorted.

The IDE needs to be restarted for it to discover the files as it starts up - is there a chance you had an instance of the IDE still running when you installed the support files?

Cheers ! Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Dallas, Texas
Offline Offline
God Member
*****
Karma: 31
Posts: 887
Old, decrepit curmugeon
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Two things I can think of,  first the version of the tiny 'core' your using may not support 1.0, so give this one a try; http://code.google.com/p/arduino-tiny/

And second, make sure you do not have the IDE running when you unzip the core into the hardware directory.  Only after it has been unzipped should you start the IDE
Logged

New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys!  I'll bet I had the IDE running when I unzipped the files. I'll give it a go.  One question though... even though I deleted the original "hardware" folder from the first install the "ArduinoISP" sketch is still showing up in the examples folder. Will a re-install sort this out?
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think you need to do anything as drastic as a re-install, unless you think you deleted too much.

The ArduinoISP sketch isn't in the ATTiny hardware directory (it's a standard example in the IDE) so don't be concerned it's still there after removing the ATTiny stuff.

Cheers ! Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried re-loading it a couple of times without success but the file posted by wanderson (Thanks) seems to work and gives A BUNCH of confusing options!  I went through the tutorial in the first link using "Arduino as ISP" chosen from the tools-programmer menu. It is communicating with the board but I get an "out of synch" error.

Oh well, I consider it some kind of progress. There must be something I'm overlooking.  I have no idea what chip to pick from the menu. Mine are just ATTINY85 20PU.

I am excited about pulling this off and making gadgets that work sans Arduino!

Thanks again for the help!
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There must be something I'm overlooking.  I have no idea what chip to pick from the menu. Mine are just ATTINY85 20PU.
Hi,

Select ATtiny85 @ 8HMz (internal oscillator, BOD disabled) as the board, select "Arduino as ISP" as the Programmer, then remember to choose the "burn bootloader" and do that just the once to set the internal fuses on the ATtiny85.  

After that, your -20PU's will use their internal clock to run at 8MHz and all should be well...

Cheers ! Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again!  I did what you suggested and now I get a "not in sync" error. Even though it's not working I'm encouraged. I'll probably try another chip out and see how it goes. The bootloader part seemed to work because the ATiny shows up on the bottom portion of the IDE on the proper port.  I hope I have it wired correctly. I'm going by the tutorials which all seem show the same wiring.

One thing I did notice is that the sketch that I'm trying to write to the tiny (Blink, pin 3) seems to write to the Arduino.
« Last Edit: June 25, 2012, 08:18:54 pm by hoff70 » Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you hooked a capacitor up to the reset pin on the Uno?
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a 10uF cap between reset and ground with the polarity correct.

When I upload it compiles-loads and I get some flashing of the RX LED followed by a longer than usual pause of no blinking then the error.

I'm just loading the blink sketch without first loading the Arduino as ISP sketch first as I did before with the first tutorial.

Feels like I'm pretty close...
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like you're close.

You need to have loaded the ArduinoISP sketch onto the Uno first (ie without the cap installed) then, after you connect your ATTiny and the cap, when you upload the blinky sketch it will be passed through to the ATTiny...but you do need to have ArduinoISP loaded first.

If you're using the unchanged IDE 1.0 ArduinoISP from the examples folder it had a line that caused issues on my Uno (and I think all?)
Code:
void setup() {
  Serial.begin(19200);
...
Changing that to
Code:
Serial.begin(9600);
I think was necessary if I remember correctly.  Certainly that's a difference between the version I run routinely, and the standard example sketch.  I may have made more changes but I don't appear to have commented the changes at the time.

Hope this helps,
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Denmark
Offline Offline
Edison Member
*
Karma: 37
Posts: 1096
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There are some issues in the 1.00 version of the ArduinoISP sketch .

Codung Badly has made an updated sketch here (Reply #39)

http://arduino.cc/forum/index.php/topic,108797.msg824488.html#msg824488
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the AWESOME help!

 smiley

I did it!  Just few details that had me tripped up. This is really pretty amazing stuff. Sure, I'm just blinking a light but programming a little IC that runs without any other assistance just amazes the sh!t out of me  smiley-cool

I picked up a proto shield and some odds and ends from RS and I'm thinking about making a dedicated 85 programmer. Any input on this? Input on some 85 projects?

I'm shooting for a 328 programmer for some permanent projects.

Thanks again!

Here's a sketch that works with the 85 and an Sr04 sensor:

Code:
//"Arduino Garage Tennis Ball."  A distance sensor with LED Stoplights for people with multiple vehicles going into a limited space.

const int triggerPin = 0;
const int echoPin = 1;
int redPin=2;
int yellowPin=3;
int greenPin=4;
long duration;
long distance;

void setup(){
  pinMode (13, OUTPUT);
  pinMode (12, OUTPUT);
  pinMode (11, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  int stopDistance=6;//object distance in inches from sensor that you want to trigger the Red LED.
  int warnDistance=60;//object distance in inches from sensor that you want to trigger the Yellow LED.
  pinMode(triggerPin, OUTPUT);
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(2);
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(triggerPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
  distance = duration / 72 / 2;//determines distance in inches of object from sensor by microseconds to inches formula.
  if (distance >= warnDistance){
    digitalWrite (redPin, LOW);
    digitalWrite (yellowPin, LOW);
    digitalWrite (greenPin, HIGH);
  }
  else if((distance>stopDistance) && (distance<warnDistance)){
    digitalWrite (redPin, LOW);
    digitalWrite (yellowPin, HIGH);
    digitalWrite (greenPin, LOW);
  }
  else{
    digitalWrite (redPin, HIGH);
    digitalWrite (yellowPin, LOW);
    digitalWrite (greenPin, LOW);
  }
  Serial.println (distance);
}

It uses all of the 85's pins and it's a little wonky but it's close.  All it does is light 3 LEDs based on distance from the sensor. I think the code is screwy but the hardware seems to be doing it's part!

Look ma, no Arduino:

« Last Edit: June 30, 2012, 05:32:43 pm by hoff70 » Logged

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

I did it!

Excellent!  Congratulations!

I picked up a proto shield and some odds and ends from RS and I'm thinking about making a dedicated 85 programmer. Any input on this?

Include 220 ohm (or higher; 1K is typically used) series resistors on MISO, MOSI, and SCK.  A problem like this one could create a short-circuit through the two processors and damage them.  The resistors keep the current flow in a safe range, they are dirt cheap (compared to everything else involved), and they cause no problems when programming.

Quote
Input on some 85 projects?

ATtiny85V processors and batteries go very well together.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again!  I'll be sure to include the resistors. Have to check the pinout...

Just to clarify, I'll be placing the resistors between the Arduino pins and the 85? In place of the jumper wires?

I have a big resistor assortment that should come in handy!

The iron is warming now  smiley-sweat
Logged

Pages: [1] 2   Go Up
Jump to: