0
\$\begingroup\$

I'm quite new at MCU programming (mechanical engineering background), but managed programming an Attiny85 to source an LED and switching modes (blinking/solid) by using a switch. I would now like to run this from 2x CR2032 (max ~6.2v) that exceed the max voltage (5.5v)rating for the Attiny. Power consumption is very important here so I would like to reduce unnecessary losses to an absolute minimum.

After reading this thread (Sink or source from AVR) I tried to switch my program to current sink. That is now working on 5v by setting the pin as an open-drain by using:

PORTB &= ~(1 << PINB1);

DDRB |= (1 << DDB1);        // LED ON (DDRB set as OUTPUT) --> sink 
DDRB &= ~(1 << DDB1);       // LED OFF (DDRB set as INPUT) --> float

I was thinking of using a diode to drop the voltage under the specified 5.5v for the Attiny Vcc (as the current here is now almost 0 there should be no significant power loss). However the datasheet of the Attiny is mentioning:

enter image description here

In the previous hyperlinked thread it was stated that a 5v MCU could even drive 9v LEDs, but am I correct that this is not allowed for the Attiny85? How dangerous would this be? Also when floating the Vcc is not identical to the voltage on the pin. Is this a problem?

\$\endgroup\$
1
\$\begingroup\$

The datasheet is correct, always. However the simple issue is a little bit complicated due to the clamping diodes

Each pin has a clamping diode to vcc. In your case, even if you were to turn off the pin, a circuit will be form from vcc, the led plus its resistor, and the clamping diode to the mcu vcc. The net result is that you cannot shut off the led.

The pin itself obviously will be clamped to a little bit over the mcus bcc, as shown in the datasheet.

\$\endgroup\$
  • \$\begingroup\$ Thank you Danny. It is much more complicated than I thought it would be. Getting the LED to work is clearly only the start of it. What would be the best way to proceed? Use an external transistor? I've searched quite a lot to find a easy programmable small MCU with native 6v support but was unable to find one. Which is frustrating as this is how it is connected in a small bike light I found. electronics.stackexchange.com/questions/289146/… \$\endgroup\$ – Niek Amsterdam Mar 27 '17 at 11:40
  • \$\begingroup\$ Yes a transistor would be an easier solution if the led has to be driven active low. \$\endgroup\$ – dannyf Mar 27 '17 at 11:53
0
\$\begingroup\$

You could get a low drop out regulator to regulate the micro down to 5V. However, why not just run the micro at 3V (one battery), and run your LED load off of a higher voltage through a transistor circuit? This way you don't burn excess power through a regulator or diode, and you can adjust the load voltage to whatever is required?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.