Arduino Nano + RN52 + TPA2016D2 Experiment

It has been over a year since I have been working on the audio things. The previous experiment, I used an amplifier called TPA2016 which can amplify an audio data from a 3.5mm headphone wire connecting a phone. However, I really wanted it to be a wireless which can send the audio data, and I finally found the one called “RN52” which is an audio bluetooth module.

RN52 Test

In the Fritzing image above, I did an initial test with this RN52 module and an 8Ω speaker ( 16Ω speaker should have been used according to the data sheet, but it is actually not big deal.) with an Arduino Nano for UART communication and as a voltage supplier from my computer which is 5V. The initial test worked perfectly and I heard sounds, but there were some problems.

  1. The sounds were NOT really amplified.
  2. It could not control a gain from your Phone.

In order to solve these problems, I decided to use an TPA2016 which is the stereo class D amplifier with a gain control. By using the amplifier, I could amplify the audio sounds to around 30 dB, and I could control the gain from my phone which means I could adjust the sound volume in my phone. The TPA2016 module could solve these problems once.

Here is the new Fritzing image.

Fortunately, RN52 had 4 pins audio outputs and TPA2016 had 4 pins audio inputs, thus by connecting between these modules, the audio data coming from RN52 as outputs is going into the TPA2016 as inputs. In this video, I am showing how to connect the Bluetooth module and your phone, and how it works.

New Bone Conduction glasses 2.1 in San Jose Mini Maker Faire

I have been thinking how I could minimize the size of my prototype and maximize the effect of it. Then, what I came up with was to make my previous bone conduction glasses to the attachable type. Fortunately, there was upcoming maker faire in 9/3/2017 after I came up with this idea so I had a chance to see people’s reactions to my new prototype. 

Fusion 360

In order to make attachable device, I needed 3d printer and some skills of 3d modeling. What I have done was to attach an amplifier PCB (middle), a battery connecter (left) and 3.5 headphone jack (right) on the top side by measuring each PCBs and calculating each positions. Of course, I could not make it only once. I failed to print a couple of times, and I remeasured, recalculated, redesigned, and reprinted many times until it fitted.

On the bottom side was very simple. It just attaches a bone conduction transducer.

In this San Jose Mini Maker Faire, I exhibited two types of my prototypes which are the bone conduction glasses and attachable bone conduction device. I wanted to get any feedback from people.

Previos prototype

 

New prototype

 

My Booth

Many people came the booth I was exhibiting my bone conduction devices, and many people told me that these were awesome. Some of them who really were into these took my business card, so these reaction of people and actions really really made me happy like I was grad to make this!

Advantage and Disadvantage of the attachable bone conduction device

These are what I realized and got feedback from people during the Maker Faire.

Advantage

  • It can attach almost any types of glasses, so the users do not have to buy the glasses itself.
  • It is lighter.

Disadvantage

  • It can not make a balance. Either side is heavier.
  • Looks uncool.

 

Next Step

I cannot tell you the detail but I am currently working on my own PCB to make device itself as lighter as I can. See you in next Maker Faire.

Bone Conduction Speaker Experiment using I2C

The more things I studied about TPA2016, the further curiosity I had got such as what is going to happen what if I connect bone conduction speaker instead of a speaker. In addition, while reading the data sheet of TPA2016D2, I had been stuck on some words which were Automatic Gain Control (AGC) and Dynamic Range Compression (DRC) because I have never heard of these words before. However, these words DRC and AGC seem to be really important to know to do the further experiment like the aim of this tutorial which is the experiment of bone conduction speaker using I2C.


About AGC and DRC

Automatic Gain Control is able to make an output signal constant despite its input signal. For example, when multiple people use a microphone at the same time, the sound input levels are different because some of them might be farther than other people, but some of them might be using the microphone closer. In this case, AGC automatically adjusts the input level and makes the output level constant. The point is, the weaker input signal is, the stronger output signal is, and the stronger input signal is, the weaker output signal is. In addition, the gain on the TPA2016D2 can be selected -28dB to +30dB. Of course, -28dB outputs a silent sound and +30dB can output a louder sound.

Dynamic Range Compression is able to prevent a clipping noise when the sound volume is extremely high by compressing the dynamic range of audio signal and speaker. In addition, DRC can automatically adjust the audio signal level for the sound range that you want.


Once you understood these words, let’s get started with bone conduction speaker using I2C experiment.

Requirements

・Bone Conduction Transducer

img_3669

・TPA2016

s__41000966

・3.5mm Headphone Jack

s__40984581

・3.5mm Audio Cable

s__40984584

・Arduino Uno

s__40984579

・A breadboard

s__40984582

・Some Jumper Wires

img_3670


Circuit Diagram

bone-conduction-speaker-circuit-diagram

Assembly the components by following this circuit diagram. Remember that the goal of this experiment is to use I2C. I2C pins on the Arduino are A4 pin (SDA) and A5 pin (SCL), so connect each pin to the pins on TPA2016.


Programming

Before you look up the code below, you should download two libraries which are wire library and TPA2016 library. (Go to Arduino IDE -> Sketch -> Include library -> Manage Libraries -> Search these libraries and download them). After restarting Arduino IDE, go to File -> Example -> then you see “Adafruit TPA2016 Library and click on it. You will get the exactly same code below.

In the serial monitor, you should get this result.

 


Result

The sound from bone conduction speaker worked well! While the gain increases from -28dB to +30dB, the sound correspondingly becomes louder and when the speaker does not touch anywhere, you cannot hear any sound. Which means I2C also worked well between TPA2016 and Arduino. Pretty cool!

Lastly, check and watch the result video below.