Can I Turn the CC3000 OFF? [solved]

Yahoo! I found a bug in delay() where it does NOT call SPARK_WAN_Loop() when the SPARK_WLAN_SLEEP flag is set by Spark.sleep()! So in the @brianr test code:

char LED = D7;

void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);    //LED on initially
}

void loop() {    
//Do something
    delay(25000);           //delay for 25 seconds

//Start sleep cycle    
digitalWrite(LED, LOW);     //LED off to indicate sleep
Spark.sleep(30);            //sleep for 30 seconds
delay(30000);               //delay for 30 seconds
digitalWrite(LED, HIGH);    //LED back on
//End sleep cycle
}

if the delay(30000) is removed after the Spark.sleep() call so that loop() ends and the firmware background task picks up on the sleep flag then the CC3000 goes in standby. Leaving the delay will prevent the CC3000 from going into standby and the sleep time expires at the same time as the delay. This happens at the end of loop() but the sleep has expired so essentially nothing happens and the CC3000 stays ON.

To prove this, simply add SPARK_WLAN_Loop() after the Spark.sleep(30) call and the CC3000 will go into standby as expected!

Now, using a INA219 current/voltage sensor to measure the current on the 5V (USB) side of a Core with nothing else connected to it (eg. sensors), here are my current measurements:

CC3000 ON, connected to cloud and breathing cyan: 138ma

CC3000 in standby using Spark.sleep(), breathing white: 32ma

Replacing Spark.sleep(30) with Spark.sleep(SLEEP_MODE_DEEP,30) will cause the Core to essentially shut down for 30sec after which it will reboot and start over again. The results shocked me somewhat because they are different than what I reported before:

CC3000/Core in deep sleep mode: 1ma or less!!

My previous measurements were made with a DHT22 and an INA219 sensor connected to a Core. My assumptions were that both consumed less than 2ma which is glaringly wrong! So with proper power management OUTSIDE the Core, low power modes are very conceivable. :slight_smile:

5 Likes