I am using DFPlayer Mini to create some sound effects in my Halloween props this year. I would like to control it from a Wemos D1 Mini, but time is running short and I can't find a programming solution.
I am currently using buttons on the ADKEY1 pin, and I want the Wemos to simulate those buttons:
This bit of code works fine for pulling ADKEY1 low through a series resistor as do buttons S3 and S4 in the schematic. However,
My question here is, since the current from ADKEY1 is in nanoamps, would the MOSFET even turn on? If I use a transistor, the Rb calculates to a value in the many megohms. What should I use?
I will revisit the serial I/O again, but the buttons are working now. It's October already, and we have other props to work on. (Halloween is my wife's favorite event and it gives me an excuse to design gadgets, and buy parts, for her props).
Nothing that simple. She will be dressed as a squire. The theme is a dragon's lair. The prop with sound is a monster box. I have a fog generator inside, plus a mechanism to bounce the lid as if there is something inside trying to escape. There's also a drill motor to twitch the dragon's tail sticking out of the side of the box.
Other props include an egg drop where a momma dragon lays plastic eggs with toys inside. Tomorrow, I have to prepare a fire. A 2-ft diameter wood disk with about 25 flickering LEDs (candle replacements). She will cover them with expanding foam from the hardware store then sprinkle some black and red paint over it.
But, thanks for the tip again. It got me back on schedule.
BTW, I looked more at the control over serial I/O, but there seems to be some issues with softwareSerial on ESP chips.
And with your tip, I can control the two sound effects for my project just paralleling the buttons.
There is a simple hardware solution…. Zero software required.
Three diodes acting as ‘steering diodes’, which allow the 0V state to close the switch, and the diodes block the ‘external’ 5V from feeding into the switch input
1N914 / 1N4148 small silicon diodes would be fine in this role.
at all, implies the possibility that it was at some time before, written HIGH. If it is HIGH and you set it as OUTPUT, you put the full supply voltage on the pin. Since it appears this is what you are attempting to avoid, you need to set it LOW (also disabling any INPUT_PULLUP) and do that before setting it to OUTPUT.
Once you know the pin is written as LOW - and unless anything might alter it - it is sufficient to use only pinMode to thereafter alternate between OUTPUT and INPUT and back again.
Wouldn't it be easier to just send the serial commands to the player to control it? I just shipped a couple of projects using that DF Player and it's pretty straightforward to control with the AT commands. They also have an arduino library to make it easier.
I am using the Wemos D1 Mini and controlling the props over WiFi using MQTT. From my research, WiFi and the DFPlayer library don't like each other. (Interrupt conflicts).
I haven't seen any example sketches using AT commands on the DFPlayer.
I don't have any more time. The prop already works using the DFPlayer as a stand-alone MP3 player (I only have two SFX tracks), so just putting a GPIO pin across the manual buttons is working just fine. I pull ADKEY1 low for two seconds, and that plays track 1 on a loop. I pull ADKEY1 low through a 3K resistor and track 2 plays. That's all I need for this project.