Speaking clock, ON with push button, OFF automatically when done

The speaking clock is made with:

Arduino nano     x 1
2W 8hm speaker   x 1
DFPlayer mini     x 1
DS3231 RTC chip   x 1
1.5V AA Battery   x 4
LM2596S DC-DC    x 1 . (For regulating voltage down to 5V)

The DFPlayer and Arduino nano draws power directly from VCC (Regulated to 5V), DFPlayer plays the pre-recorded sound files according to the time retrieved from DS3231.

The speaking clock works fine, excepts when I hook the existing circuit with latching power switch circuit. The goal is to conserve power usage by switching off Arduino completely when speaking clock is finished.

I followed Latching Power Switch Circuit (Auto Power Off Circuit) | Random Nerd Tutorials , which uses MOSFETs to do the switching. This works on simple circuit, e.g. when attaching to LEDs. However, I failed to make it work with the existing speaking clock circuit, the assembled circuit gets reset when the clock is about to “speak”.

Simplified source code as below:

#include <Wire.h>
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10, 11); // TX, RX
DFRobotDFPlayerMini myDFPlayer;

// Define power latch pin for ESP32 (GPIO 5) / ESP8266 (GPIO 5) / Arduino (Digital 5)
const int powerLatch = 5;

void setup() {
  // Define pin as an OUTPUT
  pinMode(powerLatch, OUTPUT); 
  // Keeps the circuit on
  digitalWrite(powerLatch, HIGH);

  // Actual
  // Start the I2C interface
  Wire.begin();
  delay(1000);
  // For debugging only
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);

  if (!myDFPlayer.begin(mySoftwareSerial)) {
    Serial.println(F("Unable to begin:"));
    while(true);
  }

  myDFPlayer.volume(20);  //Set volume value. From 0 to 30
  delay(1000);
  myDFPlayer.play(1);  // In real code, it plays sound file according to RTC time
  delay(8000);

  // Switch off the circuit
  digitalWrite(powerLatch, LOW);
}

Look forward to your advice.

Thanks
Jo

Deep sleep mode brings down the power use to less than the self discharge of your batteries, and is easier to implement/less components needed.

Did you change the sketch so it doesn't just wait 10 seconds and turn the power off like the demonstration code does?

Which side of the switch is the buck converter on?

You set the latch pin high early in setup() and you set it low at a point in your sketch immediately following the end of a time announcement?

wvmarle:
Deep sleep mode brings down the power use to less than the self discharge of your batteries, and is easier to implement/less components needed.

Thanks for the suggestion. To use deep sleep mode, do I need to use Arduino Pro mini, instead of the Arduino Nano? I researched a bit, it seems I might need to use ESP32?

I look forward to your guidance.

6v6gt:
You set the latch pin high early in setup() and you set it low at a point in your sketch immediately following the end of a time announcement?

I have posted the sample code. I did put a delay for around 8 seconds following the end of a time announcement.

Look forward to your help.
Thanks

johnwasser:
Did you change the sketch so it doesn't just wait 10 seconds and turn the power off like the demonstration code does?

Which side of the switch is the buck converter on?

I am following

The buck converter positions exactly on the battery as in the diagram, and the DFPlayer VCC connects directly to the buck converter too, on positive side

Thanks for your help. I look forward to your advice.

pagedownhk:
Thanks for the suggestion. To use deep sleep mode, do I need to use Arduino Pro mini, instead of the Arduino Nano? I researched a bit, it seems I might need to use ESP32?

I look forward to your guidance.

The Pro Mini is a lot easier to get truly low power… less peripherals to take care of.

pagedownhk:
The buck converter positions exactly on the battery as in the diagram, and the DFPlayer VCC connects directly to the buck converter too, on positive side.

If you are looking to conserve power it seems strange to keep the buck converter powered up, let alone the DFPlayer. Shouldn't all the loads be on the switched side? I would connect the input side of the buck converter to the MOSFET switch and hook the DFPlayer and Arduino to the output side of the buck converter.

johnwasser:
If you are looking to conserve power it seems strange to keep the buck converter powered up, let alone the DFPlayer. Shouldn't all the loads be on the switched side? I would connect the input side of the buck converter to the MOSFET switch and hook the DFPlayer and Arduino to the output side of the buck converter.

Thanks for your suggestion. I am new to electronics and this is my first project. I would give a try soon

wvmarle:
The Pro Mini is a lot easier to get truly low power… less peripherals to take care of.

