How I Made SCR4P-E the robot
It is Secret Santa v2020 and this year I got James Bruton soooo I made him a robot that has high functioning depression and anxiety because it just went through 2020... Here’s how:
ingredients
2 Arduino UNOs
1 Wave Shield to play the sounds
1 DC stepper driver
1 connectors for the battery
1 Real-time clock memory module
1 Seven segment display module
1 Micro motor
1 Servo motor
The speakers and phone toy were recycled.
THE VOICE
I HAD TO give SCR4P-E a voice. So to play “Why was I programmed to feel pain?” I used Adafruit’s Wave shield that I had laying around from my Robo-Suit from a few years ago and an Arduino UNO. Adafruit has a tutorial with sample code in their website to play the wav files.
HOWEVER, the tutorial is outdated if you have a Mac. So here is what I did to convert the mp3 to the right WAV 16KHz, 16-bit, mono PCM settings.
It was actually very easy once I figured it out:
Open iTunes (now known as Music)
Go to Preferences and under the Files tab, click on the Import Settings button
Change Import using to: Wav enconder
Change Settings to: Custom
Change Sample Rate to: 22.050 kHZ
Change Sample Size to: 16-bit mono
And chnage Channels to: mono
Hit ok, ok, and ok.
Now you can convert your mp3! Select the song in iTunes (you have to click outside the song box and drag the cursor into the box to select it, just clicking on it does not select it..) Once selected go to File / Convert / Create WAV Version.
And it is done! You can find your wav file in: /Users/yourusername/Music/iTunes/iTunes Media
All you have to do is into an SD card and put it in the Wave Shield.
To create SCR4P-E’s voice I use text2speech.org :)
the BRAIN
The rest of the robot was fully controlled by the other Arduino UNO. The tank’s DC motors, the micro motor to move the eyes, the time module to calculate the sate, the display segment to display the counter, and the servo motor to move the phone’s receiver.
DC MOTORS
The driver I used for the motors was great. I was mostly satisfied by the fact that I could input the 12v battery to it and get 5v out to power other stuff. I used this tutorial: https://lastminuteengineers.com/l298n-dc-stepper-driver-arduino-tutorial/
The #1 takes the 12v, and the #3 outputs the 5V. Cool.
Both Arduinos, the RTC clock memory module, and the mini motor all used the 5V from this driver.
The code
NOW TO THE FUN. You can find all the code in the link below:
https://github.com/estefanniegg/YouTube/tree/master/builds/scr4pe_the_robot
I tried adding as many comments as I could, I am very low on sleep so I will come back to this blog post and add more about the code later, in the meantime, hack away!!
HOLDING IT TOGETHER
In addition to a LOT OF GLUE, I had to 3D model stuff to stack the Arduinos on the tank, to hold the eyeballs of the robot, and to hold the phone’s receiver. I did it all with Tinkercad which is free and easy to use. Way quicker, dirtier, and easier than Fusion 360. I highly recommend it for fast prototyping ;)
Let me know in the comments if you want me to add these to Thingyverse for you to print.
FYI
The servo motor and the wave shield interrupted each other since they shared ground and the wave shield uses PWM pins ~9 and ~10 which created absolute havoc when using servos that pull all the current. The point is I didn’t mind they interrupted each other because it made SCR4P-E glitchier and that is the “look” I was going for.