I'm in need of the reset pin on attiny85 and have been trying to get it to work as a weak input for my pushbutton. This was my guide for what I just said. Someone posted how he/she would do it with a trinket by creating a voltage divider and using upper levels of analog read on reset pin. I did the same thing but I am not powering it with 5v so I used 1000 and 100 ohm resistors to bring down voltage from 3.3 to 3 when button is pressed. I then calculated that I should be getting analog reading of around 900 according to this formula. Im using this code:
int led = 1;
void setup() {
pinMode( led, OUTPUT );
}
void loop() {
if (analogRead(5) > 960 ) {
digitalWrite( led , 0 );
} else {
digitalWrite( led , 1 );
}
}
The led lights up (and flickers..) but doesn't turn off when button is pressed. The same thing happens on all other analog pins. I simply cannot get it to work no matter what analog value i set in the code. I dont have anything that can display analog value so im kinda stuck here. I tripple checked the connections with multimeter. Not much was given here but hope someone can help a bit. Really need that last pin and I dont want to reprogram fuses.
much obliged! Got it working. Just one more question. For powering this later on I will lower the voltage to 3.3 v using lm1086 3.3 v regulator . What will happen if voltage drops below minimum required for regulator to work. Will that damage the tiny if my reset pin is occupied as an input? Also just in case I set up BOD at 1.8 v but im not sure if that will do anything.
If voltage drops below what the regulator needs to achieve it's nominal output voltage, it outputs a lower voltage. How much the minimum dropout is depends greatly on the regulator in question. I use LDL1117's with typ dropout of only like 0.3V. Most of the other 1117-alikes are more like 1.1V minimum dropout, and the venerable 7805's are like 2v. Only time this is a problem (other than possibly making the microcontroller stop functioning until a proper supply voltage is restored) is if there is something powered by a different power supply, which isn't drooping, such that a voltage being applied to a pin exceeds Vdd by more than like half a volt (see absolute maximum ratings in datasheet).
BOD has nothing to do with safe voltages applied on pins - it just serves to detect whjen the voltage is too low to be guaranteed of proper functioning (at excessive clock speeds, or insufficient voltage, the chip will execute instructions incorrectly (ie, adding two numbers and getting the wrong answer), and hold the chip in reset unless or until the voltage is increased above the threshold.