A sound effects machine block diagram
Building a sound effects machine is relatively easy as this device only requires four electronic subcircuits, as shown in the following block diagram:
The blocks in the diagram represent the electronic subcircuits.The arrows are the electrical wires connecting to the target electronic subcircuit. The numbers shown with the diagonal lines attached to the arrows tell the number of wires connected to each electronic subcircuit.
The sound effects machine block diagram is an engineering tool used to convey a complete product design using simple graphics. The block diagram also makes it easier to plan the breadboard for prototyping and testing of the sound effects machine in a workshop or laboratory bench. One final observation of the sound effects machine block diagram is that the basic computer convention of inputs is on the left, the processor is located in the middle, and the outputs are placed on the right-hand side of the design layout. As shown, the tactile switches are on the left-hand side, the Arduino is located in the middle, and the small signal transistor amplifier with 8 ohm speaker is on the right-hand side of the block diagram. This left to right design method makes it easier to build the sound effects machine and troubleshoot the errors during the testing phase of project development.
Building the sound effects machine
The sound effects machine is quite simple in design and construction. There are a variety of ways to build this electronic device, such as on a Printed Circuit Board (PCB) or an experimenter board. The method I found to rapidly build this electronic device is to use a solderless breadboard, as shown in this diagram:
In the preceding wiring diagram, the electrical components to build the sound effects machine circuit are placed on the solderless breadboard for easy attachment to the Arduino, SD card module, and speaker. The transistor shown is a 2N3904 NPN type with pin-out arrangement consisting of emitter, base, and collector, in that order. If the transistor pins are wired incorrectly, the WAV file sounds will not be heard through the 8 ohm speaker. The SD module is a DFRobot component (shown next) but any compatible part can be used in this project. If a compatible SD module component is being used, wire the device to the Arduino using the manufacturer's datasheet to ensure proper circuit operation.
Another wiring tool to be used in building the sound effects machine, either on a solderless breadboard or an experimenter board, is a circuit schematic diagram shown next:
As illustrated, the tactile pushbutton switches are used to select the various sounds stored on the SD card. Along with the tactile switches, there are four 2.2 kilo ohm pull-up resistors wired to them. The pull-up resistors allow a binary 0 to be read by the Arduino for selecting the stored WAV files on the SD card.
There are a total of five sound files stored on the SD card. Four of these sound files are easily activated by pressing a tactile pushbutton switch. The fifth sound file turns on when the Arduino is powered on or manually reset. To play the stored sounds on the SD card, the Arduino digital pins D5-D8 require a binary 0 to select the WAV files. More sounds can be added to the SD card and activated by wiring additional tactile pushbutton switches with 2.2 kilo ohm pull-up resistors.
Introducing SPI communication
The SPI communication is used to connect electronic devices such as computers, scanners, and printers together with four wires. The communication concept behind SPI is based on a master-slave configuration. The communication between the master and slave units are full duplex. In full duplex mode, the signals are transmitted simultaneously between the master and slave devices.
An example of a full duplex communication network is a desktop computer connected to a laser printer. The desktop computer will send a message to the laser printer, alerting it that a document is ready for printing. The laser printer will acknowledge the desktop computer by sending a request to print message. Upon receiving the request to print message, the desktop computer will then send the document to the laser printer for printing.
Inside the master and slave units, there are 8-bit shift registers that send binary data between them. A digital clock is used to provide proper timing to the shift registers while data moves between the two connected devices. The binary data movement used by both the shift registers is a Shift Left-Rotate Right sequence.
The data line names for the SPI 4-wire communication network are:
- MOSI (Master Out, Slave In)
- MISO (Master In, Slave Out)
- SCLK (Serial Clock)
- SS (Slave Select)
Most slave Integrated Circuit(IC) manufacturers (for example, DFRobot) use different pin names for the SPI 4-wire communication configuration. Some of these pin names are listed here:
- DI (Digital-In)
- DO (Digital-Out)
- SCK (Serial Clock)
- CS (Chip Select)
Additional slaves can be attached to the master SPI device by wiring them in parallel. The slave select signal will be connected from the master to each of the slaves. The slave IC's output is enabled when a corresponding slave signal is turned on or set. The data output from the slave IC is disconnected from the MISO line when the device is deselected by the slave select line.
The wiring for the Arduino to the SD module uses the techniques just discussed to select the individual files on the card. The circuit schematic diagram provides another way to build the microcontroller to SD module interface for sound WAV file selection:
A circuit schematic showing the electrical wiring connections between the Arduino Uno and SD module is shown here:
Adding digital logic switches for WAV file selection
The sound effects machine can produce a multitude of strange noises stored on an SD card. The eerie sounds can be recorded using a free audio editor and recorder called Audacity. Audacity can be found on the Web at http://soundbible.com/tags-strange.html.
Once the desired files have been recorded and saved on the SD card, accessing them requires using digital logic switches wired to the Arduino, as shown here:
The four tactile pushbutton switches along with the 2.7 kilo ohm resistors are wired as Active Low digital inputs. An Active Low operation is a binary 0 value that exists when a trigger, such as a pushbutton switch, has been initiated. The Arduino digital inputs D5-D8 are wired to the four tactile pushbutton switches for receiving the binary 0 digital data. The Arduino sketch will select the appropriate WAV file based on its pushbutton switch being pressed. The following is a small line of the Arduino code used to read an Active Low trigger from a pushbutton tactile switch:
The line of code will play the WAV file 6.wav
only when the pushbutton tactile switch is pressed, triggering an Active Low input signal to the Arduino.