Bluetooth Drumpads – Homemade Hardware Midterm

For my midterm, I decided to make drumpads that sent data thru bluetooth to a computer, so that I could eventually take this data and make a Processing sketch out of them. For my Playful Communication in Serious Research class, we are using these drumpads in order to understand how our brain waves use the natural rhythms of speech help us comprehend the sound. The experience would look something like this:

So the SMB that I created for this midterm was going to connect three Piezo sensors to a Bluetooth chip so that I could transmit that data to a Mac Mini or a Laptop that would be in the room connected to a screen. Here are the schematics and the board.

The process was pretty straightforward. I printed out my design, and acid etched the board, drilling holes so that I could connect my piezo sensors.




I soldered the board with my resistors, capacitor, and LEDs, and it looked great, but it turned out that the right side of my board was all connected to each other. I may have used too much solder, and when it melted, the solder connected all of the copper on the right side together. In order to fix this, I reheated my board to take off the main RFD22301 chip, and I had to be extra careful not to screw up the board, since the solder on the RFD22301 board was also malleable with the heat. I almost took the antenna off, but I was able to save it. You can see how it became crooked after fixing it.


Fortunately, I was able to fix the initial soldering issue, and my board worked. I was able to transmit piezo data from my board to my computer through Bluetooth. Here’s a video of it working, along with my code. The code is modified from Don Coleman‘s bluetooth code.


#include <RFduinoBLE.h>
#include <BLEPeripheral.h>

//create peripheral & service
BLEPeripheral blePeripheral;
BLEService piezoService = BLEService(“2220”);
BLEIntCharacteristic piezoCharacteristic = BLEIntCharacteristic(“2221”, BLERead | BLENotify | BLEBroadcast);
BLEDescriptor piezoDescriptor = BLEDescriptor(“2901”, “knock”);

#define PIEZO_PIN_LEFT 5
#define drumHitLEDPin 6
#define powerLEDPin 7
const int threshold = 15;

unsigned long lastReadTime = 0;
unsigned char readInterval = 100;

int piezo_state = 0;

void setup() {
Serial.println(“Piezo drumpad started”);

pinMode(drumHitLEDPin, OUTPUT);

pinMode(powerLEDPin, OUTPUT);
digitalWrite(powerLEDPin, HIGH);

//set advertised name and service

//add service and characteristic





void loop() {
//reset the LED
digitalWrite(drumHitLEDPin, LOW);


if (millis() – lastReadTime > readInterval) {
lastReadTime = millis();


void pollPiezoSensor() {
int piezo_right = analogRead(PIEZO_PIN_RIGHT);
int piezo_center = analogRead(PIEZO_PIN_CENTER);
int piezo_left = analogRead(PIEZO_PIN_LEFT);
// Serial.print(“right sensor: “);
// Serial.println(piezo_right);
// Serial.print(“center sensor: “);
// Serial.println(piezo_center);
Serial.print(“left sensor: “);

if (piezo_right >= threshold && piezo_center >= threshold && piezo_left >= threshold) {
piezo_state = 7;
} else if (piezo_center >= threshold && piezo_left >= threshold) {
piezo_state = 6;
} else if (piezo_right >= threshold && piezo_left >= threshold) {
piezo_state = 5;
} else if (piezo_right >= threshold && piezo_center >= threshold) {
piezo_state = 4;
} else if (piezo_left >= threshold) {
piezo_state = 3;
} else if (piezo_center >= threshold) {
piezo_state = 2;
} else if (piezo_right >= threshold) {
piezo_state = 1;
} else {
piezo_state = 0;

// only set the characteristic value if the piezo value has changed
if (piezoCharacteristic.value() != piezo_state) {
piezoCharacteristic.setValue(piezo_state); //this is the sendvalue characteristic that i need to change.
digitalWrite(drumHitLEDPin, HIGH);

delayMicroseconds(100); //delay to avoid overloading the serial port buffer