I would give Pro mini a try too. Thanks

wvmarle:
The Pro Mini is a lot easier to get truly low power... less peripherals to take care of.

The DFPlayer mini requires a dedicated VCC (DC 3.2V~5V),should I still use buck converter for regulating voltage for 4AA battery to 5V, supplying to both DFPlayer mini and RAW pin of the Arduino pro mini?

I am thinking if there is more "power saving" way to achieve this?

Many Thanks!

5V must be applied to the 5V pin of the Pro Mini, not the RAW or Vin pin.

Here is an excellent tutorial on low power operation. To turn the Pro Mini into a "bare bones" Arduino, use the tip of a hot solder pencil to remove the voltage regulator and the power LED.

4xAA = ~6.5V when fresh, dropping quickly to 5-5.5V when in use. That's a problem. It's a horrible voltage to work with. The initial 6V is high enough to do damage, 5-5.5V is too low to regulate easily to 5V.

Use a 3.3V Pro Mini (8 MHz) and 3xAA batteries, or a single LiPo. No regulation needed whatsoever. The Pro Mini will happily take the 3.5-4.5V of the AA pack or 3.2-4.2V of the LiPo (it's still the same processor as the 5V version has, just lower clock speed - the 3.3V Pro Mini also works very well on 2xAA batteries), as will the DF Player.

Thanks everyone!! :kissing: I have got my first project working now, by using Arduino pro mini (sleep forever and with power LED scratched off) with DFPlayer mini plays on button pushed (with interrupt)

However, the battery (three AAA) battery cannot last for 2 days, which seems to be drawn by DFPlayer mini. I checked online that the standby current of DFPlayer mini is 20ma.

I have seen also several discussions on switching on DFPlayer mini only when needed: Reducing power consumption of an arduino module (mosfet?) - Electrical Engineering Stack Exchange

Is there simpler way to accomplish battery conserve? Basically I just need to play for 10 seconds at most, most of the time the device is idle. Is it possible to use relay for switching on / off the VCC of DFPlayer mini?

Thanks!

A Pololu power switch is the easiest way to programmatically control external devices.

A high side MOSFET is I think the simplest solution. Not much change in programming needed; set pin LOW when you wake up, HIGH to switch off the DF Player.

I forgot what the pin states are in deep sleep... Keeping existing state or high impedance? Either way will be just fine.

I am trying to test the use of high side switch with DFPlayer mini, Arduino nano and 3x AAA battery. I found a circuit online, and trying to follow it:

DFPlayer mini VCC connects to the drain of the MOSFET (NDP 6020P) directly, I did not include the use of diode and capacitor (Is it necessary?). However, the Arduino is reset when DFPlayer is about to initialise

void setup() {
  // Actual
  // Start the I2C interface
  Wire.begin();
  delay(2000);

  pinMode(switchPin, OUTPUT);
  digitalWrite(switchPin,  LOW);
 
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);

  if (!myDFPlayer.begin(mySoftwareSerial)) {
    Serial.println(F("Unable to begin:"));
    while(true);
  }
  myDFPlayer.volume(20);  //Set volume value. From 0 to 30
  myDFPlayer.play(1);
}

Your help is very appreciated!

I’d place the capacitor between Vcc and GND, before the MOSFET. Saves the inrush current the moment it’s switched on, which may be the cause of your resetting Arduino - however without seeing your complete, actual schematic it’s hard to tell.

Hi wvmarle,

I have tried to draw the schematic, please take a look. Do you mean adding C1? What should be the capacitance value?

Image link:

My first schematic… It looks a bit weird, please let me know if there is anything missing.

#include "LowPower.h"
#include <RTClib.h>
#include <Wire.h>
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

// Use pin 2 as wake up pin
const int wakeUpPin = 3;
const int ledPin = 11;
const int switchPin = 12;

volatile byte state = LOW;

RTC_DS3231 rtc;
SoftwareSerial mySoftwareSerial(6, 7); // TX, RX
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  // Actual
  // Start the I2C interface
  Wire.begin();
  delay(1000);

  delay(1000);
  pinMode(switchPin, OUTPUT);
  digitalWrite(switchPin,  LOW);
 
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);

  if (!myDFPlayer.begin(mySoftwareSerial)) {
    Serial.println(F("Unable to begin:"));
    while(true);
  }
  myDFPlayer.volume(20);  //Set volume value. From 0 to 30
  myDFPlayer.play(1);
}

void loop() {
    

}