Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arduino Electronics Blueprints
Arduino Electronics Blueprints

Arduino Electronics Blueprints: Make common electronic devices interact with an Arduino board to build amazing out-of-the-box projects

eBook
$9.99 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Arduino Electronics Blueprints

Chapter 1. A Sound Effects Machine

Arduino is a wonderful rapid prototyping platform capable of making a variety of electronic tools, gadgets, and instruments. The fascination with Arduino has grown to the point where makers are creating devices to educate, entertain, and provide new creative tools for individuals interested in science or technology. Some of the electronic devices that can be built with Arduino include DC motor controllers, musical instruments, robots, and smart toys.

In addition to the devices listed, Arduino can be used to create unique sounds as well. There are several programming techniques used to create sounds using Arduino. For example, the Arduino tone library can be used to create a variety of unusual sounds by varying the pitch, frequency, and duration of a pulse width modulated signal. Another approach is to use the recorded sound WAV files stored on an SD card. Arduino can select these files using an SD card software library, thereby allowing the recorded sounds to be heard through a small signal transistor amplifier. In this chapter, we will explore how to build a sound effects machine capable of playing a variety of sounds recorded on an SD card. Also, a discussion on small signal transistor amplifiers and Serial Peripheral Interface (SPI) communication will be reviewed with the project. A modification project allowing the sounds to be played randomly will be discussed in this chapter as well.

Parts list

The following is the list of parts required for a sound effects machine:

  • Arduino Uno (one unit)
  • 2N3904 NPN transistor (one unit)
  • 8 ohm speaker (one unit)
  • 470 ohm resistor (yellow, violet, brown, and gold) (one unit)
  • 4.7 kilo ohm resistors (yellow, violet, red, and gold) (four units)
  • Tactile pushbutton or toggle switches (four units)
  • SD module (DFRobot [PN:DFR0071]) or Arduino compatible (one unit)
  • Breadboard
  • Wires

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:

A sound effects machine 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:

Building the sound effects machine

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.

Building the sound effects machine

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:

Building the sound effects machine

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.

Introducing SPI communication

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.

Introducing SPI communication

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.

Introducing SPI communication

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:

Introducing SPI communication

A circuit schematic showing the electrical wiring connections between the Arduino Uno and SD module is shown here:

Introducing SPI communication

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:

Adding digital logic switches for WAV file selection

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:

if (SW1 == LOW) { //if SW1 pressed then play file "6.wav"
    tmrpcm.play("6.wav");
}

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.

Adding SD and WAV file libraries to your Arduino sketch

To allow the sound effects machine to play WAV files, additional software resources are needed. The two important software resources required for the sound effects machine to work properly are the <SD.h> and <TMRpcm.h> libraries. The SD (San-Disk) library is required for read / write operations from an SD part. The Arduino Integrated Development Environment (IDE) has the SD resource as part of its software library.

Adding SD and WAV file libraries to your Arduino sketch

With the SD library included in the Arduino sketch, as shown next, the available software resource allows the microcontroller to talk to the actual SD card using a module or breakout board. The pin allowing the Arduino to talk to the SD card module or breakout board is the SS or CS pin:

#include <SD.h>   // need to include the SD library

#define SD_ChipSelectPin 10  //using digital pin 10 on Arduino 328

if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
  return;   // don't do anything more if not
}
Adding SD and WAV file libraries to your Arduino sketch

Depending on the SD module or breakout board manufacturer, the SS or CS pin assignment on the Arduino may vary. Therefore, consult the manufacturer's datasheet for the appropriate Arduino pin assignment. With the appropriate Arduino pin numbers assigned, another file to include in the Arduino sketch is the TMRpcm library.

The TMRpcm library installation

