DIY Smart Speaker (Amazon Alexa + Bluetooth + Binary Clock + Audio Visualization)
25149 Views, 106 Favorites, 0 Comments
DIY Smart Speaker (Amazon Alexa + Bluetooth + Binary Clock + Audio Visualization)
A smart speaker is a type of wireless speaker and voice command device with an integrated virtual assistant (artificial intelligence) that offers interactive actions and handsfree activation with the help of one "hot word" (or several "hot words"). Some smart speakers can also act as a smart device that utilizes Wi-Fi, Bluetooth and other wireless protocol standards to extend usage beyond audio playback, such as to control home automation devices. Some smart speakers also include a screen to show the user a visual response. Amazon’s Alexa and Google’s Google Assistant are the premier choices among smart speakers.
In this tutorial, I will show you how you can build your own Amazon Alexa. The speaker also has an 8x8 dot matrix display for audio visualization. It also works as a binary clock which shows time and date. You can connect the speaker with your smartphone through Bluetooth.
Before going to the details instruction watch the demo:
Bill of Materials
1. RAKwireless WisCore (aliexpress.com): WisCore is an open source hardware product which built-in Amazon Alexa Voice Service function. WisCore will help designer focus on the application design, design different product type which supported Alexa Voice Service smart product.
WisCore base MT7628 chipset. It`s support 2 * UART interface, it`s used for smart home field or robot product. Also, WisCore use a powerful codec on the board. This chip can implement ASR function, user will ask keyword ‘Alexa’ to trigger the module. WisCore Mic is an independent Microphone accessory, it`s a Microphone array to support many advance features, such as far field, user can talk with microphone away from 15 feet. Or sound located, using the microphone array will locate the user sound, the direction.
2. PAM8610 2x15W Class D Amplifier Board (aliexpress.com): In the next step I will explain how you can find a perfect amplifier module for your specific purpose.
3. MAX7219 8x8 Dot Led Matrix Module (aliexpress.com)
4. Arduino NANO (aliexpress.com)
5. PAM8403 Bluetooth Audio Receiver ( gearbest.com)
6. 2 x 3 Inch 8Ohm 15w speaker (aliexpress.com)
Tools Required
1. Soldering Station (gearbest.com)
2. Screwdriver (gearbest.com)
3. Wire Cutters ( gearbest.com)
4. Glue Gun ( gearbest.com)
You can also try this battery operated glue gun from gearbest.com.
5. Desktop 3D Printer (optional): You can buy Anet A8 3D printer kit from gearbest.com at only $140. This is a low price excellent 3D printer. I am using this for more than 1 year without any problem.
How to Choose a Perfect Audio Amplifier for a Specific Application
An audio amplifier increases the amplitude of a small signal to a useful level, all the while maintaining the smaller signal's detail. This is known as linearity. The greater the amplifier linearity, the more the output signal is a true representation of the input.
With the ever-changing performance requirements for amplifiers in the audio market, there have been many advances in audio amplifier topologies. Consequently, designers must know the types of audio amplifiers available and the characteristics associated with each. This is the only way to ensure that you select the best audio amp for an application.
i. Power output:
Power output is roughly equivalent to how loud you can pump out music. The bigger the speakers or room, generally the more power you want (much to your neighbors and housemates dismay!) However, you probably don’t need as much power as you’d expect. Generally, 10W is pretty loud for average listening and 100W is enough to blow the roof off most parties!
Hint: Be sure to look at speaker sensitivity, since this has a big effect.
ii. THD+N:
Total Harmonic Distortion + Noise (THD + N) is a measure of just how much effect the amplifier has on the sound output. More distortion generally means more colouration to the sound. The lower this figure, the closer the output of the amplifier will sound to the original recording. Of course, speakers will have the biggest effect on sound, so choose some that are well matched to your listening preference.
Hint: Lower numbers are better.
iii. SNR (Signal to Noise Ratio):
If you stand in a quiet room, in the countryside, away from the hustle and bustle, you might notice noises you’ve never noticed before. The humming of a radiator or cars travelling down a nearby road for example. None of this is apparent when the kids are home with the TV blasting away, but that background noise is still there. An amplifier is the same, there is always a very small amount of noise from the electrons whizzing around inside. The goal is to make this background noise imperceptible, this means you hear more of the music and less of the noise. The measure of this is the signal to noise ratio.
Hint: Bigger numbers are better!
iv. Crosstalk:
Left is Left, Right is Right and Crosstalk is a measure of how much undesirable left signal is mixed with right output. Amplifiers all being one box are doing their best to be separate boxes one per channel, splitting apart the signals to ensure when it reaches the speakers, you can tell that the singer is standing slightly to the left of the stage and the violins towards the right. The more crosstalk there is, the harder it is to pick out the positions of the instruments as stereo separation is affected.
Hint: With crosstalk, the larger the number following the minus sign (i.e. -60dB is not as good as -100dB) the greater the stereo separation.
v. Inputs/Connections:
Can you connect up everything you want to? You’ll want to make sure you have enough inputs for everything you’re plugging in! Remember the different type of connections, like 3.5mm for iPods, Phono for turntables and USB for laptops and home theatre PC’s. They all have advantages and when there are a few options, choose the one which provides the best sound quality.
Hint: We separate out phono stages in our Azur products, and guarantee the best performance as the signals from a turntable are very small and can be easily interfered with.
So there you have 5 important specs to consider when you’re out and about shopping for your brand spanking new amp! Are there other specs we’ve missed? Make sure you let us know in the comments below.
vi. Class
Class A Amplifier
The simplest type of audio amplifiers is Class A. Class A amps have output transistors that conduct (i.e., do not fully turn off), irrespective of the output signal waveform. Class A is the most linear type of audio amp, but it has low efficiency. Consequently, these amps are used in applications that require high linearity and have ample power available.
Class B Amplifiers
Class B amplifiers use a push-pull amplifier topology. The output of a Class B amp incorporates a positive and negative transistor. To replicate the input, each transistor only conducts during half (180°) of the signal waveform . This allows the amp to idle with zero current, thereby increasing efficiency compared to a Class A amp. There is a trade-off that comes with a Class B amp: the increased efficiency degrades audio quality. This happens because there is a crossover point at which the two transistors transition from the on state to the off state. Class B audio amps are also known to have crossover distortion when handling low-level signals. They are not a good choice for low-power applications.
Class AB Amplifiers
A compromise between Class A and Class B amplifier topologies is the Class AB audio amp. A Class AB amp provides the sound quality of the Class A topology with the efficiency of Class B. This performance is achieved by biasing both transistors to conduct a near zero signal output, i.e., the point where Class B amps introduce nonlinearities. For small signals, both transistors are active, thus functioning like a Class A amp. For large-signal excursions, only one transistor is active for each half of the waveform, thereby operating like a Class B amp. Class AB speaker amps offer high signal-to-noise (SNR), low THD+N, and typically up to 65% efficiency. This makes them ideal choices as high-fidelity speaker drivers. Class AB amps like the MAX98309 and the MAX98310 are used in portable media players, digital cameras, tablets, and e-readers where high fidelity is a must. Some headphone amplifiers use a Class AB topology in a bridge-tied-load configuration. As an example, the MAX97220A headphone amp offers exceptionally low THD+N throughout the audio band while delivering up to 125mW of power; the MAX97220A is one of the most widely used Class AB headphone amps in the world today. For other examples, see Maxim’s Class AB amps.
Class D Amplifiers
The popularity of handheld mobile audio devices, such as smartphones, MP3 players, and portable docking stations, brings power consumption into greater focus. Now it is necessary to reduce power consumption to increase battery life. Class D amplifiers use pulse-width modulation (PWM) to produce a rail-to-rail digital output signal with a variable duty cycle to approximate the analog input signal. These amps are highly efficient (often up to 90% or higher) because the output transistors are either fully turned on or fully turned off during operation. This approach completely eliminates the use of the linear region of the transistor that is responsible for the inefficiency of other amplifier types. Modern Class D amps also achieve fidelity comparable to Class AB amps. With its high efficiency, Class D switching amplifiers, such as the MAX98304 and the MAX98400A, are widely used in portable applications. For other examples, see Maxim’s Class D amps.
Class G Amplifiers
Class G amplifiers are similar to Class AB amps, except that they use two or more supply voltages. When operating at low signal levels, Class G amps select a low supply voltage. As the signal level increases, these amps automatically select the appropriate supply voltage. Class G amps are more efficient than Class AB amps because they use the maximum supply voltage only when required; in contrast, Class AB amps always use the maximum supply voltage. There is a common problem in portable audio applications: the limited supply voltage available to the speaker amp. Class G power amps solve this supply voltage problem by using a charge pump to boost the supply voltage. As examples, the MAX9730 speaker amp is optimized for traditional dynamic speakers, while the MAX9788 speaker amp is designed for ceramic speakers. For other examples, see Maxim’s Class G amps.
Class DG Amplifiers
The Class DG amplifier uses PWM to produce a rail-to-rail digital output signal with a variable duty cycle. In this respect, a Class DG amp is the same as a Class D amp. The Class DG amp, however, also uses a multilevel output stage to sense the magnitude of the output signal. It then switches the supply rails, as needed, to supply the required signal power more efficiently. A Class DG amp, such as the MAX98308, uses the same dual-power concept as a switching Class D topology for even higher efficiency. For other examples, see Maxim’s Class DG amps.
Class H Amplifiers
Class H amplifiers modulate their supply voltage to minimize the voltage drop across the output stage. Implementations range from using multiple discrete voltages to an infinitely adjustable supply. Though similar to the Class G technique of reducing dissipation across output devices, the Class H topology does not require multiple power supplies. Class H amps are generally more complex than other audio amplifier designs. These amps require extra control circuitry to predict and control the supply voltage. Audio codec ICs, such as the MAX98090 and the MAX98091, integrate a Class AB headphone amp with a Class H power structure to provide a very low-power, complete audio solution. For other examples, see Maxim’s Class H amps.
vii. Voltage Level
This is also an important parameter must be considered when choosing an amplifier. Amplifiers of different voltage level are available in the market. You have to choose one considering the supply voltage available in your hand and the voltage requires for other circuits.
Preparing Dot Matrix Front Panel
First I choose a nice box for the amplifier. For the visualization of audio signal and displaying date and time I set a dot matrix display in the front side of the amplifier box. To do the job nicely I used rotary tool to cut the frame according to the size of the matrix. If your display has no integrated driver chip use one separately. I prefer Bi-color matrix from Adafruit. After selecting the perfect matrix display, adjust the display to the base with hot glue.
We will connect it to Arduino board later. The bi-color display from Adafruit use i2c protocol to communicate with microcontroller. So, we will connect SCL and SDA pin of the driver IC to the Arduino board.
Programming With Arduino
Connect Adafruit Smart Bi-color dot matrix display as:
- Connect the Arduino 5V pin to the LED matrix + pin.
- Connect Arduino GND pin to both the mic amp GND pin and the LED matrix – pin.
- You can use a breadboard power rail, or the Arduino has multiple GND pins available. Connect Arduino analog pin 0 to the audio signal pin.
- Connect Arduino pins SDA and SCL to the matrix backpack D (data) and C (clock) pins, respectively.
- Earlier Arduino boards don’t include SDA and SCL pins — instead, use analog pins 4 and 5.
- Upload the attached program and test it is either working or not:
Begin by downloading the Piccolo repository from Github. Select the “download ZIP” button. Once this is finished, uncompress the resulting ZIP file on your hard drive. There will be two folders inside: “Piccolo” should be moved to your usual Arduino sketchbook folder. “ffft” should be moved into your Arduino “Libraries” folder (inside the sketchbook folder — if it’s not there, create one). If you’re unfamiliar with installing Arduino libraries, please follow this tutorial. And never install in the Library folder adjacent to the Arduino application itself…the proper location is always a subdirectory of your home folder! If you haven’t already installed the Adafruit LED Backpack Library (for using the LED matrix), please download and install that as well. Once the folders and libraries are situated, restart the Arduino IDE, and the “Piccolo” sketch should be available from the File->Sketchbook menu.
With the Piccolo sketch open, select your Arduino board type and serial port from the Tools menu. Then click the Upload button. After a moment, if all goes well, you’ll see the message “Done uploading.” If everything goes well you will see the audio spectrum for any audio input.
If your system works well then upload the complete.ino sketch attached with the step for adding binary clock with the audio visualization. For any audio input the speaker will display audio spectrum otherwise it will show the time and date.
Connecting Speaker to Amplifier Board
In this stage, we will connect the speakers to the audio amplifier module. First, we connect one speaker to L+ and L- port of the amplifier. Then connect another speaker to R+ and R- pin of the amplifier board. Solder a 3.5mm audio jack to the input port of the audio amplifier. Finally, connect two jumper wires to the V+ and V- pin of the audio amplifier module.
Some 3D Printing
A base for WisCore Alexa and a handle are designed in Tinkercad. The files are then printed by my Anet A8 3D printer. The base will help to attached WisCore Alexa safely and tightly in the box. It also will help to place other modules in the box with hot glue. The handle is printed in two separate parts. I attached two parts with M3 screw.
Preparing the Box
In this stage, I placed 3D printed parts in the box. I added some hot glue to tightly fix the printed parts with the box. There is a hole on the center of the base. We will place DC adapter jack in the hole later.
Making Arduino Circuit
The main function of this circuit is to display the time and visualized the audio signal. As a display, an 8x8 dotmatrix display was used. For keeping the time DS3231 RTC module was used. The drive the display an Arduino NANO was used as a main controller board. Under the display two LED was attached to show the status of the Alexa. This two LEDs are connected to the Alexa Status Pin of the WisCore Board. The connection of the Arduino with the RTC module is very simple. Here is the connection:
Arduino | RTC Module |
---|---|
VCC | VCC |
GND | GND |
SCL | SCL |
SDA | SDA |
Arduino NANO | Dot-matrix Module |
---|---|
VCC | VCC |
GND | GND |
12 | DIN |
11 | CLK |
10 | CS(LOAD) |
Connecting Power Jack to WisCore Alexa
WisCore board has two options to provide power to the board. One through micro USB and another is through standard DC jack. I chose DC socket because we have required another voltage source for amplifier board and 5V is not enough for the amplifier. The connection of the amplifier board and the audio jack are shown in the images.
Connecting LED Circuit to WisCore Alexa
WisCore Alexa Board has a special pin called Alexa Status LED. The pin is an active low output and activates on wake word Alexa. So, I connected an external PNP transistor to drive two LEDs using this LOW output. After soldering the circuit I place the WisCore board in the box using the 3D printed base. I added some hot glue to attach tightly to the board.
Placing All the Circuits Inside the Box
This is the most crucial stage and in this stage, I placed all the electronics inside the box. After placing the WisCore board, I placed Bluetooth Audio Module and the amplifier module. Then I placed RTC module and Arduino NANO inside the box. Every time I used some hot glue to fix the module in a perfect place inside the box. Then I place the display panel in the middle of the box. I also placed the left speaker and the right speaker in the right place. I used hot glue to fix the speakers to the box.
Done! Enjoy!!
IIf you followed all the previous steps then Congratulation. You made your smart speaker with a dot matrix display. The display shows audio and time. If the speaker receives any audio signal it shows audio spectrum otherwise shows date and time in BCD binary format. If you like programming and digital technology, then I am sure you like binary. I like binary and binary clock. Previously I made a binary wrist watch and time format are exactly the same as my previous watch. So, for the illustration about time format, I added a previous image of my watch without producing another.
Thank You.