• Worldwide Shipping

  • 24/7 Customer Support

  • FAQ
  • Worldwide Shipping

  • 24/7 Customer Support

  • FAQ

Croduino NOVA sleep mode

You are a beginner with Croduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by e-radionica where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect the module with Croduino and the basic code. Everything else is left to your imagination.

INTRODUCTION

When we work on a project, we rarely think about the consumption of each of the modules. But, when we need to switch the project to battery power supply, it is clear that the consumption of the modules is crucial. When the project is battery-powered, each mA the module can consume is essential and we constantly look for ways to reduce the consumption. If we work with reduced consumption, it means that the system (project) will work longer on a single charge, which is very important to us. In order to achieve the long-term operation with Croduino Nova 2, in this tutorial, we will show you how to "put Nova to sleep" when it is not required to operate (e.g. measure temperature every hour) and how to "wake it up". For the purposes of "putting Nova to sleep" and "waking it up", first, we must know about its operation modes, so let us begin with that.

OPERATING MODES

Croduino Nova 2 has 4 operating modes which differ according to which part of the board is operating and, of course, the consumption, so let us move on with explaining these operating modes.

The first operating mode is the Normal operating mode, where each part operates and Croduino Nova does not "sleep", but rather operates normally, and it is constantly ready, which means that the consumption is at its highest.

The second operating mode is MODEM-SLEEP and it is the default operating mode which is attainable only when the Croduino Nova is being connected to the access point. The only thing done when it is in the second operating mode is shutting the WiFi down whenever possible (among the DTIM Beacon intervals which are set within the router).

The third operating mode is LIGHT-SLEEP mode in which Croduino Nova 2 shuts the WiFi and the system clock that controls the processor down, so the processor operates, but it does not perform tasks (idle mode). In this operating mode, Croduino consumes far less than in the MODEM-SLEEP mode.

The last operating mode, in which we "put Croduino Nova 2 to sleep" is DEEP-SLEEP mode, using which we shut all the systems down, except for the RTC (real-time clock) and the consumption in this mode is 17uA (3,3 V power supply), i.e. 50 uA (5V with a regulator and pull-up resistors) which is low and acceptable for projects that are battery-supplied. To reduce the consumption to the uA you must remove the CH340 USB driver, along with the battery charger from the board. Make sure to switch the code to the board before removing the CH340 chip, because later it will not be possible.

Power consumption in the normal operating mode and DEEP-SLEEP is shown in the following table (5V power supply).

DEEP SLEEP

As we have already mentioned, this is the only operating mode in which the Croduino Nova 2 "sleeps", i.e. all of its systems are shut down, except for the RTC (real-time clock) and this mode is the most energy-efficient. It is used when we need to significantly reduce the consumption, and the constant operation of the microcontroller is not required. We also use this operating mode when we have sensors that measure something during specific time intervals and send these data to the Internet (or server). First, we measure the values and send them, then we shut the microcontroller down for some time (in microseconds), for 70 minutes longest, and finally, repeat the process (turn the microcontroller on again, measure, send data and turn it off). For the microcontroller to wake again you must connect pin 16 to the reset pin. Pin 16 has a special function for waking the microcontroller. When the given time has passed, pin 16 is set to LOW and it restarts the microcontroller, so it starts executing the program the same way as when we reset it using the reset button.

ARDUINO CODE

Here is a simple code in which we will read the temperature every minute and send it to the Serial monitor. In the code for switching the microcontroller off, we use the ESP.deepSleep() function to which we transmit the time in microseconds (1s= 1000000 us = 1e6).

//including the library for the DHT sensor
#include<DHT.h>
//defining to which pin the DHT sensor is connected and which type of sensor is used (DHT11 or DHT22)
#define DHTPIN 4
#define DHTTYPE DHT11

//creating the constructor for the DHT library
DHT senzor_temp(DHTPIN,DHTTYPE);

void setup() {
 //starting serial communication (115200 baud)
Serial.begin(115200);
//starting the communication with the sensor 
senzor_temp.begin();
//displaying the message that the Croduino is "awake" and the temperature on the Serial monitor
Serial.println();
Serial.println("Croduino is on and reading temperature");
Serial.print(senzor_temp.readTemperature());
Serial.println(" °C");

//DEEP SLEEP
Serial.println("Turning the Croduino off for one minute");
ESP.deepSleep(60e6); // turning the Croduino off for 60 seconds 

}
void loop() {

}
Leave a Reply