#avr Logs

Apr 30 2020

#avr Calendar

12:02 AM day_ is now known as day
04:56 AM nabil__ is now known as nabil
09:51 AM matrixstorm: hi
10:10 AM nohit: hoi sie
05:39 PM aborazmeh_ is now known as aborazmeh
06:25 PM Smidge204: Welp minor hitch in the analog comparator plan; according to the docs no interrupt is generated by the AC in any sleep mode deeper than "idle"
06:27 PM cehteh: lol .. somehow supected that
06:27 PM cehteh: is any of the INT pins shared with and ADC input?
06:31 PM Smidge204: I can select which pins trigger interrupts and which are ADC input, so I suspect I could use one pin for both
06:31 PM Smidge204: But that would limit my voltage range to values high enough to trigger the pin
06:35 PM cehteh: or reverse your logic use the 1v1 or lower AREF
06:35 PM cehteh: whats the level for triggering from high to low?
06:36 PM Smidge204: for 3.3v I think the minimum high is 2v
06:36 PM cehteh: just looking at the datasheet, you can generate a 0.55v AREF
06:36 PM cehteh: even 1.1v would be plenty
06:36 PM Smidge204: I don't see how that helps?
06:37 PM cehteh: your buttons should pull it below 1.1v you wake on falling edge
06:38 PM cehteh: 0r 0.55v whatever works
06:38 PM Smidge204: But it's the same problem as triggering on rising edge; I only have ~1 volt to divide into 3 or 4 distinct levels
06:39 PM cehteh: doesnt matter AREF is the your reference, when you use 0.55v as aref then thats still 10 bit in the range from 0..0.55V
06:40 PM cehteh: thus when idle VCC (3v3) is on the pin
06:41 PM cehteh: when a button is pressed it drops to 0, 0.2, 0.4, 0.6 V depending on button, thats enough to trigger the wakeup
06:41 PM cehteh: then you measure ... voila
06:42 PM Smidge204: My concern is not getting a stable enough environment to reliably distinguish 0.2v
06:42 PM cehteh: how long are the cables to the buttons?
06:42 PM Smidge204: Same PCB
06:42 PM cehteh: should be pretty doable, add a bit filtering (anyway)
06:43 PM cehteh: and dont make it too high impedance
06:43 PM cehteh: when the buttons are only presed for short times then 4k7 or even lower should be ok
06:44 PM Smidge204: I just want to mention that my current battery operated clock has been wrapped in aluminum foil for over a decade, because the static discharge I get when I get out of bed would cause it to glitch out and reset. :D
06:44 PM cehteh: maybe/likely even 15k or more works
06:44 PM cehteh: its all about proper ground planes and rounting/shielding/insulation
06:45 PM cehteh: static discharge will only accumulate on very high impedance stuff
06:45 PM cehteh: since you put a RC filter there and dont overdo with resistance static discharge wont affect it
06:45 PM Smidge204: No discharge to the clock, mind you
06:46 PM cehteh: make a breadboard test
06:46 PM Smidge204: The clock would be several feet away from the point of discharge
06:46 PM cehteh: i ebt even with somewhat dirty wireing and electronic it still works
06:47 PM cehteh: what may caouse trouble is when you switch power closeby pwm motor, servos, high power leds etc
06:48 PM cehteh: that clock as prolly some things floating or very high impedance
06:49 PM cehteh: in your circuit this can happen too, it may cause spurious wakeups, but a RC filter on the pin could already fix that, anyway spurious wakeups could be just handled in software and ignored
06:49 PM Smidge204: Maybe it's almsot 30 years old
06:50 PM cehteh: i'd really do a breadboard test first
06:50 PM cehteh: and i am pretty sure it'll work fine
06:50 PM Smidge204: Well no duh :/
06:51 PM Smidge204: Gonna have a good long think about this. Might just bite the bullet and go to the next size up MCU with more IO pins
06:57 PM cehteh: http://tinyurl.com/yczmfgev
06:58 PM cehteh: as long only one button is pressed i bet you can reliably increase that to 12 buttons ..
06:59 PM cehteh: gets a bit tricky to make a ladder that can detect button combinations
07:04 PM cehteh: http://tinyurl.com/y9roflww ROFL :D .. anyway have fun with noise, or modify it to inject some pulses you'll see the cap will filter it
07:20 PM Smidge204: External comparator might work too
07:20 PM Smidge204: Or just use a chip with more IO pins and be done with it
07:24 PM cehteh: external comparator needs power
07:24 PM cehteh: more io pins ... yes nice idea
07:25 PM cehteh: but give the above circuit a try, it should work