We all Love Iron Man's JARVIS and might have sometimes tried to build one by ourselves. How do I know? because I also tried that too😂. Building a JARVIS is more like a Software project and I love more hardware than software when I noticed that I already own an Amazon Alexa, I just needed to change its name. After spending weeks, I found that the name could not be changed. So, I thought why not add external hardware that can take a custom command and speak out Alexa at a very low level to activate it!
And that's exactly what I did.
STEP 1
Connect all the components as per the circuit diagram
STEP 2
Upload the code
CODE
/*Love the project? Consider Supporting :)
https://www.linktr.ee/padmalaya_rawal */
#include "DFRobot_DF2301Q.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
//I2C communication
DFRobot_DF2301Q_I2C DF2301Q;
// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Create the Player object
DFRobotDFPlayerMini player;
void setup() {
Serial.begin(115200);
// Init serial port for DFPlayer Mini
softwareSerial.begin(9600);
// Start communication with DFPlayer Mini
if (player.begin(softwareSerial)) {
Serial.println("OK");
// Set volume to maximum (0 to 30).
player.volume(15);
// Play the first MP3 file on the SD card
player.play(1);
} else {
Serial.println("Connecting to DFPlayer Mini failed!");
}
// Init the voice reognition module
while( !( DF2301Q.begin() ) ) {
Serial.println("Communication with device failed, please check connection");
delay(3000);
}
Serial.println("Begin ok!");
DF2301Q.setVolume(2);
DF2301Q.setMuteMode(0);
DF2301Q.setWakeTime(15);
uint8_t wakeTime = 0;
wakeTime = DF2301Q.getWakeTime();
Serial.print("wakeTime = ");
Serial.println(wakeTime);
// DF2301Q.playByCMDID(1); // Wake-up command
DF2301Q.playByCMDID(23); // Common word ID
}
void loop() {
// Check for CMID from DF2301Q
uint8_t CMDID = 0;
CMDID = DF2301Q.getCMDID();
if (CMDID == 1 ) {
Serial.println("Specific CMID detected, playing audio file 1.mp3");
player.play(1);
// You can add additional logic or commands here as needed
}
delay(500);
}
STEP 3
Detailed article with all files
Detailed instruction guide along with required Arduino libraries, STL file for 3d printing, and audio file for Micro SD card can be found here:
https://electroboffin.com/curiosity-sparks/jarvisify-your-alexa/
STEP 5
All Done! Enjoy as I'm doing😁
License
All Rights
Reserved
2