ATtiny, input protection, LED, sync

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings. I'm hoping to gain a better understanding of what is going on in a particular circuit design.

I have an ATtiny running off of a 3V CR1225. It's driving a charge pump to about 4.2V, the output of which is feeding a 1k resistor connected to the anode of a ~20cd 5mm white LED with datasheet citing Vf=3.2V @ 20mA. The cathode is directly connected to the microcontroller pin to test my theory that this shouldn't be detrimental to the MCU.

When the microcontroller's output pin is set logic high, the LED is unlit. At the same time, voltage at the output pin measures about 2.6V, voltage across the LED is about 1.6V (which I would expect: 4.2V-2.6V=1.6V), and voltage across the 1K is about 5mV (I=5uA). Battery voltage is measures about 2.6V as well. Alright, sure, I should measure with a DMM not an oscilloscope.

What I think is happening is that the LED is only just barely forward biased when "off", so very little current can flow. I guess this current is passing through the high side protection diode which is itself very slightly forward biased.

While we're at it, what's a reasonable way to model the AVR output in LTSpice? Forgive me if this is stupid but I have a high side PMOS, low side NMOS, and two Schottky diodes. The model behaves more or less similarly to the real circuit as far as I can see so far. In that model, the small "off" current is indeed going through the high side protection diode.

Insights welcome. Many thanks in advance.

Attachment(s): 

It should work - bot-thoughts.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I'd agree that current is flowing through the LED and the input protection diodes.

I'd guess the LED's voltage drop decreases by about 0.4V for every 10x decrease in current. Dropping by about 4000x would decrease the voltage drop by ~1.4V to 1.8V, pretty close to what you're seeing.

- S

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are using the Tiny as a Low Side Switch.

As a general rule that is fine, if the load is connected to the same supply as the Tiny.

You have the load connected to a higher voltage than the V+ for the Tiny, (4.2 V, not 3 V).

That is generally a poor idea.

What is, I think, protecting the I/O pin right now is not the internal protection diode, but the fact that the white LED has a Vf of 3.2 V, and it isn't being forward biased. (If the I/O pin is at 2.6 V, then it isn't clear to me that the internal protection diode is forward biased. If it was you would see Vcc + 0.6 V (or so), on the I/O pin, which isn't what you are reporting.

It might be "better" to have the Tiny drive an NFet, 2N2000 for example, which drives the load, if you wish to run the load at the voltage higher than the Tiny.

An easier option, of course, is to also run the Tiny off of the 4.2 V supply. Then all is good.

Most AVR's, by the way, have symmetric I/O pin source and sink capabilities. That means you can also drive the LED (and resistor) from the I/O pin to ground, if you wanted to.

If you powered the Tiny from the 4.2 V rail, and tied a resistor and LED to ground, then your 1K resistor is too high.

(V+)-(Vf) = 4.2 - 3.2 = 1 v
For the Max of 20 mA forward current, then R = V/I = 1/20mA = 50 ohms.

You can run it at a lower current, but 1K gives a very low current.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Great input, thanks all!

I entered into this experiment aware that tying the load to > Vcc+0.5 could be a bad idea, so I spent some time thinking about what might happen. Truth be told I wasn't quite sure, so I figured I'd experiment, observe results, and try to explain it afterward.

It appears the rule can be broken in this case precisely because the LED current is so low when its forward bias voltage is low. Provided that the current will be relatively constant within tolerances I believe the design is acceptable for my purposes. The bias voltage can vary a fair bit without reaching up into the elbow of the LED's Vf/If curve.

A side note, while the LED is rated 3.2V @ 20mA, a CR1225 cannot supply more than a fraction of that current. The 1K resistor is selected to limit LED "on" current to an amount that's reasonable for the tiny battery while achieving reasonable brightness.

I'm using a high intensity, 15° LED (on the order of 20,000mcd) which is quite bright even at 1mA. I probably can't get more than 2-3mA out of this tiny battery. That's ok because If and perceived brightness have a non-linear relationship, one characterized by diminishing returns for increased If. Luckily for me, the LED is bright enough at 1-2mA. Whew. :)

I could run the ATtiny off the output of the charge pump but ... the Tiny is the device driving the charge pump. Not that it's impossible, but... well, I wanted to see what I could safely get away with here.

I'd really like to get a better idea of how to model the AVR side of things. I also plan to do some more experiments to get a more solid understanding. I expect to come out the other side of this with some increased knowledge. Sweet. \o/

It should work - bot-thoughts.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I have an ATtiny ...

Quote:

Most AVR's, by the way, have symmetric I/O pin source and sink capabilities.

True, I guess. A rude surprise with a Tiny48 design was the wimpy pin drive. But it may indeed be symmetrical.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.