- Project must be interactive.
- Project must use an microprocessor running code written by you.
- Project must include a soldered circuit board or shield. You may use header pins and other connectors (JST, headphone jacks, barrel jacks, etc) to preserve your components. You cannot use a breadboard in your final project (though you can of course use it during the design process).
- Project must be housed in an enclosure of some kind. The electronics should not be exposed (unless that is a meaningful part of your design, discuss with professor). The enclosure, or parts of it, may be 3D printed, but does not have to be.
- Your project may use other shields and sensors that we have not covered in this course, but use your judgment. The professor may not be able to assist you with things he has never used before.
- Your project may communicate back to a computer running other software, but doesn't have to.
- 1x 5v Power Source
- 1x Auxilary Cord
- 1x Arduino UNO
- 1x Adafruit WAV Trigger
- 1x RGB LED
- 2x metal keyrings
- 2x latch buttons
- 4x custom switches
- 1x custom built wooden enclosure
- 1x Incarcerated Fairy
- A lot of aluminum wire
- A lot of insulated wires
- A lot of hot glue
- A lot of soldering material
- And a lot more...!
The Enchanted Harp of the Fae
(+2 charisma when in inventory)
I was debating cropping this, but if anything
I'm proud of the abducted cactus my friend painted for me
(+2 charisma when in inventory)
I was debating cropping this, but if anything
I'm proud of the abducted cactus my friend painted for me
For my final project, I decided to dive in and dedicate all my energy to creating an interactive, audio-based prop. The result is as seen above: a wooden conglomeration of metal, electricity, blood, sweat, and tears that can be played by just about anyone.
The project itself includes an Adafruit Wav Trigger, an Arduino UNO, an RGB LED, 4 custom switches, two buttons, a ton of wires, and an accelerometer to expand functionality of the Arduino. There's also a lot of fire and brimstone soldering inside with two key rings acting as power/ground hubs. At the moment, there are four modes:
It's worth noting that while the experimental branch-- activated by pressing two latch mode buttons-- currently plays random tracks on the wav trigger, future plans would involve programming a better system that allows for active song creation via a music making program.
The project itself includes an Adafruit Wav Trigger, an Arduino UNO, an RGB LED, 4 custom switches, two buttons, a ton of wires, and an accelerometer to expand functionality of the Arduino. There's also a lot of fire and brimstone soldering inside with two key rings acting as power/ground hubs. At the moment, there are four modes:
- Default: Plays short bursts of music
- Looped: Plays track, and then loops it
- Effects: Plays short sound effects
- Experimental: Plays random tracks*
It's worth noting that while the experimental branch-- activated by pressing two latch mode buttons-- currently plays random tracks on the wav trigger, future plans would involve programming a better system that allows for active song creation via a music making program.
[ Video on Vimeo ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | /************************************************* * Pin / Library Setup *************************************************/ #include <SoftwareSerial.h> #include "Adafruit_Soundboard.h" #include<Wire.h> // Accelerometer / Gyro const int MPU_addr=0x68; int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ; // WAV TRIGGER #define SFX_TX 11 #define SFX_RX 12 #define SFX_RST 10 SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX); Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, SFX_RST); // RGB LED const int blueLED = 6; const int greenLED = 5; const int redLED = 3; // MODE BUTTONS const int bgModeButton = 8; const int fxModeButton = 9; // BUTTONS const int b1 = A0; const int b2 = A1; const int b3 = A2; const int b4 = A3; // LOGIC VARIABLES int stateOfBoard = 0; int loopingTrack = 0; int fairySongs[] = {6,4,2,9,3}; boolean fairyIsAwake = false; boolean isLooping = false; char oldMembraneKey; /************************************************* * Initial Startup *************************************************/ void setup() { // COMMUNICATION // Serial, sfx, and accelerometer, respectively Serial.begin(9600); ss.begin(9600); Wire.begin(); Wire.beginTransmission(MPU_addr); Wire.write(0x6B); Wire.write(0); Wire.endTransmission(true); // SET PIN MODES // leds pinMode(redLED, OUTPUT); pinMode(blueLED, OUTPUT); pinMode(greenLED, OUTPUT); // buttons pinMode(bgModeButton, INPUT); pinMode(fxModeButton, INPUT); pinMode(b1, INPUT); pinMode(b2, INPUT); pinMode(b3, INPUT); pinMode(b4, INPUT); } /************************************************* * Loop *************************************************/ void loop() { // Checks if harp is picked up moveThatFey(); // Control Mode & Settings setMode(); // Change LEDs and Sounds based on setMode() feedback modeHandling(); ledHandling(); // If in loop mode, enable looping loopThatBg(); delay(5); } /************************************************* * My Functions ************************************************* +++ TABLE OF CONTENTS +++ 1.0 // State Logic 2.0 // LEDs 3.0 // Looping 4.0 // Other */ // 1.0 STATE LOGIC // change board mode or "state" // Uses larger buttons located near base void setMode() { int bgModeState = digitalRead(bgModeButton); int fxModeState = digitalRead(fxModeButton); // mode selection // EXPERIMENTAL MODE if (fxModeState == HIGH && bgModeState == HIGH) { stateOfBoard = 3; isLooping = false; // FX MODE } else if (fxModeState == HIGH) { stateOfBoard = 2; isLooping = false; // LOOP MODE } else if (bgModeState == HIGH) { stateOfBoard = 1; isLooping = true; // DEFAULT, NON LOOP MUSIC } else { stateOfBoard = 0; isLooping = false; } } // depending on mode, play certain sound list // case 3 is special, activates looping void modeHandling() { int b1State = digitalRead(b1); int b2State = digitalRead(b2); int b3State = digitalRead(b3); int b4State = digitalRead(b4); switch (stateOfBoard) { // NON LOOP: WHITE case 0: if (b1State == HIGH) { sfx.playTrack(4); // project k ish } else if (b2State == HIGH) { sfx.playTrack(2); // medieval entry } else if (b3State == HIGH) { sfx.playTrack(6); // happy tune } else if (b4State == HIGH) { sfx.playTrack(3); // march } break; // LOOP MODE: BLUE case 1: if (b1State == HIGH) { sfx.playTrack(4); // project k ish loopingTrack = 4; } else if (b2State == HIGH) { sfx.playTrack(2); // medieval entry loopingTrack = 2; } else if (b3State == HIGH) { sfx.playTrack(6); // happy tune loopingTrack = 6; } else if (b4State == HIGH) { sfx.playTrack(9); // medieval entry loopingTrack = 9; } break; // FX MODE: RED case 2: if (b1State == HIGH) { sfx.playTrack(1); // magic fx } else if (b2State == HIGH) { sfx.playTrack(9); // harpsichord } else if (b3State == HIGH) { sfx.playTrack(5); // monster } else if (b4State == HIGH) { sfx.playTrack(3); // march } break; // EXPERIMENTAL MODE, PURPLE (RANDOM) case 3: int fairyChoice = random(0,4); sfx.playTrack(fairySongs[fairyChoice]); break; default: break; } } // 2.0 LEDS // depending on state of board, change LED // Fade in over short time void ledHandling() { turnOffLEDs(); switch (stateOfBoard) { case 0: digitalWrite(greenLED, HIGH); digitalWrite(redLED, HIGH); digitalWrite(blueLED, HIGH); break; case 1: digitalWrite(blueLED, HIGH); break; case 2: digitalWrite(redLED, HIGH); break; case 3: digitalWrite(redLED, HIGH); digitalWrite(blueLED, HIGH); break; default: break; } } // turn off LEDs on state change void turnOffLEDs() { digitalWrite(redLED, LOW); digitalWrite(greenLED, LOW); digitalWrite(blueLED, LOW); } // 3.0 LOOPING // stop loop if mode is changed // disables loop for 1st and 3rd mode void pauseAndStopLoop() { isLooping = false; loopingTrack = 0; sfx.stop(); } // loop sound if mode 2 void loopThatBg() { if (isLooping == true && loopingTrack != 0) { sfx.playTrack(loopingTrack); } } // 4.0 OTHER void moveThatFey() { // Get Data from Accelerometer Wire.beginTransmission(MPU_addr); Wire.write(0x3B); Wire.endTransmission(false); Wire.requestFrom(MPU_addr,14,true); AcX=Wire.read()<<8|Wire.read(); AcY=Wire.read()<<8|Wire.read(); AcZ=Wire.read()<<8|Wire.read(); Tmp=Wire.read()<<8|Wire.read(); GyX=Wire.read()<<8|Wire.read(); GyY=Wire.read()<<8|Wire.read(); GyZ=Wire.read()<<8|Wire.read(); int mapMovement = (map(AcZ, -10000, 10000, 0, 100)); mapMovement = -mapMovement; Serial.println(mapMovement); if (-1 * mapMovement > 20) { if (fairyIsAwake == false) { fairyIsAwake = true; sfx.playTrack(1); } } } /* For testing only void variableTest() { Serial.println("state of board is:"+stateOfBoard); Serial.println("fx button is:"+fxModeState); Serial.println("bg button is:"+bgModeState); Serial.println("b1 is:"+b1State); Serial.println("b2 is:"+b2State); Serial.println("b3 is:"+b3State); Serial.println("b4 is:"+b4State); Serial.println("b5 is:"+b5State); } |
And with that, I go to sleep, like many of my fallen finals comrades before me.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.