Week 8
Benjamin Williams - Mon 4 May 2020, 7:55 pm
Modified: Fri 19 June 2020, 1:29 pm
Prototype #1
This week I picked up the borrowed df mini player and speaker parts from Clay. Now I could finally get started on my speaking robot.
I borrowed Mum's laptop to copy some test mp3 files to the micro sd card.
A helpful tutorial showed me how to connect a df mini player to an Arduino. The circuitry was actually pretty straightforward so I didn't have any troubles getting my code to use the speaker.
I used a df mini player library in my Arduino code. The library provided a bunch of functions for manipulating the speaker settings and navigating around the sd card files. The most helpful function was the playFolder function which allowed me to specify a folder and file index to easily select a sound to play. Some better file organisation would make this more efficient, however doing so caused some issues. I can't get output when I store audio files in folders so for the time being I've just dumped everything in root. Further down the line I'd like to sort the files into phases of sassiness. Currently, I can only get it to play one sound.
void loop()
{
static unsigned long timer = millis();
if (millis() - timer > 10000000) {
timer = millis();
myDFPlayer.loop(1); //Loop the first mp3
}
if (myDFPlayer.available()) {
printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
}
}
Here are it's first words <3
Reflection
This week saw the creation of my first Sassbot prototype! I didn't manage to get the folders working but the robot speaks nonetheless. Next week I'd like to get my folders working and have some code that runs a smooth demonstration of the robot speaking. I'm also going to build a simple casing to give the robot a face and most importantly a mouth.