Electronics: Arduino Welder with Sound

In the process of expanding my knowledge and experience with Arduino microcontrollers I’ve taken the base circuit for the welder I created and added sound. To do this I used a small board called DFPlayer Mini. This provides a direct output for a speaker or left / right channels. It also has a mini SD card port for your mp3 or wav files. See the details inside.

Enhancing the circuit was fairly easy. Since the tactile switch was still connected for the led to light up, I added the play logic to that if statement. The only other items I added were two libraries, SoftwareSerial and DFPlayer_Mini_Mp3, and it basically worked. One problem I found was that since the DFPlayer uses serial to operate and I was using the Rx0 and Tx0 pins on the Arduino, when I tried to upload the sketch if the pins were plugged in, then the upload would fail. I could probably use secondary Rx/Tx pins.

// Welder with push button and sound
// Author: Michael Peters Bond - Merrimack Valley Railroad

#include 
#include 

int LED = 12;
int BUTTON = 4;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT);
  Serial.begin (9600);
  mp3_set_serial (Serial); //set Serial for DFPlayer-mini mp3 module 
  mp3_set_volume (15); // 0 - 30 volume
}

void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(BUTTON) == HIGH)
  {
     mp3_play (1);
     int i,count;
     //count=random(10,60);
     for (i=0;i<95;i++)
     {
      digitalWrite(LED, HIGH); // set the LED on
      delay(random(60));
      digitalWrite(LED, LOW); // set the LED off
      delay(random(200));
     }
  }
  else
  {
    digitalWrite(LED, LOW);
  }
}

Here is the Fritzing image of the previous Arduino welding circuit with the DFPlayer Mini and speaker hooked up.

Welder with Sound

Arduino welder now with DFPlayer Mini to generate sound.

Get your own DFPlayer Mini here.

3 Comments, RSS

  1. Leo Jørgensen

    Hey.
    The welding light and audio, is just what i have been looking for. I would however need it to start randomly, and run for at random time.
    Thanks for sharing.
    Your code and setup is a good place or base for me to start at.
    And if I can’t figure it out, I know who to ask.

  2. Floyd Kennedy

    I keep getting the error “mp3_set_serial” was not declared in this scope. I follwed the code step for step. I am using what you did for a Star Wars blaster Im working on and I was able to play with your Welder code until I got a satisfied blaster flash. I already have the blaster sound fx on a micro sd card. so i thought this would be perfect to add the sound. Also is there suppose to be a command by #include at the beginning? Thank you for your help.

  3. Floyd Kennedy

    Hello,
    Thanks for your videos. They help quite a bit being I’m a beginner. I was successful with the “Welder” code and circuit. I was able to play with the code until I got a satisfactory blaster flash when I push the button for a project I’m working on. After that I wanted to try the one with sound since the code was similar but I keep getting the
    ‘mp3_set_serial’ was not declared in this scope.
    ‘mp3_set_volume’ was not declared in this scope.
    errors. Any idea what maybe causing this? Thank you for your help.

Your email address will not be published. Required fields are marked *

*