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

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

*