Introduction: Touch Sensitive Audio Desk Trays- Arduino

After having completed my first Arduino project (which can be found here) I wanted to try and create something that had more of a practical use. My idea behind this project was a way of aiding the visually impaired.

By the end of this project you will have created some touch sensitive desk trays which use audio labels that are re-recordable.

Feel free to modify it and make it your own once you have completed these steps.

During this tutorial I have provided serveral links to Arduino's own tutorials and more about Arduino can be found here.

Hovering over the image squares gives you more information.


Total time to complete: 1.5 hours (you do not need to complete all of this in one sitting)

Please note that as always you will need a computer with USB capabilities to program your Arduino.

Step 1: Things you will need

Step 2: Touch sensitive pin with 1 LED

Step 3: Making touch sensitive with 3 LEDs

Step 4: Connecting up the trays

Step 5: Attaching the speaker

Step 6: Attaching the microphones

Step 7: Adding a recording button

Step 8: Finished product

Step 1: Things You Will Need:

Materials

  • Arduino Uno (£22.19)
  • 9 V Mains Power Supply (500 mA minimum, 2.1mm center-positive plug) (£6.72)
  • USB cable type A Male to type B Male (£8.93)
  • Solder (£0.89) - missing from images
  • Wire
  • 3 * Conductive Desk Trays (£15)

Circuit Components

  • mini push button (£3.20)
  • 3 * LED (£2.89 for 75)
  • 3 * 150 ohm resistor (£1.04 for 100) (colour code = brown, green, brown, gold)
  • 3* 1 Mohm resistor (£0.20 for 20) (colour code = brown, black , black , yellow, brown)
  • Female to Male jumper pins (£1.70)
  • Male to Male jumper pins (£5.99)
  • 8-ohm speaker with cable (£2.48)

Hardware

Tools - missing from images

  • Soldering Iron (£8.99)
  • Wire strippers (£2.68)
  • Small flathead screw driver (£2)

Total Cost

Materials : £53.73

Circuit Components: £17.50

Hardware: £11.60

Tools : £13.67

£96.50

Step 2: Touch Sensitive Pin With 1 LED

You will need:

  • 1 * LED
  • 5 * Male-Male Jumper Pins
  • 1 * 150 ohm resistor (colour code = brown, green, brown, gold)
  • 1 * 1 Mohm resistor (colour code = brown, black , black , yellow, brown)
  • Breadboard
  • Arduino
  • Arduino USB cable


If this is your first Arduino project or you don't know how to set up a LED please look at step 2 and 3 here.

Attach the LED to pin 13 as in the Arduino Blink example.

To make the touch sensitive part we are going to use the CapacitiveSensor library.

The capacitiveSensor method toggles a microcontroller send pin to a new state and then waits for the receive pin to change to the same state as the send pin. A variable is incremented inside a while loop to time the receive pin's state change. The method then reports the variable's value, which is in arbitrary units.


We are going to use pin 7 as the send pin and pin 6 as the receive pin.


Connecting up the Capacitive Sensor:

  1. Connect pin 7 to the positive rail on the breadboard, this will allow us to use pin 7 for multiple sensors.
  2. Connect one end of the 1 Mohm resistor to pin 7 (using the positive rail)
  3. Connect the other end of the resistor to the receive pin ( pin 6)
  4. Connect the last jumper pin to the receiver pin (by connecting it on the same line on the breadboard). This will be the touch sensor.
  5. Make sure the Arduino/ Laptop is grounded. This can be done either by attaching your laptop to your charger while plugged in to the mains or by attaching a cable from Arduino ground to a water pipe ie. a radiator.


You are now ready to plug in the Arduino and upload the below programme. As you touch and let go of the touch sensor pin, the LED should switch on and off.

You may need to adjust groundHigh variable depending how sensitive you want your pin.


#include <CapacitiveSensor.h>

CapacitiveSensor sensor = CapacitiveSensor(7,6);  
int led = 13;
int groundHigh = 100;

void setup()                    
{
  pinMode(led, OUTPUT); 
  Serial.begin(9600);  
}

