Author Topic: digispark ATTiny85 sleep mode and wake up with interrupt on P2  (Read 370 times)

mehulhirpara

  • Newbie
  • *
  • Posts: 7
digispark ATTiny85 sleep mode and wake up with interrupt on P2
« on: September 21, 2018, 10:12:37 am »
Hi All,

I am configuring PB2/P2 (external interrupt pin) for the interrupt based wake up and waiting for the interrupt with button press.

Board is powered by 5V supply (and not through USB), all the configurations is done in setup() itself and I am not using loop() at all. Therefore, expectation is the board should go into sleep mode while running idle thread and should wake up with interrupt.

Everything is working fine but I am not sure whether board is really going into sleep mode or not and how to check if board is in sleep state?


granzeier

  • Newbie
  • *
  • Posts: 28
Re: digispark ATTiny85 sleep mode and wake up with interrupt on P2
« Reply #1 on: October 12, 2018, 12:37:06 pm »
Can you cut the +5V line to the Digispark, and insert an ammeter? You could then use one program to exercise the board (maybe just an empty loop,) and record the baseline current reading. Then run your sleeping program, take the new current reading, and compare it to the baseline.

mehulhirpara

  • Newbie
  • *
  • Posts: 7
Re: digispark ATTiny85 sleep mode and wake up with interrupt on P2
« Reply #2 on: October 29, 2018, 02:00:33 am »
Thanks for the reply.

To measure the current consumption, I used 47ohm resister in series with +5V supply and measured voltage drop across and calculated current.

I found following useful video and code reference explaining sleep mode.

https://www.insidegadgets.com/2011/02/05/reduce-attiny-power-consumption-by-sleeping-with-the-watchdog-timer/
https://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html

This helped me to some extent and I am using SLEEP_MODE_PWR_SAVE mode. I can't go beyond this as I am expecting external interrupt with RISING edge. As per specs, with LEVEL edge interrupt we can go further into deep sleep using SLEEP_MODE_EXT_STANDBY.