ECE 4180 Final Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE SDFileSystem_OldbutworkswithRTOS PinDetect

Portable Surface Transducer Jukebox

ECE 4180 Final Project

Team members

  • Bruna Correa
  • Lance Hudson
  • Javier Rodriguez

Jukebox Overview

This unique jukebox uses a surface transducer to essentially turn any hard surface (table, etc) into a resonant speaker. The user has the option to select one of out ten songs which were preselected and loaded onto the SD card. To begin, the user types their song choice into the keypad and is prompted to press “START” to begin the song. The user can end the song at any time by pressing “STOP,” which will redirect them back to the original selection menu.

Parts Required

  • 1x Mbed (LPC1768)

Mbed

  • 1x MicroSD card breakout (Sparkfun)

MicroSD Breakout

  • 1x Class D Amp (Sparkfun TPA2005)

Class D Amp

  • 1x Surface conduction transducer speaker (Generic)

Surface Transducer

  • 1x Breadboard speaker

Speaker

  • 2x standard pushbuttons

Pushbutton

  • 1x uLCD (Sparkfun 4DGL)

uLCD Screen

  • 1x Touch capacitance keypad (Sparkfun MPR121)

Touch Pad

  • 2x 6-volt breadboard battery packs

Battery Pack

  • 1x Standard 8x4x4 project box

Project Box

Design Challenges and Tradeoffs

One of the major challenges experienced when developing the Jukebox user interface was the synchronous playback function of the music. This required several instances of interrupt handling and pin detects. More specifically, regarding the “STOP” button, we realized that it was initially not possible to perform any pushbutton polling while the waveplayer function play() is active; if the “STOP” button was pressed while a song is playing, it would only be recognized when the song was finished. Therefore, we looked into editing the waveplayer library itself by passing an extern bool named “play” that was switched to true when “START” is pressed and false when “STOP” is pressed. Inside the play() function we added a logical check to ensure that this play variable is true, and if switched to false, it immediately breaks from the loop, thereby stopping the playback.

Several design tradeoffs had to be made for the benefit of portability. For example, we chose to not implement the original RGB LED strip because it added too much weight and occupied too much space inside the housing for the portable implementation desired. We believe that portability was a more valuable feature for the end user than an LED light show.

Schematic

The schematic used is shown below. For more detailed information on connection declarations and classifications in the software, refer to the code repository.

/media/uploads/jrod1096/schematic.jpeg

Demonstration Video