The TMRpcm is a software library used for playing PCM/WAV files on Arduino. The Arduino SD library is used to communicate with an SD card to read data, such as WAV files. The WAV files can be accessed using the TMRpcm library so that they may be heard through a speaker wired to the Arduino. Perform the following steps to install the TMRpcm library:

  1. To obtain the TMRpcm library to use it in the sound effects machine project, there is a GitHub website—https://github.com/TMRh20/TMRpcm/wiki.
    The TMRpcm library installation
  2. Scrolling down on the web page will provide a link to the Arduino.cc website for the library installation instructions. Also, the TMRpcm zipped file is located above this link and can be downloaded on your desktop, pc, or notebook computer's hard drive.
    The TMRpcm library installation
  3. After the installation has been completed, the TMRpcm file will be included in the Arduino's IDE library.
    The TMRpcm library installation
  4. With the TMRpcm file included in the Arduino IDE library, the following line of code can be added to the sound effects machine sketch:
    #include <SD.h>           // need to include the SD library
    #define SD_ChipSelectPin 10  //using digital pin 4 on Arduino nano 328
    #include <TMRpcm.h>           //  also need to include this library...
    #include <SPI.h>
  5. Also included with the sketch is the <SPI.h> file for connecting the SD module or breakout board to the Arduino. With the TMRpcm library added to the Arduino sketch, the WAV file audio content can be heard using a simple transistor amplifier, as shown in the following image:
    The TMRpcm library installation
  6. The circuit schematic can be used to wire the transistor amplifier to the Arduino, as shown in the next diagram:
    The TMRpcm library installation

    The 2N3904 NPN transistor has sufficient gain or volume potential (hfe 100 typical) to drive an 8 ohm speaker. The hfe is an electrical symbol parameter found on transistor or audio amplifier integrated circuit datasheets. The unitless number refers to the current gain for audio amplifiers and transistors to sufficiently drive an electromechanical load wired to them. For amplifiers, in particular, sometimes it refers to the amplification factor of increasing an input signal applied to the transistor or IC amplifier. If a higher audio volume is desired, an LM386 power amplifier IC can easily be substituted for the simple transistor circuit.

  7. With the <TMRpcm.h> library included in the Arduino sketch, the following lines of code allow the WAV files to be heard through the speaker driven by the transistor amplifier:
    TMRpcm tmrpcm;   // create an object for use in this sketch
      int SW1;
      int SW2;
      int SW3;
      int SW4;
      void setup(){
        pinMode(5,INPUT);  //Define A0 as digital input.
        pinMode(6,INPUT);  //Define A1 as digital input.
        pinMode(7,INPUT);  //Define A2 as digital input.
        pinMode(8,INPUT);  //Define A3 as digital input.
    
        tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc
    
        if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
          return;   // don't do anything more if not
        }
        tmrpcm.volume(7);
        tmrpcm.play("1.wav"); //the sound file "1" will play each time the Arduino powers up, or is reset
      }
    
      void loop(){
        SW1=digitalRead(5);
        SW2=digitalRead(6);
        SW3=digitalRead(7);
        SW4=digitalRead(8);
    
        if (SW1 == LOW) { //if SW1 pressed then play file "6.wav"
          tmrpcm.play("6.wav");
        } else if(SW2 == LOW){ //if SW2 pressed then play file "4.wav"
          tmrpcm.play("4.wav");
        } else if(SW3 == LOW){ //if SW3 pressed then play file "5.wav"
          tmrpcm.play("5.wav");
        } else if(SW4 == LOW){  //if SW4 pressed then play file "3.wav"
          tmrpcm.play("3.wav");
        }
    
      }

As you can see, this code follows the traditional coding format for programming an Arduino. After uploading the sketch to the Arduino, 1.wav will be heard through the speaker for a few seconds. This initial tone heard upon resetting the Arduino alerts you that the sound effects machine is ready to use. By pressing each of the pushbutton tactile switches, a unique sound will be heard through speaker. If an automatic approach is desired, a random function can easily be programmed for the sound effects machine.

Adding a random function to play sounds automatically

To allow the sound effects machine to select various sounds automatically, the random function can be used. The description for the random function is given on the Arduino.cc website:

Adding a random function to play sounds automatically

The key concept behind this programming instruction is to set a maximum number for the random function generator. This maximum number will prevent the random function from generating values not exceeding the set maximum limit. For example, random(300) will allow the generation of numbers ranging from 0 to 300 to be produced in a non-sequential matter. With this function, the sound effects machine will select WAV files automatically to play, and they can be heard through the simple transistor amplifier-speaker circuit.

To test this random generator function, type the following sketch onto the text editor of the Arduino IDE:

long randNumber;
void setup(){
  Serial.begin(9600);
}

void loop(){
  randNumber = random(5); // set max random number
  Serial.println(randNumber); //print random number on Serial Monitor
  delay(1000); //wait 1 sec between printing random numbers
}

