STEP 1: Getting to Know the Components
In this step I give some important information about the robot’s components and how to prepare them for mounting.
In the first place, the heart of the robot: an Arduino UNO R3. Although I am using an Arduino UNO, you can use other Arduino boards to mount your robot. I decided to use an Arduino UNO because it is, by far, the most popular Arduino board and more people would be able to rebuild this robot. If you have an Arduino DUE, you can also add voice responses to your robot as I did in this post.
To move the DC motors, I used this Pololu shield. It is a dual motor driver capable on controlling 5 to 28V DC motors and deliver up to 3A continuous current per motor. Although I think this is a very good shield, what impressed me the most in Pololu’s products is their clear and detailed documentation. Besides, Pololu provides an Arduino library that makes really simple to control the motors. You just have to pass the speed and direction (negative or positive values) to the setSpeeds function. If you opt to use another DC motor driver, pay attention to the pins used by the driver because they cannot conflict with any other pin used by the robot. The Pololu shield uses the following Arduino pins: digital 4, 7, 8, 9, 10 and 12; analogic 0 and 1; ground; and 5V. The most important aspect here is that only pins 9 and 10 are used as PWM pins and the timer used to generate pulses on these pins is not the same timer (timer 2 on the UNO) used by the BVSMic class from BitSophia.
To establish communication with the server and access BitVoicer Server services, I use the Microchip WiFi RN171VX module. Two main features stand out in this module: all communication can be done through the serial port in a simple manner; and the module has the same form factor as most of the popular XBee modules. In other words, if you already have an XBee shield, you most likely will not need to buy the Sparkfun shield I use in this robot.
Using the XBee shield with the Microchip WiFi module made mounting the robot pretty easy. However, I have identified a problem in this combination. It is known that working with radio is extremely complex and considered by some people as “voodoo magic”. Well, I noticed that while the WiFi adapter is on and transmitting data, a strong interference occurs in the audio signal measured by the Arduino ADC. I was not able to precisely identify the source of this interference, but I have two possible sources: the module peak current draws (up to 240mA) are not being properly decoupled and compromise the reference voltage provided to the Arduino ADC; or the signal emitted by the antenna is being picked up by some exposed pins right below the module. Usually, WiFi module manufacturers instruct designers to avoid placing anything (even ground planes) near the antenna precisely to prevent this kind of issue.
To correct the problem described above, I soldered a 3.3V voltage regulator and one 10μF electrolytic capacitor to the Sparkfun shield so they could provide the reference voltage to the Arduino ADC. The same power source is used by the Sparkfun electret microphone. It solved the peak volume problems I was seeing in the BitVoicer Server Manager. Even during silence periods, the audio level was getting as high as 35 (0-100) in the Server Monitor. If you see the same thing happening in your project, investigate what is going on with the audio signal measured by the Arduino ADC.
I decided I was also going to use the prototyping space available in the Sparkfun shield to solder a few LEDs that tell the status of some BitVoicer Server functionalities. In the picture below, from the left to the right, the following information is exposed by the LEDs:
- Indicates whether BitVoicer Server is running and/or if the connection remains active;
- Indicates whether the data forwarding service is running;
- Indicates whether a speech recognition engine has been assigned to the Arduino;
- Indicates whether we are in the activation-word-activated-period. This LED lights up only when the activation word is identified.
Regarding the preamplified electret microphone, there are many options available in the market: Sparkfun, Adafruit, RoboCore, Hackerstore and probably many others. To use the code I am posting on this tutorial, make sure the microphone you are buying is analogic, the required voltage is available in your Arduino board, and the amplification is high enough (usually 100x for electret microphones) for the Arduino ADC.
The 2WD chassis used in the robot is one of the cheapest and most popular on ebay. The complete kit contains one acrylic platform, two plastic/rubber wheels, one 360º wheel, two DC motors with gear (1:48 ratio), one 4xAA battery holder, two speed encoder disks and a set of screws.