Committer:
jrod1096
Date:
Wed Dec 12 05:17:58 2018 +0000
Revision:
3:74066405c9fc
Surface Transducer Jukebox

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jrod1096 3:74066405c9fc 1 /*
jrod1096 3:74066405c9fc 2 Copyright (c) 2011 Anthony Buckton (abuckton [at] blackink [dot} net {dot} au)
jrod1096 3:74066405c9fc 3
jrod1096 3:74066405c9fc 4
jrod1096 3:74066405c9fc 5 Permission is hereby granted, free of charge, to any person obtaining a copy
jrod1096 3:74066405c9fc 6 of this software and associated documentation files (the "Software"), to deal
jrod1096 3:74066405c9fc 7 in the Software without restriction, including without limitation the rights
jrod1096 3:74066405c9fc 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
jrod1096 3:74066405c9fc 9 copies of the Software, and to permit persons to whom the Software is
jrod1096 3:74066405c9fc 10 furnished to do so, subject to the following conditions:
jrod1096 3:74066405c9fc 11
jrod1096 3:74066405c9fc 12 The above copyright notice and this permission notice shall be included in
jrod1096 3:74066405c9fc 13 all copies or substantial portions of the Software.
jrod1096 3:74066405c9fc 14
jrod1096 3:74066405c9fc 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
jrod1096 3:74066405c9fc 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
jrod1096 3:74066405c9fc 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
jrod1096 3:74066405c9fc 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
jrod1096 3:74066405c9fc 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jrod1096 3:74066405c9fc 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
jrod1096 3:74066405c9fc 21 THE SOFTWARE.
jrod1096 3:74066405c9fc 22
jrod1096 3:74066405c9fc 23 Parts written by Jim Lindblom of Sparkfun
jrod1096 3:74066405c9fc 24 Ported to mbed by A.Buckton, Feb 2011
jrod1096 3:74066405c9fc 25 */
jrod1096 3:74066405c9fc 26
jrod1096 3:74066405c9fc 27 #ifndef MPR121_H
jrod1096 3:74066405c9fc 28 #define MPR121_H
jrod1096 3:74066405c9fc 29
jrod1096 3:74066405c9fc 30 //using namespace std;
jrod1096 3:74066405c9fc 31
jrod1096 3:74066405c9fc 32 class Mpr121
jrod1096 3:74066405c9fc 33 {
jrod1096 3:74066405c9fc 34
jrod1096 3:74066405c9fc 35 public:
jrod1096 3:74066405c9fc 36 // i2c Addresses, bit-shifted
jrod1096 3:74066405c9fc 37 enum Address { ADD_VSS = 0xb4,// ADD->VSS = 0x5a <-wiring on Sparkfun board
jrod1096 3:74066405c9fc 38 ADD_VDD = 0xb6,// ADD->VDD = 0x5b
jrod1096 3:74066405c9fc 39 ADD_SCL = 0xb8,// ADD->SDA = 0x5c
jrod1096 3:74066405c9fc 40 ADD_SDA = 0xba // ADD->SCL = 0x5d
jrod1096 3:74066405c9fc 41 };
jrod1096 3:74066405c9fc 42
jrod1096 3:74066405c9fc 43 // Real initialiser, takes the i2c address of the device.
jrod1096 3:74066405c9fc 44 Mpr121(I2C *i2c, Address i2cAddress);
jrod1096 3:74066405c9fc 45
jrod1096 3:74066405c9fc 46 bool getProximityMode();
jrod1096 3:74066405c9fc 47
jrod1096 3:74066405c9fc 48 void setProximityMode(bool mode);
jrod1096 3:74066405c9fc 49
jrod1096 3:74066405c9fc 50 int readTouchData();
jrod1096 3:74066405c9fc 51
jrod1096 3:74066405c9fc 52 unsigned char read(int key);
jrod1096 3:74066405c9fc 53
jrod1096 3:74066405c9fc 54 int write(int address, unsigned char value);
jrod1096 3:74066405c9fc 55 int writeMany(int start, unsigned char* dataSet, int length);
jrod1096 3:74066405c9fc 56
jrod1096 3:74066405c9fc 57 void setElectrodeThreshold(int electrodeId, unsigned char touchThreshold, unsigned char releaseThreshold);
jrod1096 3:74066405c9fc 58
jrod1096 3:74066405c9fc 59 protected:
jrod1096 3:74066405c9fc 60 // Configures the MPR with standard settings. This is permitted to be overwritten by sub-classes.
jrod1096 3:74066405c9fc 61 void configureSettings();
jrod1096 3:74066405c9fc 62
jrod1096 3:74066405c9fc 63 private:
jrod1096 3:74066405c9fc 64 // The I2C bus instance.
jrod1096 3:74066405c9fc 65 I2C *i2c;
jrod1096 3:74066405c9fc 66
jrod1096 3:74066405c9fc 67 // i2c address of this mpr121
jrod1096 3:74066405c9fc 68 Address address;
jrod1096 3:74066405c9fc 69 };
jrod1096 3:74066405c9fc 70
jrod1096 3:74066405c9fc 71
jrod1096 3:74066405c9fc 72 // MPR121 Register Defines
jrod1096 3:74066405c9fc 73 #define MHD_R 0x2B
jrod1096 3:74066405c9fc 74 #define NHD_R 0x2C
jrod1096 3:74066405c9fc 75 #define NCL_R 0x2D
jrod1096 3:74066405c9fc 76 #define FDL_R 0x2E
jrod1096 3:74066405c9fc 77 #define MHD_F 0x2F
jrod1096 3:74066405c9fc 78 #define NHD_F 0x30
jrod1096 3:74066405c9fc 79 #define NCL_F 0x31
jrod1096 3:74066405c9fc 80 #define FDL_F 0x32
jrod1096 3:74066405c9fc 81 #define NHDT 0x33
jrod1096 3:74066405c9fc 82 #define NCLT 0x34
jrod1096 3:74066405c9fc 83 #define FDLT 0x35
jrod1096 3:74066405c9fc 84 // Proximity sensing controls
jrod1096 3:74066405c9fc 85 #define MHDPROXR 0x36
jrod1096 3:74066405c9fc 86 #define NHDPROXR 0x37
jrod1096 3:74066405c9fc 87 #define NCLPROXR 0x38
jrod1096 3:74066405c9fc 88 #define FDLPROXR 0x39
jrod1096 3:74066405c9fc 89 #define MHDPROXF 0x3A
jrod1096 3:74066405c9fc 90 #define NHDPROXF 0x3B
jrod1096 3:74066405c9fc 91 #define NCLPROXF 0x3C
jrod1096 3:74066405c9fc 92 #define FDLPROXF 0x3D
jrod1096 3:74066405c9fc 93 #define NHDPROXT 0x3E
jrod1096 3:74066405c9fc 94 #define NCLPROXT 0x3F
jrod1096 3:74066405c9fc 95 #define FDLPROXT 0x40
jrod1096 3:74066405c9fc 96 // Electrode Touch/Release thresholds
jrod1096 3:74066405c9fc 97 #define ELE0_T 0x41
jrod1096 3:74066405c9fc 98 #define ELE0_R 0x42
jrod1096 3:74066405c9fc 99 #define ELE1_T 0x43
jrod1096 3:74066405c9fc 100 #define ELE1_R 0x44
jrod1096 3:74066405c9fc 101 #define ELE2_T 0x45
jrod1096 3:74066405c9fc 102 #define ELE2_R 0x46
jrod1096 3:74066405c9fc 103 #define ELE3_T 0x47
jrod1096 3:74066405c9fc 104 #define ELE3_R 0x48
jrod1096 3:74066405c9fc 105 #define ELE4_T 0x49
jrod1096 3:74066405c9fc 106 #define ELE4_R 0x4A
jrod1096 3:74066405c9fc 107 #define ELE5_T 0x4B
jrod1096 3:74066405c9fc 108 #define ELE5_R 0x4C
jrod1096 3:74066405c9fc 109 #define ELE6_T 0x4D
jrod1096 3:74066405c9fc 110 #define ELE6_R 0x4E
jrod1096 3:74066405c9fc 111 #define ELE7_T 0x4F
jrod1096 3:74066405c9fc 112 #define ELE7_R 0x50
jrod1096 3:74066405c9fc 113 #define ELE8_T 0x51
jrod1096 3:74066405c9fc 114 #define ELE8_R 0x52
jrod1096 3:74066405c9fc 115 #define ELE9_T 0x53
jrod1096 3:74066405c9fc 116 #define ELE9_R 0x54
jrod1096 3:74066405c9fc 117 #define ELE10_T 0x55
jrod1096 3:74066405c9fc 118 #define ELE10_R 0x56
jrod1096 3:74066405c9fc 119 #define ELE11_T 0x57
jrod1096 3:74066405c9fc 120 #define ELE11_R 0x58
jrod1096 3:74066405c9fc 121 // Proximity Touch/Release thresholds
jrod1096 3:74066405c9fc 122 #define EPROXTTH 0x59
jrod1096 3:74066405c9fc 123 #define EPROXRTH 0x5A
jrod1096 3:74066405c9fc 124 // Debounce configuration
jrod1096 3:74066405c9fc 125 #define DEB_CFG 0x5B
jrod1096 3:74066405c9fc 126 // AFE- Analogue Front End configuration
jrod1096 3:74066405c9fc 127 #define AFE_CFG 0x5C
jrod1096 3:74066405c9fc 128 // Filter configuration
jrod1096 3:74066405c9fc 129 #define FIL_CFG 0x5D
jrod1096 3:74066405c9fc 130 // Electrode configuration - transistions to "active mode"
jrod1096 3:74066405c9fc 131 #define ELE_CFG 0x5E
jrod1096 3:74066405c9fc 132
jrod1096 3:74066405c9fc 133 #define GPIO_CTRL0 0x73
jrod1096 3:74066405c9fc 134 #define GPIO_CTRL1 0x74
jrod1096 3:74066405c9fc 135 #define GPIO_DATA 0x75
jrod1096 3:74066405c9fc 136 #define GPIO_DIR 0x76
jrod1096 3:74066405c9fc 137 #define GPIO_EN 0x77
jrod1096 3:74066405c9fc 138 #define GPIO_SET 0x78
jrod1096 3:74066405c9fc 139 #define GPIO_CLEAR 0x79
jrod1096 3:74066405c9fc 140 #define GPIO_TOGGLE 0x7A
jrod1096 3:74066405c9fc 141 // Auto configration registers
jrod1096 3:74066405c9fc 142 #define AUTO_CFG_0 0x7B
jrod1096 3:74066405c9fc 143 #define AUTO_CFG_U 0x7D
jrod1096 3:74066405c9fc 144 #define AUTO_CFG_L 0x7E
jrod1096 3:74066405c9fc 145 #define AUTO_CFG_T 0x7F
jrod1096 3:74066405c9fc 146
jrod1096 3:74066405c9fc 147 // Threshold defaults
jrod1096 3:74066405c9fc 148 // Electrode touch threshold
jrod1096 3:74066405c9fc 149 #define E_THR_T 0x0F
jrod1096 3:74066405c9fc 150 // Electrode release threshold
jrod1096 3:74066405c9fc 151 #define E_THR_R 0x0A
jrod1096 3:74066405c9fc 152 // Prox touch threshold
jrod1096 3:74066405c9fc 153 #define PROX_THR_T 0x02
jrod1096 3:74066405c9fc 154 // Prox release threshold
jrod1096 3:74066405c9fc 155 #define PROX_THR_R 0x02
jrod1096 3:74066405c9fc 156
jrod1096 3:74066405c9fc 157 #endif