The Arduino is capable of a lot, but sometimes it needs a little help. Shields and modules are two types of circuit boards that you can use to expand the capability of your Arduino, and hence, your robot. There are countless shields and modules out in the world that perform more functions than you can imagine. This project obviously cannot cover even a fraction of them.
Instead, we will be focusing on two in particular. The first is an Arduino shield that processes DTMF tones (a.k.a. telephone touchtones). The second, is a microphone module. We are going to use the two of these together to control the robot over Skype. When touchtones are made by pressing the keypad in the Skype software, the robot will respond and move accordingly.
An arduino shield is a special circuit board that plugs in on top of the Arduino and adds special functionality to it. It gets it's name because it is a little bit like the board is holding a shield in front of itself as protection.
People make all kinds of shield to expand the functionality of the Arduino. It is basically like making a special circuit to do something very particular, and then attaching it directly to the Arduino. Given that there are an endless numbers of circuits that you can connect to the Arduino, there are also countless shields out in the world performing a wide variety of functions.
We will be using a DTMF shield to interpret and process DTMF tones. This may seem foreign, but DTMF tones are basically just telephone touch-tones. DTMF stands for "dual tone multi-frequency."
The reason I have decided to control the robot via touch-tones is that they are highly proven technology. For decades millions of people around the world have used them reliably on terrible staticy phone lines with little issue. Also, they are generally easy to generate, and can be produced by a number of existing video conference applications (like Skype). We don't need to create any new software to interface with the shield. It's this combination of reliability and ease of use that makes them good for controlling our robot.
Modules, like shields, are boards that connect to an Arduino, and add special functionality. The difference with modules is that they are not Arduino specific. They do not need to plug over top of the Arduino, but can be connected to a number of different controller boards, or sometimes run as a stand-alone device (i.e. all by themselves).
The Ping sensor we used in the previous lesson is an example of a module board. As you begin working with robotics, you will continually encounter all kinds of different modules. Just like with shields, there are countless of them out in the world which perform more functions than you can imagine.
The module we are using in this lesson is a microphone amplifier. It plugs into the DTMF shield to expand it's functionality and allow it to process sound. This is used to 'listen' to the DTMF tone being played out loud through the smartphone speaker and send it to the DTMF shield.
The reason we are using a module instead of just a microphone is that the signal from a microphone in and of itself is typically not high enough for the shield to hear it. We need the module to amplify the signal to be about as loud as the audio signal coming out of the headphone jack of your phone.
To prepare the module, take a servo extension cable and cut off the male header pin connectors. Seperate the remaining red, black and white wire slightly, and strip away a little bit of the insulation on each.
To make it easier to insert the threaded wire through the terminal holes of the module, you can tin the exposed strands of each wire with just a tiny bit of solder.
Solder the red wire to VCC, the black wire to GND, and the white wire to "out."
VCC is one way the power connection in a circuit is often labeled.
In order to plug the shield in, we will need to unplug everything. However, before you unplug everything, STOP!
The first thing you should always do before disconnecting a wire is label it. This is easily accomplished by using a peice of painters tape and a marker. Rip a small peice, and fold it around the wire. Write down what pin the wire is plugged into, and then unplug it.
If you don't label it before unplugging it, you will end up with a tangle of wires that will make no sense to you later. You will then have to figure out which wire is which. This is annoying, takes a long time, and can lead to errors.
Labeling everything will make life remarkably better. Trust me.
So... Label everything and then unplug the wires.
Insert all of the wires that you unplugged into the corresponding sockets on the Arduino shield. They should line up perfectly with the sockets already on the Arduino.
Once all of the wires are plugged in, plug the shield into the Arduino sockets.
Slide a piece of shrink tube around microphone amplifier module.
Heat it up to shrink it into place.
We are doing this because the selfie stick tube is conductive, and we want to prevent any of the module's conductive terminals from shorting together when the module is zip tied to the tube.
Pass the microphone cable's socket through the 3/8" hole in the top of the plastic box and plug it into the microphone header pins on the shield. The white wire should line up with the 'mic' label on the shield.
Everything should be all wired up now.
This would be a good opportunity to zip tie together all of the wires inside of the robot nice and tidy like.
Cleaning up the wire is good form and will prevent unexpected problems.
Again, trust me on this one.
An Arduino library is a collection of Arduino pin assignments and functions designed to perform a specific task. Instead of adding each of the functions individually, we can just #include the library at the top of our code, and call the functions within the library at will.
We have already encountered a library before. We used the Servo Library to setup and control servo motors. This library came pre-installed in the Arduino software, and we did not need to install anything to make it work. The DTMF library, however, does not come pre-installed. So, we need to load the library into the software so that our code can use it.
It is necessary to do this because the DTMF library is required to use the DTMF shield. In fact, many Arduino shields have special libraries required to use them. While installing them is mildly annoying, they will ultimately make your life much easier.
Download the DTMF_Read_Only_Library.zip file.
Install the library by selecting the "Install Library" dropdown from the top menu bar.
Next, select "Import Zip Archive" and select the DTMF_Read_Only_Library.zip file.
And that's it. You're done.
Note that this is a special version of the DTMF library that I have modified to remove the DTMF tone generation capability from the shield. With this library, the shield can only read DTMF tones, as opposed to read and generate DTMF tones. I have done this because we have no reason to generate tones when using our robot, and in order for the shield to have the ability to create tones, it required that pins 2 and 3 of the Arduino be assigned as special outputs. Clearly this is a problem because we are already using pins 2 and 3 for our sensors. Thus, I disabled this functionality in the library. Rather than have these two pins communicate with the shield, I have freed them up to connect our sensors.
Program the Arduino with the following code:
Zip tie the module to the telescoping tube directly above the servo motor.
Clean up the wires once done.
Place your smartphone into the phone holder on the robot.
This robot is controlled through Skype. You will need at least one Skype account and a friend who also has Skype. To test this on your own, you will need to create two Skype accounts.
This also requires a smartphone running the Skype app and a computer running the Skype software.
Open the Skype app on your phone.
On a computer, log in to the Skype software and place a video call to the account open on your phone.
Accept the call on the phone.
Once the two apps are connected, open the dial pad on the computer. This dial pad can be found under the Window dropdown in the top menu bar or launched by pressing Command 2. The dial pad is used for controlling the robot.
When the buttons on the key pad are pressed, it plays a DTMF tone through the smartphone. This tone is sensed by the microphone module and interpreted by the DTMF shield on the robot. The robot then moves depending on which tone is sensed.
The following commands are used to control the robot via Skype:
7: Tilt Camera Up
9: Tilt Camera Down
Share a photo of your finished project with the class!
Nice work! You've completed the class project