void loop()                    
{
   long total =  sensor.capacitiveSensorRaw(3);
   Serial.println(total);                  // print sensor output 

   if(total > groundHigh){
     digitalWrite(led, HIGH);  
   }else{
     digitalWrite(led, LOW);  
   } 
}

Step 3: Making Touch Sensitive With 3 LEDs

You will need:

  • 2 * LED
  • 6 * Male-Male Jumper Pins
  • 2 * 150 ohm resistor (colour code = brown, green, brown, gold)
  • 2 * 1 Mohm resistor (colour code = brown, black , black , yellow, brown)


I am using 3 trays so I wanted to have 3 LEDs. The setup is the same as the step before.


Connect the other 2 LEDs to pin 12 and 11.

The touch sensors are connected the same as before with one end of the 1 Mohm resistor to pin 7 (using the positive rail) and using receivers pin 5 and 4.

#include <CapacitiveSensor.h> 
CapacitiveSensor   sensor1 = CapacitiveSensor(7,6);       
CapacitiveSensor   sensor2   = CapacitiveSensor(7,5);       
CapacitiveSensor   sensor3 = CapacitiveSensor(7,4);        

int led1 = 13;
int led2 = 12;
int led3 = 11;

int groundHigh = 100;

void setup()                    
{
  pinMode(led1, OUTPUT);  
  pinMode(led2, OUTPUT);   
  pinMode(led3, OUTPUT); 
}


void loop()                    
{
  long total1 =  sensor1.capacitiveSensorRaw(3);
  long total2 =  sensor2.capacitiveSensorRaw(3);
  long total3 =  sensor3.capacitiveSensorRaw(3);

  if(total1 > groundHigh){
    digitalWrite(led1, HIGH);  
  }
  else if(total2 > groundHigh){
    digitalWrite(led2, HIGH); 
  }else if(total3 > groundHigh){
    digitalWrite(led3, HIGH);  
  }
  else{
    digitalWrite(led1, LOW);  
    digitalWrite(led2, LOW);  
    digitalWrite(led3, LOW);
  } 
}

Step 4: Connecting Up the Trays

You will need:

  • Wire
  • Terminal strip
  • Small flat headed screw driver
  • Solder
  • Soldering iron
  • Wire stripers

Now, instead of touching the touch sensitive pins to make the LEDs go on and off we want to use our trays.

Attaching the trays

  1. My wire was around 40cm long but you can vary this.
  2. Solder one side of the cable to the back of each of the trays
  3. Using a terminal strip, attach each of the cables to each of the sender pins.


When you touch the front of the tray one by one, each LED should go on in turn

Note. Make sure you put the trays on a non conductive surface ie. a plastic box.

We are now ready to make our trays speak!

Step 5: Attaching the Speaker

You will need:

  • Speaker

In this step we will add the speaker, in preperation for adding the microphone modules. However, until we add the microphones, we will not have anything to play out the speaker.

Make sure each of the speaker legs are on different rows on the breadboard (i.e. not connected to each other)

Step 6: Attaching the Microphone

You will need:

  • 3 * voice recording modules
  • 12 * Female-Male Jumper Pins
  • 6 * Male-Male Jumper Pins
  • Small flat headed screw driver

Now that we have the speaker we can remove the LED blocks, they were used as a preliminary testing step and are no longer needed.

Attaching the recording modules:

  1. Attach 2 male-male jumper pins into the terminal block on the microphone module
  2. Attach the other end of these pins to the speaker on the breadboard
  3. Attach female-male jumper pins to GND, PLAYE, REC and VCC
  4. Attach the Arduino 5V and GND to the breadboard on the opposite side to the touch sensitive blocks.
  5. Attach the GND and VCC from the recording module to ground and 5V.
  6. Attach the PLAYE pin to pin 10 on the Arduino (this can either be done directly or via the breadboard)

Repeat for the other 2 recording modules using pin 12 and 11.

Each of the microphone modules has two switches on them, one for Repeat and one for FT. make sure both of them are switched towards the microphone (as shown in the image).

More about these voice recording modules can be found here.

Just now, to record a message on the microphone modules, hold down the record button and say your message. Repeat for each microphone module.

