1
\$\begingroup\$

The ATtiny85 datasheet specifies an absolute maximum negative voltage for any pin of -0.5 volts relative to ground.

Consider this partial schematic:

partial schematic

MOSI and MISO are the respective ATtiny85 pins and the CLOCK terminal is connected to the coil of a lavet stepper motor - which means it's just an electromagnet coil.

It works, but when I had the outputs on a scope to examine some of the timing, I happened to notice a negative going spike as the output is turned off, despite the presence of the flyback diode. I quickly realized that the magnitude of the spike is the forward voltage of the diode - in this case, 1 volt.

The question I have now is, does that absolute maximum (actually, absolute minimum in this case) rating apply to pins configured as outputs set to LOW?

I can replace the 1N4148s with Schottky diodes with a forward voltage of only 0.5 volts... but is it worth bothering with?

\$\endgroup\$
  • \$\begingroup\$ Shottkey diodes may very well improve performance. To be safe you should consider driving your stepper from an external transistor or an H-bridge. \$\endgroup\$ – jippie Aug 17 '14 at 17:02
  • \$\begingroup\$ I don't think that's necessary. This is a stepper motor in name only. It's actually a clock movement. There's virtually no torque being imposed and the stepper pulses are 30 mS wide at 1 Hz. Since the current is going through two 100 ohm resistors even if the coil was a dead short there would be only 16.5 mA flowing (Vcc is 3.3 volts). \$\endgroup\$ – nsayer Aug 17 '14 at 18:59
2
\$\begingroup\$

From the datasheet, you can see that all pins have protection diodes. This means that if you try to drive pins negative, they will start clamping voltage when the input goes below some voltage (which is guaranteed to be at least -0.5 volts).

You will drive input to -1 volt via resistor. In the worst case, the pin will be clamped at -0.5 volt, and you will be dropping 0.5 volt over 100 ohm resistor. This means pin current will be 5 milliamperes. Absolute 'DC Current per I/O pin' is 40 mA, and you are nowhere near this value. No need to worry.

\$\endgroup\$
  • \$\begingroup\$ Not so fast! It's not clear that the same current limit applies to the protection diodes inside the chip as applies to its transistors. \$\endgroup\$ – Chris Stratton Aug 18 '14 at 20:47
  • \$\begingroup\$ ok, that's fair. But given that the pin is configured as an output and set to low, does the protection diode even enter into it? \$\endgroup\$ – nsayer Aug 18 '14 at 21:08
  • \$\begingroup\$ It should be noted that I was measuring not at the pin, but at the "clock" terminal. So I was measuring on the "far" side of the 100 ohm resistor. \$\endgroup\$ – nsayer Aug 18 '14 at 21:20
  • \$\begingroup\$ Turns out that this was probably making a mountain from a molehill. I moved the scope probe from the clock terminal to the actual controller pin, and the negative voltage spikes aren't even 100 mV below ground. So the resistor must be enough to protect the controller, it would appear. Either that, or the fact that the pin is grounded is causing it to sink negative current through the resistor, but not so much that the voltage rises. If the pin is sinking the residual voltage, then the resistor is only passing 10 mA and - again - the pin is rated for 40. \$\endgroup\$ – nsayer Aug 21 '14 at 3:07
  • \$\begingroup\$ A bit late, but that would mean that the 2 1N4148 diodes are also useless. Also since they have a higher forward voltage then the protection diodes anyway. It's the size of the resistor that determines if the forward current through the protection diode will exceed the -0.5V. However the data sheet does not show these values. \$\endgroup\$ – user61540 Dec 16 '14 at 13:10

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.