Attach an Arduino to the desktop pc or notebook computer and upload the sketch to it. Next, open the serial monitor and notice the numbers being displayed on the screen. The numbers generated will range between 0 to 5 on the serial monitor. Modeling this function on the Arduino IDE allows a better understanding of how the concept of selecting sounds from the SD card randomly is feasible. Try out different values for the random function parameter and watch the results on the serial monitor.

The next phase of the sound effects machine modification project will consist of taking sections of the random function and adding them to the original sketch. The technique used in this modification method is called software remixing. This software remixing method allows Proof of Concept-embedded devices to be rapidly developed and tested. Again, our concept is to provide a hands-free sound effects machine for selecting WAV files from an SD card.

Adding a random function to play sounds automatically

Type the following sketch onto the IDE text editor and upload the code to the Arduino:

#include <SD.h>                 // need to include the SD library
#define SD_ChipSelectPin 11b  //using digital pin 4 on Arduino nano 328
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>
long randNumber;

TMRpcm audio;   // create an object for use in this sketch

void setup(){
  audio.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc

  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    return;   // don't do anything more if not
  }
  audio.volume(7);
  audio.play("1.wav"); //the sound file "1" will play each time the Arduino powers up, or is reset
}

void loop(){
  randNumber = random(5); // set max random number 

  if (randNumber == 5){ // if number is 5 play file ""6.wav"
    audio.play("6.wav");
    delay(5000);

  } else if(randNumber == 4){ // if number is 4 play file "4.wav"
      audio.play("4.wav");
      delay(5000);

  } else if(randNumber == 3){ // if number is 3 play file "5.wav"
    audio.play("5.wav");
    delay(5000);

  } else if(randNumber == 2){ // if number is 2 play file "3.wav"
    audio.play("3.wav");
    delay(5000);

  } else if (randNumber == 0){ // if number is 0 play "1.wav"
    audio.play("1.wav");
    delay(5000);
  } else if (randNumber == 1){ // if number is 1 play "2.wav"
    audio.play("2.wav");
    delay(5000);
  }

}

The WAV files will play randomly, based on the number stored in the randNumber variable. The delay(5000) instruction will allow the selected sound to play for 5 sec. An added feature of this sketch is that new files can be added to the SD card and can also be selected on the basis of the assigned number chosen by the else if statement. If additional sounds are added with the random (n) instruction, they will be adjusted to accommodate the number of new WAV files stored on the SD card. Also, to see which WAV files have been selected, the serial monitor can be modified to include the new lines of code.

In addition, the actual WAV file name can be displayed as the machine plays the SD card audio content using the serial monitor. A few additional lines of code can be included to the sketch shown earlier. The new changes to the Random Function WAV code are given here:

#include <SD.h>                  // need to include the SD library
#define SD_ChipSelectPin 11  //using digital pin 4 on Arduino nano 328
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>
long randNumber;

TMRpcm audio;   // create an object for use in this sketch

void setup(){
  Serial.begin(9600);
  audio.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc

  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    return;   // don't do anything more if not
  }
  audio.volume(7);
  audio.play("1.wav"); //the sound file "1" will play each time the Arduino powers up, or is reset
}

void loop(){
  randNumber = random(5); // set max random number

  if (randNumber == 5){ // if number is 5 play file "6.wav"
    audio.play("6.wav");
    Serial.println("Playing 6.wav");
    delay(5000);

  } else if(randNumber == 4){ // if number is 4 play file "4.wav"
    audio.play("4.wav");
    Serial.println("Playing 4.wav");
    delay(5000);

  } else if(randNumber == 3){ // if number is 3 play file "5.wav"
    audio.play("5.wav");
    Serial.println("Playing 5.wav");
    delay(5000);

  } else if(randNumber == 2){ // if number is 2 play file "3.wav"
    audio.play("3.wav");
    Serial.println("Playing 3.wav");
    delay(5000);

  } else if (randNumber == 0){ // if number is 0 play "1.wav"
    audio.play("1.wav");
    Serial.println("Playing 1.wav");
    delay(5000);
  } else if (randNumber == 1){ // if number is 1 play "2.wav"
    audio.play("2.wav");
    Serial.println("Playing 2.wav");
    delay(5000);
  }

}

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Type the new sketch onto the text editor of the Arduino's IDE. Upload the sketch to the USB connected Arduino and open the serial monitor. As sounds are playing through the speaker, the WAV file names will be displayed on the serial monitor:

Adding a random function to play sounds automatically

The serial monitor provides a user friendly visual display to watch the WAV sound files as they are being played. Also, this monitor can serve as a software debugging tool by providing WAV file data as the code is being executed. If a particular file is not providing sound, the serial monitor will validate the absence of the data on the SD card quite easily.

Adding an LED bar graph display for selected sound

Besides displaying the names of the sound files on a serial monitor, a lighting indicator can be used for positive visual feedback. The idea behind this new feature is to provide a unique visual effect for the random function. The random patterns generated within the software can be seen using solid state indicators like LEDs. The visual random patterns using LEDs will look best when viewed in a darkroom. The Proof of Concept (POC) that is being presented in this section is more of a design challenge to take the knowledge obtained from the previous hardware and software changes for building a unique and visually appealing device.

To help develop the LED bar graph display POC, a possible breadboard layout is shown in the following figure:

Adding an LED bar graph display for selected sound

As shown in the breadboard, five single LEDs along with 330 ohm series resistors are used to monitor the associate sound files stored on the SD card. The idea behind the breadboard wiring is to show that digital output pins are needed to operate (drive) the LEDs. The digital pins D3, D4, D5, D7, and D8 are used as output drivers for operating the five LEDs.

A circuit schematic diagram shows a better wiring perspective of the LEDs, series resistors, and their attachment to the Arduino:

Adding an LED bar graph display for selected sound

Although the wiring diagram shows red LEDs, other colors maybe used for the random function visual effect of the code. Also, the five LEDs can be replaced with an LED bar graph display, such as Sparkfun Electronics' catalog number COM-09937. Although the LED bar graph display has 10 individual LEDs in one package, only five are required for this project.

Adding an LED bar graph display for selected sound

Once the circuit breadboard wiring is complete, a new code is required to operate the LED bar graph display. The following code blocks are required for the Random Function WAV sketch. These example code blocks are templates to help modify the sound effects machine for visual display of the sounds randomly being selected by the code. The digital pins shown in the code will need to be declared, as shown in the code block; the constant names chosen reflect the optoelectronic component wired to the designated digital pins on the Arduino:

int LEDBar1 = 3; // segment 1 of the LED Bar Graph display
int LEDBar2 = 4; // segment 2 of the LED Bar Graph display
int LEDBar3 = 5; // segment 3 of the LED Bar Graph display
int LEDBar4 = 7; // segment 4 of the LED Bar Graph display
int LEDBar5 = 8; // segment 5 of the LED Bar Graph display

Note that the declaration of constant names and variables are placed above the void setup() section of the code. Next, the constant names need to be configured as digital outputs for the Arduino:

void setup(){
 pinMode(LEDBar1,OUTPUT);  //Define LEDBar1 as digital output.
 pinMode(LEDBar2,OUTPUT);  //Define LEDBar2 as digital output
 pinMode(LEDBar3,OUTPUT);  //Define LEDBar3 as digital output
 pinMode(LEDBar4,OUTPUT);  //Define LEDBar4 as digital output
 pinMode(LEDBar5,OUTPUT);  // Define LEDBar5 as digital output
}

The final step of adding the LED bar graph display to the random function WAV code is to operate the LEDs when the assigned sound file is selected:

void loop(){
  randNumber = random(5); // set max random number

  if (randNumber == 5){ // if number is 5 play file "6.wav"
    audio.play("6.wav");
    Serial.println("Playing 6.wav");
    digitalWrite(LEDBar1, HIGH);
    delay(5000);

  } else if(randNumber == 4){ // if number is 4 play file "4.wav"
    audio.play("4.wav");
    Serial.println("Playing 4.wav");
    digitalWrite(LEDBar1, LOW);
    digitalWrite(LEDBar2, HIGH);
    delay(5000);

  } else if(randNumber == 3){ // if number is 3 play file "5.wav"
    audio.play("5.wav");
    Serial.println("Playing 5.wav");
    digitalWrite(LEDBar2, LOW);
    digitalWrite(LEDBar3, HIGH);
    delay(5000);

  } else if(randNumber == 2){ // if number is 2 play file "3.wav"
    audio.play("3.wav");
    Serial.println("Playing 3.wav");
    digitalWrite(LEDBar3, LOW);
    digitalWrite(LEDBar4, HIGH);
    delay(5000);

  } else if (randNumber == 0){ // if number is 0 play "1.wav"
    audio.play("1.wav");
    Serial.println("Playing 1.wav");
    digitalWrite(LEDBar4, LOW);
    digitalWrite(LEDBar5, HIGH);
    delay(5000);

  } else if (randNumber == 1){ // if number is 1 play "2.wav"
    audio.play("2.wav");
    Serial.println("Playing 2.wav");
    digitalWrite(LEDBar5, LOW);
    delay(5000);
  }

}

