ATtiny85 reset pin as an analog input? (and how to burn fuse bits?)

I'm using an Arduino Uno R3 as a programmer for my ATtiny85.

I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts. However, can I use that pin as an analog input? I'm hoping to leave it unconnected, then use it as a seed for the random() function.

Also, how would I go about burning the fuse bit to enable the reset pin as IO with ArduinoISP?

nimaid: However, can I use that pin as an analog input? I'm hoping to leave it unconnected, then use it as a seed for the random() function.

That is a bad choice. It does not work very well.

These are much better choices... http://forum.arduino.cc/index.php/topic,108380.0.html http://forum.arduino.cc/index.php?topic=66206.msg537783#msg537783

Thanks for those links! But will those methods you linked to also work on the ATtiny85? The first talks about using the watchdog timers jitter, and while I don’t know what that means, it sounds like a possibly hardware specific thing.

Aside from that, I would still like to know if the ATtiny85 reset pin would work as an analog input, and what analog input pin number it would be.

nimaid: I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts. However, can I use that pin as an analog input? I'm hoping to leave it unconnected

Yes, but you can't leave it unconnected.

nimaid: , then use it as a seed for the random() function.

It won't be random.

Using unconnected analog pins for random numbers isn't as good as you probably think it is. You can probably get just as good results by sampling the internal voltage reference (I imagine the lowest bit of almost any ADC reading will be quite random).

If what you want is to avoid the same sequence after every reset then you can store your random seed in EEPROM for next time around, that way you always get a different sequence.

nimaid: But will those methods you linked to also work on the ATtiny85?

Yes.

ATtiny85 reset pin...

You do understand that, once you disable RESET, the only way to reprogram the processor is with a "high voltage programmer".

[quote author=Coding Badly link=topic=178867.msg1325975#msg1325975 date=1374566566] You do understand that, once you disable RESET, the only way to reprogram the processor is with a "high voltage programmer". [/quote]

Yes I do, I stated so in my original post.

Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.

nimaid: Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.

Yes. No need to burn any fuse bit, just use it.

Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.

fungus:

nimaid: Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.

Yes. No need to burn any fuse bit, just use it.

Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.

The datasheet says (p 62): "Pullup is activated and output driver and digital input are deactivated when the pin is used as the RESET pin." This may imply that the ANALOG input ADC0 is not deactivated, but I am not sure. The analog input may be of limited use when configured as RESET, because RESET requires a voltage of 0.9 Vcc to be guaranteed HIGH, datasheet p 166

Although the datasheet says 0.9 Vcc, in practice it is possible to go further down.

I just tried a potentiometer on the reset pin and found that the reset occurred at 2.14 V (Vcc = 4.98V)

There is of course no guarantee that this will always work, but shows that the reset pin can be used for something sensible

Erni: Although the datasheet says 0.9 Vcc

Actually that is the maximum the datasheet says it could be:

Vrst, RESET Pin Threshold Voltage: Min = 0.2 x VCC, Max = 0.9 x VCC

Unfortunately it is no more helpful than that. Plus that was tested with VCC = 3V, and not at 5V, so its anyones guess what the threshold will be.

Plus there is a 30k to 60k internal pullup resistor which could hamper efforts if forming potential dividers unless an amplifier were to be used.

fungus:

nimaid: Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.

Yes. No need to burn any fuse bit, just use it.

Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.

http://projectsfromtech.blogspot.com/2013/04/using-reset-pin-as-io-on-attiny8545.html?m=1 This makes the reset pin no longer function as a reset pin, but rather a weaker I/O. My question is whether that takes analog input as well.

nimaid: http://projectsfromtech.blogspot.com/2013/04/using-reset-pin-as-io-on-attiny8545.html?m=1 This makes the reset pin no longer function as a reset pin, but rather a weaker I/O. My question is whether that takes analog input as well.

Yes.

Problem is, once you do that you need a special hardware programmer to be able to upload sketches.

fungus:

nimaid: http://projectsfromtech.blogspot.com/2013/04/using-reset-pin-as-io-on-attiny8545.html?m=1 This makes the reset pin no longer function as a reset pin, but rather a weaker I/O. My question is whether that takes analog input as well.

Yes.

Problem is, once you do that you need a special hardware programmer to be able to upload sketches.

Yeah, I know. I'm going to make a HVP shield for my arduino using a transistor and 12v DC wall adapter.

What analog pin number would the reset pin have?

nimaid:
What analog pin number would the reset pin have?

Open the datasheet.

Navigate to 1. Pin Configurations.

RESET is physical pin 1. That pin is also marked with ADC0. So, the analog pin number is zero.

Thanks. I saw that, but wanted to make sure I was understanding it correctly. Thanks for all the help!

nimaid: I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts.

that isnt quite true. with any of the common arduino tiny bootloaders installed its possible to disable reset function, use as digital or analog io, and still load code. no 12v required.