When you touch each tray, you should now hear a different message.

#include <CapacitiveSensor.h>

CapacitiveSensor   sensor1 = CapacitiveSensor(7,6);      
CapacitiveSensor   sensor2   = CapacitiveSensor(7,5);       
CapacitiveSensor   sensor3 = CapacitiveSensor(7,4);    


int play1 = 12;
int play2 = 11;
int play3 = 10;

int groundHigh = 300;

void setup()                    
{
  pinMode(play1, OUTPUT);  
  pinMode(play2, OUTPUT);   
  pinMode(play3, OUTPUT);  
}

void loop()                    
{
  long total1 =  sensor1.capacitiveSensorRaw(3);
  long total2 =  sensor2.capacitiveSensorRaw(3);
  long total3 =  sensor3.capacitiveSensorRaw(3);
 
  if(total1 > groundHigh){
    playMessage(play1);  
  }
  else if(total2 > groundHigh){
    playMessage(play2);
  }else if(total3 > groundHigh){
    playMessage(play3); 
  }
}

void playMessage(int play){
  digitalWrite(play, 1);
  digitalWrite(play, 0);
}

Step 7: Adding a Recording Button

You will need:

  • Button
  • 2 * Male - Male Jumper Pins

Instead of pressing record for each individual microphone module, we want one button to record all.

The button is pressed and then a specific tray is touched. This with start recording for that particular tray. When you are finished you release the button. The next time you touch that tray you should hear your newly recorded message.

  1. Attach the recording pins to Arduino pins A0, A1, A2. These can be digital by naming them pins 14,15 and 16.
  2. Put the button in the breadboard
  3. Attach one of the legs to ground
  4. Attach the other button leg to pin 2

Make sure that the recording and play both correspond to the same same recording board for each tray.

#include <CapacitiveSensor.h>

int button = 2;

int play1 = 12;
int rec1 =  14; 
int play2 = 11;
int rec2 =  15;
int play3 = 10; 
int rec3 = 16;

CapacitiveSensor   sensor1 = CapacitiveSensor(7,6);       
CapacitiveSensor   sensor2   = CapacitiveSensor(7,5);       
CapacitiveSensor   sensor3 = CapacitiveSensor(7,4);

int touch = 75; 

void setup() { 
   pinMode(play1, OUTPUT);  
   pinMode(play2, OUTPUT);  
   pinMode(play3, OUTPUT); 
   pinMode(rec1, OUTPUT); 
   pinMode(rec2, OUTPUT);   
   pinMode(rec3, OUTPUT); 
   
   pinMode(button, INPUT);  // enable the internal pull up resistor  
   digitalWrite(button, HIGH);  
  
  Serial.begin(9600);  
}


void loop() { 

 long total1 =  sensor1.capacitiveSensorRaw(3);
 long total2 =  sensor2.capacitiveSensorRaw(3);
 long total3 =  sensor3.capacitiveSensorRaw(3);

 int buttonReading = digitalRead(button);
 
if(buttonReading == 1){
   if(total1 > touch)
   {
    playMessage(play1);
   }
   else if(total2 > touch)
   {
    playMessage(play2);
   }
   else if(total3 > touch)
   {
     playMessage(play3);
   }
  }else
  {
     if(total1 > touch)
   {
     recordMessage(rec1);
   }
   else if(total2 > touch)
   {
     recordMessage(rec2);
   }
   else if(total3 > touch)
   {
      recordMessage(rec3);
   }
  }

}


void playMessage(int play){
  digitalWrite(play, 1);
  digitalWrite(play, 0);
}

void recordMessage(int number){
 int buttonNumber = digitalRead(button);
 while(buttonNumber == 0)
 {
   buttonNumber = digitalRead(button);
   digitalWrite(number, 1);
 }
 digitalWrite(number  , 0);
}

Step 8: Finished Product


CONGRATULATIONS!!!

Instead of using the USB to power the Arduino we can now plug it into the mains (as we no longer need to change the code).

Robot Contest

Participated in the
Robot Contest

Full Spectrum Laser Contest

Participated in the
Full Spectrum Laser Contest

Arduino Contest

Participated in the
Arduino Contest