With these suggested changes to the Random Function WAV code, the sound effects machine will have a visually appealing look as WAV files are being played randomly.

Summary

In this chapter, a sound effects machine was built using an Arduino, SD module, and few off-the-shelf electronic components. The fundamentals of SPI and full duplex communications were explained in the chapter. Adding digital logic switches to the Arduino and WAV files to the SD card were also explained. The installation of the TMRpcm library was provided using GitHub website images and step by step instructions. The operation of the Arduino code was explained aided by the comment statements in the applications software. Finally, the sound effects machine was tested along with the additional information to provide a random file selection feature. Adding an LED bar graph display for selected sounds was explained.

In Chapter 2, Programmable DC Motor Controller with LCD, a discussion on how to build a small electronic controller to operate small power, low voltage DC rotating machines will be presented. Learning objectives in the chapter include interfacing discrete digital logic to an Arduino, wiring a small DC motor to a digital logic gate, and programming a dc motor controller function selection cursor for an LCD. Mini lab testing procedures, Arduino code explanation, and the final project assembly will be provided and discussed in this chapter.

Left arrow icon Right arrow icon

Description

This book is intended for those who want to learn about electronics and coding by building amazing devices and gadgets with Arduino. If you are an experienced developer who understands the basics of electronics, then you can quickly learn how to build smart devices using Arduino. The only experience needed is a desire to learn about electronics, circuit breadboarding, and coding.

Who is this book for?

This book is intended for those who want to learn about electronics and coding by building amazing devices and gadgets with Arduino. If you are an experienced developer who understands the basics of electronics, then you can quickly learn how to build smart devices using Arduino. The only experience needed is a desire to learn about electronics, circuit breadboarding, and coding.

