Introduction: The Fortune Tell-me-nator: How to Build a Terminator (as a Mechatronic Face)
This is a mechatronics project that I built for an undergraduate mechanical engineering research class. I chose to build the terminator's face as I found it to fit perfectly on theme, and used a Arduino to carry out the electrical operations. Feel free to use raspberry pi, other similar models as you feel comfortable, mechatronize other personalities, celebrity or not!
In this latest 2023 version of the terminator, the terminator doesn't just terminate, but he can also tell you your fortune! The face is designed to move its jaw, and interact with a user through a color sensor. On being connected to a power source, the program is designed to ask a question to the user, to which the user replies by holding up a red or green color paper in front of the terminator. The red paper indicates, 'no' as an answer, while the 'green indicates' a 'yes' as a an answer. All questions are framed in a way that each of them can be answered with a 'yes' or a 'no'.
This was an incredible learning experience of 12 weeks, one that I genuinely enjoyed building. Follow along to have a mechatronic face that can perform any task your creativity allows you to conjure!
Supplies
The following is a list of supplies used in this project. Components can be swapped with alternatives that can execute similar functions:
- Cardboard
- Scissors
- Tape
- A print of the face to mechatronize
- Arduino Uno R3 Controller
- USB Cable
- A Breadboard
- 2 x 9G Servo Motors
- A HC-SR04 Ultrasonic Sensor
- Jumper Wires
- 24 Male to Male wires
- 7 Female to Male wires
- Color Sensor TCS 3200
- 4Ω 3W Speaker
- NPN Transistor (PN2222)
- 2 Bread twist ties/Garden twist wires
- Red and Green Color paper/Shade Cards
Step 1: Supporting Structure + Actuating Servos + Sensing Ultrasonically
The first step in this project was to hold the terminator's printed face in place, along with the initial components--2 servos, an ultrasonic sensor, a breadboard, a USB Cable, and the controller. An old cardboard was was flattened to create a base, to hold the components above. The print of Terminator's face is held upright and perpendicular to this base, via a cardboard cold drink holder.
The lower jaw was cut out and stuck to a smaller, separate cardboard piece, to allow for jaw movement. This lower jaw is to be attached to the servo motors. This attachment is required to be done in a manner that allows for radial motion, creating the idea of a moving/talking mouth.
An old tea powder box is placed horizontally on the back of the face to mount the servos at the required height so the lower jaw can be attached. The servos are secured on the box with packaging tape. The servo motors are attached to the lower jaw using two Bread twist ties or Garden twist wires. The ultrasonic sensor along with the breadboard and remaining components are placed on the cardboard base.
This setup, i.e., the jaw is programmed to move an angle of 45° from its resting position when the ultrasonic sensor is triggered. The sensor is triggered when it senses objects less than 21 cm. The sensor and the motors are coded to move in conjunction in one .ino file.
Alternative:
I have used two motors here, one would also do the job.
Step 2: Attempting Audio + How the Terminator Talks to You
The project was planned so that Terminator has a voice, and it could interact with the user asking questions and making predictions via audio. This could not be executed in full due to the size of the audio files (stored as large arrays) exceeding Arduino's memory storage capacity. With the exception of this issue, and a low volume on the audio output, the audio system worked well and served its function. The following description can be used as a guide in setting up an audio system with these 2 challenges. The description can also be used for setting up audio systems without those 2 challenges or on overcoming those 2 challenges.
The 4Ω 3W speaker I had had to be welded on its terminals. I had access to my universities workshop/makerspace to carry out this task. This speaker requires an NPN transistor to be connected in parallel with it. The transistor acts as an amplifier here. Without the transistor, there would be no audio heard.
The terminator was designed to interact with the universities' faculty and students, hence the questions and predictions are geared in that direction. There are nine questions and statements (predictions and dialogues) that were recorded stored as audio mp3 files, then encoded as audio arrays to be used in the main code. A wireframe of the logic/interactions is pictured above. There are 9 different quotes in the wireframe, some of which are repeated, as can be observed.
There are 2 dialogues, "I will be back" and "Hasta La Vista, Baby" sourced as mp4 from youtube then converted to mp3 files via an online converter. The rest of the 7 audios were recorded in my own voice using a 'celebrity voice changer' app then modulated to a seeming robotic, Arnold-as-Terminator sounding voice. Once all the audios were converted to mp3, audacity was used to make any further edits to the audio files, change their frequency to 8000 Hz and their format to 16 bit PCM (These are required). These 9 mp3 files were then encoded (converted from mp3 to arrays to be used in main code) using encode.exe. The link to download these softwares, and further details to follow through these procedure are detailed in the youtube video linked above.
A few audio files may be used to test the setup thus far; 9 audio files, however, will trigger an error message indicating that Arduino is out of memory.
With the given time constraints, and the challenge with memory, the entire audio system was unable to make it to the current version of the project, hence, the same could not be presented as part of a final presentation for the research course. I got around this by using the serial monitor to output the 9 questions/statements, and the users interacted with the terminator via the serial monitor during the presentation instead.
Step 3: Communicating With Color (How You Talk to the Terminator)
The color sensor is how the user interacts with the terminator, or how they respond to the questions posed by the terminator. The color sensor is programmed to read red and green colors only. A TCS 3200 Color Sensor was used in this project to serve this purpose. The red and green color papers used in this project were just prints of colors from google images (For e.g., An image of the color red was copied and pasted into word and printed).
When a user holds up the red paper in front of the of the color sensor, the program is coded to identify that specific shade of red in the room's specific lighting (This matters) and interpret it as a 'no'. Similarly, green is interpreted as a 'yes'. It maybe helpful to review the flow of logic as presented in the wireframe again at this point in the step (Picture in step 2).
The following algorithm displays the R (red) and G (green) coordinate values that were coded for the program to interpret my printed red/green image on paper in the room's lighting as red/green. The B (blue) coordinate is assigned a zero in identifying both red and green:
For the color "green",
The green value should be between 100 and 160.
The red value should be greater than 140.
For the color "red",
The red value should be between 65 and 95.
The green value should be greater than 140.
Step 4: Challenges Encountered
The following are some challenges I encountered through the course of this research project.
- Memory issue with Arduino: I had 9 audio files (some predictions and some questions) to be used through the course of the program run to interact with the user. These audio files were stored as large arrays. On trying to implement these into the wireframe of the if-else conditions and running the code, an error message stating that Arduino ran out of memory by a couple 1000 bytes, prevented me from going ahead with using the audio, hence the speaker, as output devices for the terminator's Questions/Predictions.
- Speaker's Volume: I tried testing the speaker with a smaller audio file to ensure the memory was the sole issue, and to check if everything else was fine. The connections and code were all running smooth, however, the audio output was faintly audible. This seems to be a limitation of the speaker.
- Inadequate Servo Motor: One of my servo motors was weaker and slower than the other. This made for a disproportionate Jaw movement. It was also relatively harder getting the two servos synchronized so they moved at the same time with similar torque.
Step 5: Future Directions and Suggestions
Here are some troubleshooting tips to the challenges posed above and any suggestions one can implement in this project to further improve on the current product:
- Since the audio mechanism failed, I used the serial monitor in the Arduino Software to Output Terminator's Questions and predictions.
- Another controller maybe used to increase memory storage capacity of the whole circuit setup in Arduino
- A Raspberry pi maybe better suited to be used for this project in regards to this memory issue.
- On the other hand, if one wanted to continue with the existing system, an idea that maybe worthwhile to try and increase the volume, is to introduce a Bluetooth module to the circuit which then maybe connected to a regular home/portable speaker.
- Currently, the code for the color sensor (interacting with user) and the code that enables jaw movement via the sensor are separate files. They maybe combined for cohesion.
- On the note of continuing with the same system, audio files i.e., interactions maybe shortened and reduced to a memory size Arduino can handle. A moving jaw while outputting related audio, (whether or not it maybe the questions/predictions initially planned) perhaps a soundtrack from the movie, simultaneously displaying the planned questions/predictions via the serial monitor may make for a more cohesive interaction plan and user experience.