#avr Logs

Jan 26 2022

#avr Calendar

01:35 PM specing_ is now known as specing
02:02 PM Kabriel: I have a 12v line coming from another board and I want to know if it is on or off using a pin on a 2560. At first I thought of just using a divider, but then stumbled across an answer on stackoverflow to use a zenier instead. Does it really matter?
02:03 PM Kabriel: ^ to bring it down to 5v, in case that wasn't obvious.
02:04 PM qu1j0t3: Kabriel: either should work.
02:04 PM qu1j0t3: Kabriel: zener can be safer if you think it may spike higher, etc
02:05 PM qu1j0t3: or want to eliminate transients
02:22 PM Kabriel: Thanks. How do you size the lead resistor?
02:23 PM qu1j0t3: Kabriel: check zener datasheet, it gives an Iz value they test with, WAG somewhere between 1mA and 5mA should be fine
02:25 PM Kabriel: I'm confused by the spec (it is a onsemi). It lists Iz(20mA) and Izk(0.25mA). Is this supposed to represent a range, depending on the actual current? The internal impedence of the diode is wildly different at those two currents (i.e. Zz and Zzk).
02:28 PM qu1j0t3: Can you link me to the ds?
02:29 PM twnqx: the bigger question is, how do you realize the 0?
02:29 PM twnqx: pulldown?
02:30 PM Kabriel: https://www.onsemi.com/pdf/datasheet/1n5221b-d.pdf
02:30 PM twnqx: also, no need for a zener or anything
02:30 PM Kabriel: 1N5231B
02:30 PM twnqx: just use a large series resistor and utilize the clamp diode
02:31 PM Kabriel: With the pin in input mode, with hi-z, wouldn't that detect +5v as a 1 and 0v as 0?
02:34 PM Kabriel: ^ the other board and the 2560 share ground
02:41 PM twnqx: well, if you get 0V, yes
02:41 PM twnqx: 12V/open would have been a problem :P
02:42 PM twnqx: but yes, if speed does not matter too much (double-digit hertz), you would get away with a series resistor that keeps current below the capability of the 2560's clamp diodes
02:43 PM twnqx: that's how someone built a zero-point detector for 230V AC: AC -> rectifier -> resistor -> avr
02:52 PM Kabriel: I'm still learning so I have a few more questions, just to make sure I understand it correctly.
02:54 PM Kabriel: Looking at the atmel 2560 spec, it says the i/o pin input threshold voltage is around 2.5V or Vcc=5V (my case). I would assume that this means even if there was a little bit of voltage on the pin (say 0.1V), it should still read zero, correct? Or is this not what that part of the spec means?
02:55 PM Kabriel: ^ this is the pin threshold hysteresis charts, and actually VIH is around 2.5 and VIL is around 2.0V.
02:57 PM Kabriel: And I'm still confused by onsemi's spec sheet on the zener; the difference between Iz and Izk.
02:57 PM twnqx: actually
02:58 PM twnqx: there's an upper threshold for "safely ready zero"
02:58 PM twnqx: and a lower for "safely reads one"
02:58 PM twnqx: and a range in between that's "maybe this, maybe that"
02:59 PM Kabriel: twnqx: I just saw the DC characteristics chart in the spec, and it has that there I think. VIL<0.3Vcc and VIH>0.6Vcc.
02:59 PM twnqx: yes