What you will learn

  • Add SD and wavefile libraries to your Arduino code
  • Get to grips with SD card SPI communications
  • Interface an IR detection circuit to Arduino
  • Wire an OLED LCD to Arduino
  • Install the Nordic nRF8001 Bluetooth Low Energy code to Arduino
  • Build an HMI (Human Machine Interface) from a web page using JavaScript
  • Connect Arduino to a virtual server (Breakout.js)
  • Wire a small DC motor driver to Arduino with a transistor and diode circuit
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 24, 2015
Length: 252 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393601
Vendor :
Arduino
Category :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Jul 24, 2015
Length: 252 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393601
Vendor :
Arduino
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 146.97
Arduino Electronics Blueprints
$48.99
Arduino By Example
$48.99
Arduino Development Cookbook
$48.99
Total $ 146.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. A Sound Effects Machine Chevron down icon Chevron up icon
2. Programmable DC Motor Controller with an LCD Chevron down icon Chevron up icon
3. A Talking Logic Probe Chevron down icon Chevron up icon
4. Human Machine Interface Chevron down icon Chevron up icon
5. IR Remote Control Tester Chevron down icon Chevron up icon
6. A Simple Chat Device with LCD Chevron down icon Chevron up icon
7. Bluetooth Low Energy Controller Chevron down icon Chevron up icon
8. Capacitive Touch Sensing Chevron down icon Chevron up icon
9. Arduino-SNAP Circuit AM Radio Chevron down icon Chevron up icon
10. Arduino Scrolling Marquee Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(3 Ratings)
5 star 33.3%
4 star 33.3%
3 star 33.3%
2 star 0%
1 star 0%
Requin Aug 12, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It’s a great book. I’ve learned a lot of new stuff, while reading it. And it gave me inspiration for some new projects using a web HMI. There are good and numerous graphics as well as interesting background information’s that usually aren’t covered in similar books. I clearly noticed the educational and the industrial background of the author. It’s suitable for beginners but the presentation of the content gets you quickly in advanced topics, if you are interested.
Amazon Verified review Amazon
viveka Mar 15, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good reference book
Amazon Verified review Amazon
Sid Young Sep 01, 2015
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
There are stacks of books on the Arduino these days and as time goes by they become more and more advanced with host of sophisticated projects. Gone are the days of "lets flash an LED" style project books, these days the availability of quality interface boards and better quality code with them has driven the hobby and commercial embedded controller market to new highs and this has led to a new interest in real world device control.This book aims to provide a small subset of real world interfacing solutions. Its suitable for use as a reference on a small range of devices which puts it in the more advanced interfacing books category and an ideal book for those looking to build projects that connect to the real world."Arduino Electronics Blueprints" provides 10 chapters of simple projects that build on earlier chapters, although not highly sophisticated projects, there is room to utilize the concepts in real-world applications. Each project incorporates electronic modules that are themselves usable in a range of other projects. The book's authors have made reuse of "off the shelf components" a high priority and anything that needs to be crafted by hand is laid out in a simple fashion so that basic skills are needed to assemble most projects.When I started reading each chapter I was impressed at the extent of theory provided on the various components that the project would incorporate but there should have been more emphasis on controlling power devices rather than small DC motors.As an example, the Simple Chat server integrates the LCD module (simple in itself) but then incorporates the ability to use the Nordic nRF8001 Bluetooth IC with details of its internal workings, interfacing and coding, the project then extends with an off the shelf module. Finally it ends with an interface to an Android Smart phone. Ideally, this should have also included connecting some solid state relays to control AC power but it can be adapted if needed.In each chapter the Theory of Operation is outlined very well. There does seam to be a leaning for DC servo motor projects but there is also InfrRed, Bluetooth, driving a range of other devices like SD cards, LCD modules, MOSFET driving, 7-segment displays, USB interfacing and interfacing to a web server. Along the way interfaces like SPI are detailed, basic electronic interfacing is explained and incorporated in many projects.A quick analysis of the chapters:Chapter 1: A Sound Effects Machine uses the SD card to store WAV (sound) files and an LED bar graph driven randomly to the audio output. The chapter introduced SPI concepts and adds know how into adding third part libraries (the TMRpcm library from GITHUB).Chapter 2: Programmable DC Motor Controller with an LCD - introduces transistor motor drive circuits as well as driving MOSFETs. It also covers driving an LCD, using it as the main User Interface.Chapter 3: A Talking Logic Probe - This is a strange project but the chip that is used for speech synthesis (the EMIC 2 Text to Speech module) can be used in a host of other applications.Chapter 4: Human Machine Interface yet another motor drive project but with a twist, the control code is via a web page hwich you build and deploy then use the USB interface to talk to the Arduino that provided the motor control.Chapter 5: IR Remote Control Tester - The chapter title sums this project up but along the way the IR signals and communication protocols are detailed and with it driving the commonly used Arduiono LCD module.Chapter 6: A Simple Chat Device with LCD - Two chat devices are built, the first using serial the second using the Nordic nRF8001 Bluetooth device and incorporating an Android Smartphone.Chapter 7: Bluetooth Low Energy Controller is another example with a motor drive circuit (using a TPS2812C controller IC) but controlled using the BlueTooth communications from the previous chapter. In addition a 7-Segment display is incorporated. Control is performed via the Smartphone.Chapter 8: Capacitive Touch Sensing - Using a capacitive touch plate you build, a circuit drives a 555 timer which is interfaced to an Arduino that then drives a servo motor.Chapter 9: Arduino-SNAP Circuit AM Radio - I'm not sure how much use an AM radio is these days but the project incorporates a number of different components from the other projects. In over all terms this project does not add much in the way of new interfacing techniques.Chapter 10: Arduino Scrolling Marquee - OLED displays are becoming popular and this project uses one for output. It incorporates a good theory of operation of a typical OLED device.Whats missing?There is a lot missing from this book, no discussion on ethernet or WiFi, no Arduino web server integration and facing with devices like relays and other sensors. While there are some electronics outlined in the book, there is little in the way of real power control for controlling average household devices. Perhaps that's content for another book.If your into building projects then this book will give you some new ideas.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela