Project

General

Profile

Wake up Jeenode Micro after Sleepy::powerDown();

Added by Lahorde about 5 years ago

Hi,

I need to wake up Jeenode µ from external interrupt, I’ve tried to attach interrupt attaching IRQ Jeenode Pin interrupts :

bool state = true;

void led()
{
  state = !state;
  digitalWrite(PIN_A0, state);
}

void setup() {
  pinMode(PIN_A0, OUTPUT);
  attachPcInterrupt(3, led, RISING);
  digitalWrite(PIN_A0, state);
}

void loop() {
  // put your main code here, to run repeatedly: 
  Sleepy::powerDown();
  delay(1000);
}

It doesn’t work. I can wake up from watchdog interrupts but not from external interrupt.
Is there a way to wake up from external interrupts?

Lahorde


Replies (6)

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by JohnO about 5 years ago

I use external pin change interrupts in the enclosed. I haven’t used attachPcInterrupt though opting to do it directly. Without attachPcInterrupt you just get an interrupt on change rather than selecting rising/falling etc. Please excuse the messy source.

Update: I now see you want interrupt rather than pin change - sorry.

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by Lahorde about 5 years ago

Ok it works, I’ve checked wake up by using a LED. Code given in my first post is fine, I had just a powerup issue from sensor rising interrupt on IRQ Jeenode Input.

Lahorde

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by Lahorde about 5 years ago

A related issue makes me crazy.

When I do not connect scope or multimeter probe I cannot wake up from pin change interrupt!

If I comment :

Sleepy::powerDown();

I can detect some pin change interrupt but when I connect scope probe I got many more interrupts corresponding to input signal.

I triple checked wiring, continuity of ground on sensor output when no motion detected…

So, my conclusion : I need to have a pull down resistor on PIN (44K ok).
No it works, CPU wakes up…

Sensor connected on input pin is http://pewa.panasonic.com/components/built-in-sensors/passive-infrared-sensors/napion/ with digital output.
Sensor output is a clean square signal.

So, why do I need this pull down?

Lahorde

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by JohnO about 5 years ago

Can Will you post your full sketch as an attachment?

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by Lahorde about 5 years ago

Hi JohnO,

Here are my source files. You will also find prototype pictures, on top face are ISP, power up connections, red wire on PA0 pin lights a LED, on bottom are sensor connections. I’m using Eclipse with this plugin http://www.baeyens.it/eclipse/ so I do not manipulate .ino files, you will find attached .cpp and .h files

Sketch is quite simple : when motion is detected LED’s state changes.

As I said before with this code, LED status do not often changes. When connecting multimeter and scope I have a better motion detection : internal scope/multimeter resistor pulled down motion sensor ouput.

In fact, I found very interesting posts about my issue :
https://forum.sparkfun.com/viewtopic.php?f=14&t=35513

As mentioned in Napion sensor datasheet output just needs to be pulled down.

Lahorde

RE: Wake up Jeenode Micro after Sleepy::powerDown(); - Added by martynj about 5 years ago

@Lahorde,

Please remember that pin change interrupts IIRC are implemented within the ATMega without de-glitching (unlike the classic INT0, INT1 lines).
This makes them super sensitive to noise arriving at the pin. Your ’scope may be showing a clean transition due to its bandwidth limitation (sorry if I’m maligning your 2GHz sampling ’scope !). The evidence that even trivial loading of this pin by the multimeter probe changes the symptoms indicates that there is some issue with the input signal edge.

I usually specify a glitch filtering chip (e.g. MAX6816) between source and pin to avoid this issue with mechanical switches, but probably an overkill in this application. A simple RC filter (with perhaps some series L if a radio module is close by) could be a zero power penalty, low cost solution.

    (1-6/6)