Deepsleep mode x Esp32

Hello, has anyone worked with the esp32 and MLX90614 IR sensor? I am trying to implement deep sleep mode but when I edit my code to include it, my esp32 never goes into a deep sleep. The sensor continuously measures temperature as if the esp32 is only listening to the code for the sensor. The code is posted below, can anyone help?

#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup()
{
Serial.begin(9600);
mlx.begin();

Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = ");
Serial.print(mlx.readObjectTempC());
Serial.println("*C");
Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = ");
Serial.print(mlx.readObjectTempF());
Serial.println("*F");
Serial.println();
delay(5000);

esp_sleep_enable_timer_wakeup(15000);
esp_deep_sleep_start();
}

How long does this put the ESP32 into deep sleep for ?

declare in globals

#include "esp_sleep.h"

elsewhere

esp_sleep_enable_timer_wakeup( (1000000 * (60))/5 ); // 1 minute sleep time for troubleshooting, drains battery.
    esp_deep_sleep_start();

I suppose you'll get rid of this once it works

delay(5000);

and that serial print.

That's in us, micro seconds. 1500 uS is .0015 of a second. Can you see and LED that blinks for .0015 of a second?

It was supposed to be milliseconds to 15 seconds.

It's supposed to work for 15 seconds but it doesn't work at all.

The esp32 is still not going into deep sleep mode, the sensor is continuously measuring and outputting data.

How do you know the ESp32 is not going to deep sleep?

Does the sensor have its power removed when the ESP32 goes to deeps sleep?

Make a RTC_FAST int variable have have it count up for each deep sleep, when the ESP32 wakes have the count displayed.

Did you change the time to be compatible with micro seconds?

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.