JARVISify Alexa
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.
Supplies
Circuit Diagram
Please connect the components as per the circuit diagram shown above. Please make sure to connect all the Positive wires and negative wires of the circuit together and use them to power up the project.
Arduino Libraries
To make the project work, you need two libraries one for the "Offline Voice Recognition module" and the other for "DF Player mini". I am unable to upload the zip file of libraries here but you can download the same from here: https://electroboffin.com/curiosity-sparks/jarvisify-your-alexa/
Audio File
You will need an audio file that you will save to the Micro SD Card that will go to DF Player mini. In my case, I have changed the name of my Amazon Echo Dot to "Echo" rather than the default "Alexa" which can also be done by going to the Amazon Alexa mobile app. If you have also changed the name to "Echo" like I did. Otherwise, you can either record an mp3 with your voice saying the wake word (Alexa, Echo, Hey Google, Hey Siri, etc...) or use any online text-to-speech convertor website to achieve the same results.
Make sure to change the name of the audio file to "01.mp3", only then it will work. Please note that if you are thinking of changing the name in the code as per the audio file name, it won't work, DF Player Mini only supports the numerical file names.
Downloads
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);
}
Downloads
Custom Wake Up Command
Once you are done uploading the code, now you have to add your custom wake-up word to the DF Robot's Offline Voice Recognition module by following the below steps:
- Initiate the voice assistant by employing the default wake-up word which is "Hey, robot"
- Utter "Learning wake word"
- Speak the designated wake-up word to be acquired: "Hey, JARVIS"
- The module will indicate by saying "Learning successfull, please say it again!"
- Speak the designated wake-up word to be acquired again which is "Hey, JARVIS"
- The module will again indicate by saying "Learning successfull, please say it again!"
- Speak the designated wake-up word to be acquired again which is "Hey, JARVIS"
- The module will indicate by saying "OK, Learning completed"
Now the electronics part of the project is done.
CAD Model
If you wanna design your 3D Model for an enclosure, you might need the CAD Model that I have used. Here are all the links to CAD Models.
- Amazon Alexa Echo Dot Gen 3: https://grabcad.com/library/amazon-alexa-echo-dot-3-0-1
- DF Player mini: https://grabcad.com/library/dfplayer-mini-3
- Arduino Nano: https://grabcad.com/library/arduino-nano-ch430g-1
- DF Robot Offline Voice Recognition module: https://electroboffin.com/product/eb24001/
Slicing
Download the below stl file and by using any of your favorite Slicing software, slice it. I have used Prusa Slicer and the following are the details that you are looking for
- Bed Temperature- 60C (Room Temperature- 10C)
- Nozzle Temperature- 210C (Room Temperature- 10C)
- Support- Yes(Organic)- On build plate only
- Infill- 15%
- Nozzle- 0.4mm
- Layer height- 0.2
If you need to edit the 3D model of the same please comment, and I will share the step file :)
Downloads
3D Printing
3D Print the slice model and here are the details that you might need:
- Material- PLA+
- Time to Print- 3hr 49min
- Material weight- 45.36g
Assembling
The assembly is very straightforward, just follow the circuit diagram and you are good to go. The only thing you have to keep in mind is to connect the Power cable and the speaker at the end by inserting their wires from the circular holes provided. Rectangular holes are for the microphones of the Offline Voice recognition module. There is a slot provided inside on the back of the rectangular holes section and that's for the Gravity connector.
Place your Alexa Echo Dot Gen 3 on the top and stick the speaker on one of the 4 microphones of the Echo Dot as shown above.
Enjoy!!
You are good to go to do wonders with your JARVISified Alexa!!
Happy Tinkering🚀