When I first started making Death Trooper helmets I began looking for a simple solution to adding sound and lights to the helmet. I also wanted to add sound and lights to my E-11D blaster. There were a number of solutions out there, but they all involved a lot of wiring and soldering. So I decided I wanted to make an easy to use little board that would combine together a small Arduino board with SD card reader and MP3 player. The result is our PAD Sound and Light Board. Truth is there isn't anything truly revolutionary about it, its just simple and easy to use in a pretty small package. Its also ver versitle so it can be used in any number of situations where you want to sink a sound file with an LED light.
The board is available in our store for $35. Add lights, a speaker, a few switches, and 5V powe supply and your ready to rock and roll.
Note that if you use use bare LEDs, then you will need to add in resistors onto the board. There are spots for them. If you use LEDs that are prewired with resistors already, then you need to add a wire jumper accross this section.
Power
The board requires a 5V power supply such as that from a USB port. My favorite power source is these littel cyclinder rechargable USB power packs. (Do not use more than 5V or you can blow out the sound board.)
Another great solution is a little power board that will accept both 9-12V and convert it down to 5V. I use a 12V system in my DT armor so I added in one of these little boards. The can be found on Amazon here.
The Arduino board comes pre-programmed with simple code that can be used for a blaster or for cycling through sounds in a helmet. But if your a bit more advanced here is the code so you can modify it to do a lot more. I'm posting this code under the Creative Commons license. All I ask is that if you modify it to do something else cool, you will share it with me so I can post it here as well for others. You will also need the sound board libraries which can be found here.
(https://github.com/DFRobot/DFRobotDFPlayerMini/archive/1.0.3.zip)
Sound Board Code
(Copy everything between the +++)
++++++++++++++++++++++++++++++++++++++++++++
/***************************************************
Plastic Arms Dealer Sound and Light Board
V1
April 5, 2018
Andrew McClary
Copyright 2018 All Rights Reserved
****************************************************/
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(8,9); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
int pinButton = 12; //the pin where we connect the button
int voiceButton = 11; //the pin where we connect the button
int lightButton = 10; //the pin where we connect the Snout Scanner button
int scanButton = 13; //the pin where we connect the Side Scanner button
int LED1 = 6; //the pin we connect the Blaster LED
int LED2 = 7; //the pin we connect the Blaster LED
int LED3 = 4; //the pin we connect the Side ScannerLED
int LED4 = 5; //the pin we connect the Snout Scanner LED
int fireSound = 1;
int voiceSound = 1;
int lightOn=0;
int snoutlightOn=0;
void setup()
{
mySoftwareSerial.begin(9600);
Serial.begin(115200);
pinMode(pinButton, INPUT_PULLUP); //set the button pin as INPUT
pinMode(voiceButton, INPUT_PULLUP); //set the button pin as INPUT
pinMode(lightButton, INPUT_PULLUP); //set the button pin as INPUT
pinMode(LED1, OUTPUT); //set the LED pin as OUTPUT
pinMode(LED2, OUTPUT); //set the LED pin as OUTPUT
pinMode(LED3, OUTPUT); //set the LED pin as OUTPUT
pinMode(LED4, OUTPUT); //set the LED pin as OUTPUT
Serial.println();
Serial.println(F("Plastic Arms Dealer Blaster Sound System V beta 1"));
Serial.println(F("Initializing Sound Player ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(mySoftwareSerial)) { //Use softwareSerial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true);
}
Serial.println(F("Plastic Arms Dealer Blaster Sound System online."));
Serial.println(F("Folder 1."));
Serial.println(myDFPlayer.readFileCountsInFolder(1)); //read fill counts in folder SD:/1
Serial.println(F("Folder 2"));
Serial.println(myDFPlayer.readFileCountsInFolder(2)); //read fill counts in folder SD:/03
Serial.println(F("Folder 3"));
Serial.println(myDFPlayer.readFileCountsInFolder(3)); //read fill counts in folder SD:/03
myDFPlayer.volume(30); //Set volume value. From 0 to 30
//Play startup sound
myDFPlayer.playLargeFolder(03, 1);;
}
void loop()
{
static unsigned long timer = millis();
int stateButton = digitalRead(pinButton); //read the state of the button
int callButton = digitalRead(voiceButton); //read the state of the button
int snoutButton = digitalRead(lightButton); //read the state of the button
int scanButton = digitalRead(scanButton); //read the state of the button
//Check for Fire button
if(stateButton == LOW) { //if is pressed
//Serial.println(F("Fire button Pressed"));
//Play the sound file
//myDFPlayer.next(); //Play next mp3
myDFPlayer.playLargeFolder(02, fireSound);
printDetail(myDFPlayer.readType(), myDFPlayer.read());
delay(100);
//Flash the leds
digitalWrite(LED1, HIGH); //write 1 or HIGH to led pin
delay(200);
digitalWrite(LED1, LOW); //write 1 or HIGH to led pin
delay(100);
digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
delay(100);
digitalWrite(LED2, LOW); //write 1 or HIGH to led pin
delay(50);
digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
delay(200);
digitalWrite(LED2, LOW); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
delay(50);
digitalWrite(LED2, HIGH); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
delay(100);
digitalWrite(LED2, LOW); //write 1 or HIGH to led pin
//Change the blaster sound
fireSound++;
Serial.print("Fire Button Pressed - ");
Serial.print(fireSound);
if (fireSound >= 10){
fireSound = 1;
}
}
//Check for Voice activation button
if(callButton == LOW) { //if is pressed
//Play the voice file
myDFPlayer.playLargeFolder(01, voiceSound);
printDetail(myDFPlayer.readType(), myDFPlayer.read());
Serial.println(F("Voice button Pressed - "));
delay(3000);
voiceSound++;
Serial.print(voiceSound);
if (voiceSound >= 21){
voiceSound = 1;
}
}
//Check for scanner buttons
if(scanButton == LOW) { //if is pressed
Serial.println(F("Scanner Lights Pressed"));
if (lightOn==0) {
lightOn=1;
//Flash the leds
Serial.println(F("scanner on"));
digitalWrite(LED3, HIGH); //write 1 or HIGH to led pin
delay(200);
}else {
lightOn=0;
Serial.println(F("Scanner off"));
digitalWrite(LED3, LOW); //write 0 or LOW to led pin
delay(200);
}
}
//Check for scanner buttons
if(snoutButton == LOW) { //if is pressed
Serial.println(F("Snout Scanner pressed"));
if (snoutlightOn==0) {
snoutlightOn=1;
//Flash the leds
Serial.println(F("Chin Scanner on"));
digitalWrite(LED4, HIGH); //write 1 or HIGH to led pin
digitalWrite(LED3, HIGH); //write 1 or HIGH to led pin
delay(500);
}else {
snoutlightOn=0;
Serial.println(F("Chin Scanner off"));
digitalWrite(LED4, LOW); //write 0 or LOW to led pin
digitalWrite(LED3, LOW); //write 0 or LOW to led pin
delay(500);
}
}
} //END Loop
void printDetail(uint8_t type, int value){
switch (type) {
case TimeOut:
Serial.println(F("Time Out!"));
break;
case WrongStack:
Serial.println(F("Stack Wrong!"));
break;
case DFPlayerCardInserted:
Serial.println(F("Card Inserted!"));
break;
case DFPlayerCardRemoved:
Serial.println(F("Card Removed!"));
break;
case DFPlayerCardOnline:
Serial.println(F("Card Online!"));
break;
case DFPlayerPlayFinished:
Serial.print(F("Number:"));
Serial.print(value);
Serial.println(F(" Play Finished!"));
break;
case DFPlayerError:
Serial.print(F("DFPlayerError:"));
switch (value) {
case Busy:
Serial.println(F("Card not found"));
break;
case Sleeping:
Serial.println(F("Sleeping"));
break;
case SerialWrongStack:
Serial.println(F("Get Wrong Stack"));
break;
case CheckSumNotMatch:
Serial.println(F("Check Sum Not Match"));
break;
case FileIndexOut:
Serial.println(F("File Index Out of Bound"));
break;
case FileMismatch:
Serial.println(F("Cannot Find File"));
break;
case Advertise:
Serial.println(F("In Advertise"));
break;
default:
break;
}
break;
default:
break;
}
}
+++++++++++++++++++++++++++++++++++