Hey Everyone!
I was making a sound remote button where if you press a button, an LED will light up for a few seconds while the sound plays. The whole project works perfectly when plugged into the computer. However, when it is using an external power source, it makes an odd sound (like buzzing) and then nothing happens. The board is on, and i know because I see the green led on the board lit, but other lights are off (which isn't normally the case when plugged into the computer). I have a power supply of 6V (4 double A batteries) and maybe that was too much. But when I take out a battery and there is 4.5 volts it does the same thing. It worked for a little bit before it stops working and I don't know what to do. Any advice would really help!
Thanks!
Ps: I don't know if this helps but here is my code:
#include "DFRobotDFPlayerMini.h"
DFRobotDFPlayerMini myDFPlayer;
const int buttonPins[] = {8, 9, 10, 11, 12, 13}; // Button pin assignments
const int ledPins[] = {2, 3, 4, 5, 6, 7}; // LED pin assignments (for reference, but not used directly)
const int ledMapping[] = {7, 6, 5, 4, 3, 2}; // Mapping buttons to LEDs (Button 1 -> LED 7, Button 2 -> LED 6, etc.)
const int soundFiles[] = {1, 2, 3, 4, 5, 6}; // Sound file corresponding to each button
bool buttonStates[6] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH}; // Stores previous button states
void setup() {
Serial.begin(9600);
Serial3.begin(9600);
if (!myDFPlayer.begin(Serial3)) {
Serial.println("DFPlayer Mini initialization failed!");
while (true);
}
Serial.println("DFPlayer Mini ready!");
myDFPlayer.volume(25);
for (int i = 0; i < 6; i++) {
pinMode(buttonPins[i], INPUT_PULLUP); // Set button pins as input with pullup resistors
pinMode(ledPins[i], OUTPUT); // Set LED pins as output
}
}
void loop() {
for (int i = 0; i < 6; i++) {
bool currentState = digitalRead(buttonPins[i]);
if (buttonStates[i] == HIGH && currentState == LOW) { // Detects button press (state change)
int ledPinToLight = ledMapping[i]; // Map the button to its corresponding LED pin
digitalWrite(ledPinToLight, HIGH); // Light up the specific LED
Serial.print("Button ");
Serial.print(i + 1);
Serial.println(" pressed - Playing Sound");
myDFPlayer.play(soundFiles[i]); // Play the sound corresponding to the button
delay(50); // Simple debounce delay
while (digitalRead(buttonPins[i]) == LOW); // Wait for button release (prevents retrigger)
digitalWrite(ledPinToLight, LOW); // Turn off the LED after button release
}
buttonStates[i] = currentState; // Update previous state
}
}
Honestly, I thought that since it said 5V, it would only let 5V in....I'm a beginner with this. Is there a way for me to check this? I know when i measured the battery pack it said 6V. How do I measure this on the board?
Powering Arduino boards can run on an external supply of 6–12V but if the supply voltage is less than 7V, the 5V pin may not supply 5V, which can make the board unstable.
The VIN pin on Arduino boards can be used as a voltage input for regulated external power supplies that don't use a barrel jack connector.
For more information, see here:
Post a simple schematic showing how you have wired this. Note any leads over 10"/25cm. Be sure to show all power and ground connections along with any hardware connected to the Arduino.
I've had a look at the elegoo board pinout. You should see a pin labelled 5V next to a pin labelled 3.3V
Put the positive wire of the multimeter on the 5V pin and the negative wire on the GND labeled pin. Make sure the multimeter is set to volts range 0...10.
You don't need an oscilloscope for simple Arduino projects, but a multimeter is a must....
Hi. I meant to reply sooner but my trip ended up being longer than expected. I made my schematic on Canva so it doesn't look amazing but it does show how I wired everything. If there is another software you can recommend to make a schematic I will re-make it. For now this is what I have. The circles on the left represent push buttons. I soldered all the negative leads into 1 wire, same for the LEDs. And the reason the rx and tx isnt connected to rx and tx 1 is because when it was connected, I was not able to upload the code so I moved them to rx1 and tx1. That seemed to do the trick.
Hi, I really only used 1 resistor in this build...I didnt realized I needed them for the LEDs. Why would I need them. And to answer your question, I don't believe the MP3 player would do anything without an input.
So I found out there was no voltage going through so I checked the batteries....they all have about .20 V which I think could be the problem. Im replacing the batteries now. Will update.
There is KiCad, a great package that will take you from schematic capture to the Gerber files needed to make a PCB. Price Free but they ask for a non-required donation. It is a full package, not limited.