What are the GPIO states in deep_sleep (e.g. Blue LED on D7)

Continuing the discussion from What do the colors on the Spark Core LED mean?:

@Leonardo, I don’t quite know how your setup looks.
Especially your external circuitry as mentioned in my comment above, might make the difference.

This was my test code, which causes my Core to go all black :wink:


void setup()
{
    pinMode(D7, OUTPUT);
    digitalWrite(D7, HIGH);
    // also tried 
    //pinMode(D7, INPUT_PULLUP);  // same result LED off during deep sleep
}

void loop()
{
    unsigned long ms = millis();
    while(millis() - ms < 10000)
      SPARK_WLAN_Loop();
    
    Spark.sleep(SLEEP_MODE_DEEP, 5);
}

What does your Core do with this code (with and without external circuitry)?

1 Like

@ScruffR Thanks a lot for your help. I tested your codes and it still behaves like this.

So i decided to pull out the ultrasound sensor and it stops. Guess I have to change the pin to another pin.

Hmm, sure you can use another pin, but what is your actual concern with the LED being on during deep sleep?
If it is to safe energy, you might save some since the LED does not consume anything anymore, but it would not stop the sensor to drain your power.
How does your setup look, what sensor do you use and how do you power it?
Could you power the sensor via another pin, which also goes off once the Core enters deep sleep?

Yea that is my other concern but I will figure out some how now that I know it is the ultrasound sensor problem hahaha.

I am using a HC SR04 sensor, and I put the Vcc of the sensor to the Vin of the Spark Core as I need the 5v. Maybe have to use some relay or transistors to control it.

Thanks for your help! @ScruffR :gift_heart:

1 Like

Hi @Leonardo

Is it possible that that the circuit connected to D7 is pulling the pin slightly high when the core changes D7 from output to high-impedance?

Can you try disconnecting your circuit from D7 when sleeping and see if the LED stays on or goes out?

[I moved this post from the other thread to clean up]

1 Like

@bko, I agree with your suspicions. The sensor draws power even when the Core is in deep sleep (< 2ma). Controlling the power to the module via a transistor would allow a complete shutdown of the module and remove the “ghost LED” effect altogether. :grinning:

3 Likes

@peekay123 & @bko, I suspect it was a bad idea of me to split/fork the original thread just in the middle of my own trouble shooting with @Leonardo :wink:

and

which led to

and

But as a non-Elite I can only “Reply as linked Topic” and not split where needed :weary:.
Maybe one of you can somehow stitch this together a bit better, to prevent any further double medication :wink:

3 Likes

@bko Tried that, it turns off instantly I plucked it out. :grinning:
This are the pins I used for the HC SR04 sensor:

  1. Vcc --> Vin
  2. Trig --> D7
  3. Echo --> D6
  4. Gnd --> Gnd

Best choice I have now is probably do whatever @peekay123 suggested

and @ScruffR hahaha as long you are helping it is already a good thing. No worries hahaha. :see_no_evil: :hear_no_evil: :speak_no_evil:

Thank you all for your love! Time for a big hug :heartpulse:

2 Likes