Assembling The Electronics
In part one of this tutorial I will walk though assembling the electronics for our Max Trollbot action figure. If you would like to check out the final version of our Max Trollbot action figure, check out the video here.
Parts and Tools Required:
To get started, here is a list of parts and tools that you will need to build our action figure.
- 2 x 5mm Light Emitting Diodes (LED) - These LEDs are used for the eyes of our action figure.
- 1 x Arduino Uno - The Arduino is going to be the brain for our action figure.
- 1 x Adafruit Wave Shield for Arduino - This shield will be responsible for playing the voice of our action figure whenever a button is pressed.
- 1 x SD Memory Card - The memory card will hold the voice recordings for our action figure.
- 2 x 2.1 kOhm Resistors
- 1 x Speaker
- 1 x Battery Holder
- 1 x Momentary Switch
- Soldering Iron
- Soldering Wick - Just in case you need to rework something while assembling the boards.
- Wire Cutters
- Needle Nose Pliers
Assembling The Circuit:
To begin assembling the electronics we first need to assemble the Wave shield Kit. Adafruit has a great tutorial on how to assemble the wave shield kit here.
Once the shield is assembled we will need to make a few modifications to the shield so that it will be easier to use in our action figure. First, solder a header to the external speaker output on our wave shield. I chose to put a header instead of soldering the speaker directly to the board so that the speaker can be detached easily, but if you want a more permanent connection, the speaker can be soldered directly to the board.
Next, add a jumper wire from the header that is used to attach to the speaker to analog input pin A5 on our Arduino. This jumper will be used to trigger the LED eyes of our action figure whenever the action figure speaks. The choice of analog pin can be different than A5, but the programming code in the later section will have to be modified to take this into account.
Next add wires to digital pins 6, 7, analog pin A0 and the ground pin. These wires will connect to the LED eyes of our action figure and also the push button switch that will cause our action figure to speak. make sure to make these wires a long enough length so that they will be easy to work with when assembling the electronics inside our action figure later.
Before assembling the final circuit inside our action figure it is always a good idea to breadboard the circuit in order to make sure everything is working correctly. place the two LEDs into the breadboard. be sure to keep track as to which leg of the LED is the negative lead or cathode. The cathode is usually the shorter leg of the two legs on the LED. The cathode of the LED will be connected to the ground pin of the wave shield.
The positive lead or anode of each LED will each be connected to one of the 2.1 kOhm resistors. Resistors do not have a direction or polarity associated with them so any of the two leads can be connected to the LED.
Next, connect the push button switch that will activate our action figure to the bread board and connect the resistors to digital pins 6 and 7 on the wave shield.
Connect the speaker to the speaker header of the wave shield if you did not solder the speaker directly to the board in a previous step.
Finally wire up the push button switch that will cause our action figure to speak. The lower left terminal of the switch will be connected to the analog input connection on the wave shield. The top right terminal of push button switch will need to be connected to ground. These connections will allow the push button to pull the analog input low whenever the switch is pressed.
Program The Electronics:
To begin program the electronics you will need to do the following steps before you can upload the code and get the action figure talking:
- Install the necessary Arduino libraries.
- Format and load audio files on SD card.
- Compile and upload to Arduino.
At the Adafruit website there is a great tutorial on how to download the WaveHC libraries and install them into our Arduino IDE. There is also a great explanation on how to format the SD card correctly and load our audio files. I have compiled a number of Max Trollbot quotes that can be loaded onto our SD card. The zip file that contains these files can be download here. After these libraries are installed and the SD card is loaded with audio files, compile and upload the code to your Arduino. Once the code is uploaded press the button and see if there is any sound coming out of the speaker and the LEDs light up.
If everything is working properly great job! If something is not working properly, go back and check all of the connections. Also try turning up the volume on the wave shield. You have completed the circuit for our action figure. In part two of this tutorial I will walk through assembling the electronics into the body of Max Trollbot.