1

I want to build a toy for my daughter. It contains a couple of buttons and each of them play a different sound.

I have a 3.7v 500mAh battery, a tp4056 battery charger and a dfplayer audioplayer.

This is my basic setup: 5v source that goes to the tp4056 which charges the battery and feeds the dfplayer

basic setup

The dfplayer draws 8-16mA during idle which isn't much but still depletes a battery within hours/days (depending on the capacity). So what I want to do is to only power the player when the device is actually used. Lets say: When a button was pressed enable the device for ~10 seconds and with a short delay send a signal to the dfplayer

button press -> connect dfplayer to tp4056 power source -> wait ~100ms -> send a signal to the dfplayer (="close a switch once") -> wait ~10s -> disconnect dfplayer from tp4056

How can I solve this?


I tried a 555 monostable circuit plus an NPN transistor but that failed.

I added a dc booster to get my 3.7v source to 5v. Then a 555 circuit created a signal for ~10 seconds that was connecetd to an NPN transistor which feeds the dfplayer. That didn't work out because I only got like 500mv to my player. And that would not have triggered the dfplayer with delay.

boop
  • 111
  • 2
  • 1
    Use a microcontroller (that enters sleepmode when not activated) and a mosfet to turn on/switch off the player or use a two channel switch that charge a (super-)capacitor and activates the AD_KEY at the same time. The setup works as long there is a charge in the (super-)capacitor. – Codebeat Mar 14 '23 at 03:45
  • Useful article for momentary push-button on-off switches: http://www.technoblogy.com/show?VOO -- includes four variants: 555, Schmitt trigger, complementary MOSFET and ATtiny85 microcontroller. – RedGrittyBrick Mar 14 '23 at 10:55
  • @Codebeat any chance you draw a circuit and post it as answer? – boop Mar 14 '23 at 18:42

2 Answers2

0

The DFplayer has an output pin called "BUSY" which is low when playing and high when not. So you want to switch it off when the BUSY pin goes high.

To make a circuit that turns off when it's ready you can use a trick of putting a push-button switch in parallel with a transistor, so when the circuit powers up it activates the transistor and keeps itself powered, then the circuit deactivates the transistor when it's done, cutting off power to itself. (This is not the idea I ended up using in the circuit below)

This is quite easy with a microcontroller but it took me a few tries to come up with a concept that works with the BUSY pin - the difference is that the circuit should stay on while the BUSY pin is low, but shouldn't turn on if it's already turned off, just because it's low. Here's my latest attempt using an SR latch. I don't really like it because of the number of parts involved and it still draws a small amount of current when off (through R2+M1) although you could even make R2 1M ohms if you wanted.

schematic

simulate this circuit – Schematic created using CircuitLab

R1/R2/M1/M2 form a so-called SR latch, basically a memory cell or a toggle-switch. Normally M1 is on and M2 is off, leading M3 to have 5V on its gate so it stays off. (There's no reason it should have to be this way, so don't be surprised if the circuit is turned on when you plug the battery in). When the button is pressed it flips, now M1 is off, M2 is on, M3 has 0V on its gate so it turns on. When the DFplayer eventually sets the busy pin high, it uses M4 to flip back the other way again.

On the right side I included a little time delay circuit that should simulate pressing ADKEY_1 for a millisecond when the power comes on. You might need to adjust the values of R3 and C1. The diode helps it reset faster when power is off. It's important that the sound starts playing before the user lets go of the button, otherwise the circuit will turn off instantly as BUSY will be high.

I didn't test this, not even in a simulator, so some experimentation and tweaking might or might not be needed.

user253751
  • 11,998
  • 2
  • 21
  • 37
0

Here's a solution using schmitt trigger NAND gates from a 74HC132:

schematic

simulate this circuit – Schematic created using CircuitLab

G3 is simply an inverter, creating a nice low impedance square signal, in response to switch position. You might want some kind of switch debouncing, too, which can be done at G3's input. When the switch is closed, G3's input goes high, it's output goes low and discharges C1 and C2 very quickly via diodes D1 and D2. This brings the inputs to G1 and G2 almost immediately low.

When G3's output returns high (the switch opens again), C1 and C2 now charge up to +5V very slowly via R1 and R2. The time constant \$R_1 \times C_1\$ is short, about 0.5s with the values shown. Time constant \$R_2 \times C_2\$ is much longer, more like 10s. These different rise times cause the inputs to gates G1 and G2 to switch states after 0.5s and 10s respectively, and so we have implemented two monostable multivibrators, with periods of approximately 0.5s and 10s respectively. You can set these periods to anything you want by changing C1 (or R1) and C2 (or R2).

G1's output goes low only when the fast monostable has timed-out, after 0.5s. Therefore it is an active low "play" signal that you can use to trigger playback.

G2's output goes high from the moment the switch is closed, and stays there for the whole duration of 10s. It's inverse (provided by G4) is therefore low the whole time, and can be used to drive the gate of a P-channel MOSFET, used as a high-side switch for power to the player circuitry.

These gates really should be schmitt-trigger input types, from something like the 74HC132. You might be able to use standard gates from a 74HC00, but the predictability and sharpness of all the signals will suffer.

There are caveats. One is that maybe you need an active high play signal. I haven't done much thinking about this, but I suspect the player will switch on uncommanded by the switch, when power is applied. There are simple solutions to these problems, such as charging the capacitor high-side, inverting in different places etc. In other words, the principle here is good, but will need tweaking.

Here are simulated outputs PLAY and PWR, so you can see what I mean. The switch is closed and opened again at 1s:

enter image description here


Update: I couldn't resist solving the issue of powering on the player uncommanded, when power is applied to the whole system. I also added switch debouncing:

schematic

simulate this circuit

Since PLAY is active low, I've included R6 and D3 prevent the output of G1 (PLAY, which is normally high) from applying a high potential to the player's input, when the player isn't isn't powered.

I believe that this circuit draws almost no current, when the switch is open, long-term.

Also, you can simulate this circuit, and experiment with it in CircuitLab, by clicking "simulate this circuit".

Simon Fitch
  • 27,759
  • 2
  • 16
  • 87