Introduction: DFPlayer Based Audio Sampler With Capacitive Sensors


After experimenting with the construction of different synthesizers, I set out to build an audio sampler, which was easily replicable and inexpensive.

To have good audio quality (44.1 kHz) and sufficient storage capacity, the DFPlayer module was used, which uses micro SD memory cards to store up to 32 gigabytes of information. This module is only capable of playing one sound at a time, so we will use two.

Another requirement for the project is that the circuit can be adaptable to different interfaces, which is why we chose capacitive sensors instead of buttons.

Capacitive sensors can be activated with just the hand contact with any metal surface connected to the sensor.

For the reading of the sensors we will use an Arduino nano, due to its capabilities and small size.


6 different sounds

Activated by capacitive sensors.

Polyphony of 2 sounds at once.

Step 1: Materials and Tools

Step 2: How Does It Work

The sampler works as follows, using the ADTouch library we convert 6 of the analog ports of the Arduino Nano into capacitive sensors.

As a sensor we can use any piece of metal connected to one of these pins by means of a cable.

You can read more about the library and capacitive sensors at the following link

When one of these sensors is touched, the arduino detects a capacitance change and thereafter sends the order to execute the sound corresponding to that sensor to the DFPlayer modules.

Each DFPlayer module can only play one sound at a time, so to have the possibility of executing 2 sounds at a time the instrument uses 2 modules.

Step 3: Schematic

In the diagram we can see how the arduino and the two DFPlayer modules are connected

R1 and R2 (1 k) are to connect the modules to the DFPlayers.

R 3 4 5 and 6 (10k) are for mixing the outputs of channels l and r of the modules.

R 7 (330) is the protection resistance of a LED that will be used as an indicator that the arduino is being energized.

Step 4: Build the PCB

Next we will manufacture the plate using the heat transfer method, which is explained in this instructable:

6 pads have been placed on the board that allow the sampler to be used without the need for external sensors.

Step 5: Soldering the Components

Next we will solder the components.

First the resistors.

It is recommended to use headers to mount the Arduino and the modules without soldering them directly.

To solder the headers start with a pin, then check that it is well located, and then solder the rest of the pins.

Finally we will solder the connectors

Step 6: Install the Libraries

In this project we will use three libraries that we need to install:




In the following link you can see in detail how to install libraries in Arduino

Step 7: Code

Now we can upload the code to the Arduino board.

For this we must select the Arduino Nano board.

#include #include

int ref0, ref1, ref2, ref3, ref4, ref5; int th ;

SoftwareSerial mySerial(8, 9); // RX, TX DFPlayerMini_Fast myMP3;

SoftwareSerial mySerial2(10, 11); // RX, TX DFPlayerMini_Fast myMP32;

void setup() { int th = 550; // Serial.begin(9600); mySerial.begin(9600); mySerial2.begin(9600); myMP3.begin(mySerial); myMP32.begin(mySerial2); myMP3.volume(18); ref0 =, 500); ref1 =, 500); ref2 =, 500); ref3 =, 500); ref4 =, 500); ref5 =, 500);


void loop() {

int total1 =,20); int total2 =,20); int total3 =,20); int total4 =,20); int total5 =,20); int total6 =,20);

total1 -= ref0; total2 -= ref1; total3 -= ref2; total4 -= ref3; total5 -= ref4; total6 -= ref5; // // Serial.print(total1 > th); // Serial.print(total2 > th); // Serial.print(total3 > th); // Serial.print(total4 > th); // Serial.print(total5 > th); // Serial.println(total6 > th);

// Serial.print(total1); // Serial.print("\t"); // Serial.print(total2); // Serial.print("\t"); // Serial.print(total3); // Serial.print("\t"); // Serial.print(total4); // Serial.print("\t"); // Serial.print(total5); // Serial.print("\t"); // Serial.println(total6); if (total1 > 100 && total1 > th ) {; // Serial.println("o1"); }

if (total2 > 100 && total2 > th ) {; //Serial.println("o2"); }

if (total3 > 100 && total3 > th ) {; //Serial.println("o3");


if (total4 > 100 && total4 > th ) {; //Serial.println("o4");


if (total5 > 100 && total5 > th ) {; //Serial.println("o5");


if (total6 > 100 && total6 > th ) {; //Serial.println("o6");

} // do nothing delay(1); }

Step 8: Load the Sounds Into Memory Cards.

Now you can load your sounds in the micro SD cards

The format must be 44.1 kHz and 16 bit wav

You must upload 3 sounds on each SD card.

Step 9: The Interface

At this time you can already run your sampler with pads in the PCB, but you still have the possibility to customize it, choosing a case and different objects or metal surfaces to use as sensors.

In this case I used 3 wrist heads to which I put metal screws as a metal contact sound.

For this, connect the screws to the pins of the board by means of cables.

You can use any metallic object, conductive tape or experiment with conductive ink.

Instrument Contest

Participated in the
Instrument Contest