Group 8 – DIY Musical Instrument

logo

VIVA VIOLIN


PLANNING

Purpose

The aim of our product will be that it serves as a performance tool that provides an enjoyable and interactive experience for performers, artists or anyone that might be interested in violin as an instrument. This would be done using arduino and combining the inputs and outputs to achieve our end goal.Using lasers and buttons to control which laser is on , LDRs and a  button to control which notes are played and weather its a sharp or a flat.Adding on visual feedback using lEDs with the notes played.

Objective

We aim to create an interactive violin that’s not only interesting to play,  but also easy to make yourself out of a few  components and an arduino kit. Making it exciting to play has to do with the way  the violin looks in the end. So we decided instead of making it out traditionally from wood, we would make it out of a combination of wood and acrylic so that you can see all the intricate parts of the circuit and what goes into it.

Target Audience

After doing our market research we agreed as  a group to target performers, artists or anyone who enjoys playing musical instruments in general that would like to experiment .Its a DIY  musical instrument making it simple enough to make, put together and play with the basic knowledge of how violin or any musical instrument operates.

Market Research

As a group, we all agreed that a more modern looking violin would appeal to our target audience more. Since we are targeted towards musicians, both professions and armatures, we wanted to design a violin more eye catching and made out of other materials other than the basic traditional wood. We looked at other modern violins that existed, and from what we found most modern electric violins tend to be hollow made out of brightly colours plastic. We also looked into DIY violins and electric string instruments like an electric guitar, or the more playful version, guitar hero, to get some ideas on how we were going to create our own electric violin. We found that most DIY violins were made out of cardboard and don’t tend to have slick finishes.

 

Initial Brainstorm

We explored both the design as well as technicalities of violin when we first thought of the project . Coming up with two mind maps that each include information that we already know or gathered through market research to reach our final idea

brainstorm-design

page-layout3-8

Idea Process

Creating a non typical looking violin
◦           Making it out of few components and easy to make to establish the DIY aspect of the product
◦           Having same functionality as violin

1. Using buttons on the handle to mimic the motion of fingers pressing on the string

2. Using 4 lasers parallel to 4 stings

3 . Using a bow to trigger the sound and not moving away from its original functionality
◦           Attention to detail :

1 . The 2 laser receivers are spaced so that only one laser hits the receiver at a time

2. The bow is curved near the right end so that it’s more intuitive to the user to hold that end
◦           Extra functionality : button added on the bow to control sharps

brainstorm-design4

Project organisation and time management

Gantt chart ganttchartcio
 Task list

ganttchartcio


CONSTRUCTION

Low-fi Prototype

Week 1: 19/11/2018 – 25/11/2018

We began the Construction process with Low – fi prototypes. We created sketches on the features of the violin and where we want to place all the sensors, lasers and buttons referencing to how you typically play a violin

We then moved on to a foam prototype of our violin so we could observe the dimensions of a violin and how all our components would fit on to the violin

untitled3

afdkadhfadjfajfhaddfdffdwhatsapp-image-2018-12-04-at-11-06-57    whatsapp-image-2018-12-04-at-11-08-32    whatsapp-image-2018-12-04-at-11-08-321

 

Circuit Wiring

Week 2: 26/11/2018 – 02/12/2018

The four laser emitters and five buttons were wired up with colour coded wires and heatshrink tubing. This allowed for the flexibility in their placement on the violin, along with a uniform visual effect of the wiring. The wires were initially kept longer than needed in order to test the ideal placement of each component

 

         whatsapp-image-2018-12-04-at-12-04-50 whatsapp-image-2018-12-04-at-12-04-52 whatsapp-image-2018-12-04-at-12-05-00 whatsapp-image-2018-12-04-at-12-05-011

 

Testing Circuit

Week 3: 03/12/2018 – 09/12/2018

The testing of the circuit was carried out in three stages:

  1. Testing the laser and button combination
  2. Testing the LDR when lit by the laser/button combo (giving us the ideal LDR sensitivity value for our lasers)
  3. Testing the code for 4 laser/button combos and 2 LDRs with a button

The third testing stage was carried out with the code given below:

int ldr[] = {0, 1}; // A0, A1

int laser_btn[] = {2, 3, 4, 5}; // laser buttons

int bow_btn = 10;

char notes[] = {‘C’, ‘D’ , ‘E’, ‘F’, ‘G’, ‘A’, ‘B’};

String sharps[] = {“C#”, “D#”, “no sound”, “F#”, “G#”, “A#”};

int notesLen = sizeof(notes) / sizeof(char);

int sharpsLen = sizeof(sharps) / sizeof(String);

 

//TODO:

//- get sounds working with piezo

//- add potentiometer to set volume (or tone length/sustain)

 

void setup() {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

pinMode(laser_btn[i], INPUT);

}//endfor

pinMode(bow_btn, INPUT);

Serial.begin(9600);

}

void loop() {

if (isOn(bow_btn)) {

playSharps();

}

else {

playNotes();

}

delay(20);

}

void playNotes() {

if (isLit(ldr[0])) {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

if (isOn(laser_btn[i])) Serial.println(notes[i]);

}//endfor

 

} else if (isLit(ldr[1])) {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)) – 1; i++) {

if (isOn(laser_btn[i])) {

Serial.println(notes[notesLen – (3 – i)]);

}//endif

}//endfor

}//end elif

}

void playSharps() {

if (isLit(ldr[0])) {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

if (isOn(laser_btn[i])) Serial.println(sharps[i]);

}//endfor

 

} else if (isLit(ldr[1])) {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)) – 2; i++) {

if (isOn(laser_btn[i])) {

Serial.println(sharps[sharpsLen – (2-i)]);

}//endif

}//endfor

}//end elif

}//end func

 

bool isLit (int sensor) {

bool lit = false;

int lightLevel = analogRead(sensor);

if (lightLevel <= 30) {

lit = true;

}

return lit;

}

// return true if button on

bool isOn(int btn) {

int bState = digitalRead(btn);

return !bState;
}

          whatsapp-image-2018-12-04-at-12-04-55 whatsapp-image-2018-12-04-at-12-05-013 whatsapp-image-2018-12-04-at-13-03-43 whatsapp-image-2018-12-04-at-12-35-10

 

Start Construction of Final Product

Week 3/4: 05/12/2018 – 10/12/2018

Two sheets of blue acrylic were laser cut to the design and size we decided on. Then an opening was drilled in the top face to push the lasers through so that app the wires and contained and the lasers and the only thing visible on top. After that the circuit was fastened to the bottom and it was tome to attach both faces. Using 3 clear acrylic supports glued near the middle and right of the violin the put together the 2 faces , they were then clamped to keep everything in place . The bow was next , button was added , two holes were drawn to put in the two receivers and curved near the end. Lastly the handle was attached after being shaped and the 4 buttons were attracted to it .

whatsapp-image-2018-12-10-at-17-12-111  whatsapp-image-2018-12-10-at-17-12-11  whatsapp-image-2018-12-10-at-17-12-12


MAKER MANUAL

whatsapp-image-2018-12-11-at-11-03-45

Intro

An interactive, modern, fun violin to be able to build and play yourself! Any age of any music skills can be able to play this futuristic instrument. Combination of both technological and traditional sounds.

What you need 

  • 2x Texas Instruments CD4051BE Analogue Multiplexer / Demultiplexer – https://www.rapidonline.com/Catalogue/Search?Query=4051%20multiplexer
  • 1x Long 6 Pin Female Stackable Header Range – https://www.proto-pic.co.uk/long-pin-female-stackable-header-range.html
  • 2x Long 8 Pin Female Stackable Header Range – https://www.proto-pic.co.uk/long-pin-female-stackable-header-range.html
  • 1x Long 10 Pin Female Stackable Header Range – https://www.proto-pic.co.uk/long-pin-female-stackable-header-range.html
  • 1x Adafruit “Music Maker” MP3 Shield for Arduino – https://thepihut.com/products/adafruit-music-maker-mp3-shield-for-arduino-mp3-ogg-wave OR piezo
  • 2x LDRs
  • Wires
  • 5x buttons
  • 1x Arduino board
  • 4x Generic 5v laser emitter
  • 7x 10k ohm resistors

button laserreceiver lasers41ghckwbo6l-_sx342_1790-00arduino_uno_dip_01pp5pshf

How to Build

  1. Put together the arduino board using the fritzing sketch found below

whatsapp-image-2018-12-10-at-19-00-452. Use the cut outs of the violin provided to create the base structure of the violin. Attach together all the pieces together except the final top piece to allow the arduino circuit to fit inside

dhd whatsapp-image-2018-12-10-at-19-16-10-1 whatsapp-image-2018-12-10-at-19-16-10 whatsapp-image-2018-12-10-at-19-16-11-1 

3. Attach the buttons and LDRs to the handle and bow of the violin

hfhffhhfhffhfhfhfhfhfhfhfhfhffadfafccbcbhfhfhff whatsapp-image-2018-12-10-at-19-16-12-1 whatsapp-image-2018-12-10-at-19-16-13-1 whatsapp-image-2018-12-10-at-19-16-12

4. Feed through the lasers through the slit of the top cut out of the violin and stick them down in a line

whatsapp-image-2018-12-11-at-11-03-46

5. Attach the top of the violin with a glue and fit in the arduino circuit 

cbncbnwhatsapp-image-2018-12-10-at-19-16-14-1 whatsapp-image-2018-12-10-at-19-16-14 whatsapp-image-2018-12-10-at-19-16-16-1

dfghdfgkdfhgdcbncbnfhgdfdwhatsapp-image-2018-12-10-at-19-16-15 whatsapp-image-2018-12-10-at-19-16-16

6. Plug in the violin, upload the code and enjoy Viva!!!

whatsapp-image-2018-12-11-at-11-03-50-2 whatsapp-image-2018-12-11-at-11-03-50-1 whatsapp-image-2018-12-11-at-11-03-49

whatsapp-image-2018-12-11-at-11-03-49-1 whatsapp-image-2018-12-11-at-11-03-48-1 whatsapp-image-2018-12-11-at-11-03-47

 

Programmer guide – Code

The code for the final version of the Viva violin is given below. The I/O variables define the pins used on the Arduino, the notes[] and sharps[] arrays define what notes will be played, and the lightThreshold variable controls the value of the LDR sensor reading when hit by a laser. The code includes a main program, along with a header file “pitches.h” (full pitches.h file can be found here: https://www.arduino.cc/en/Tutorial/toneMelody)

The program’s functions explained:

  • Setup initialises the button inputs and sets up the serial port for debugging.
  • Loop plays either sharp or regular notes depending on whether the button on the bow is pressed.
  • playNotes checks which LDR is hit by a laser, and plays a corresponding note (notes 0-3 for LDR0, notes 4-8 for LDR1) from the notes[] array.
  • playSharps works similarly to the playNotes function, but using the sharps[] array.
  • isLit returns true or false depending on whether the LDR is hit by a laser.
  • isOn returns true if the given button has been pressed down.


#include "pitches.h"

// define I/O

int ldr[] = {0, 1}; // A0, A1

int laser_btn[] = {2, 3, 4, 5}; // laser buttons

int bow_btn = 10;

int speakerPin = 9;

 

// define notes used

int notes[] = { NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5};

int sharps[] = { NOTE_CS4, NOTE_DS4, 0, NOTE_FS4, NOTE_GS4, NOTE_AS4, 0, NOTE_CS5};

int notesLen = sizeof(notes) / sizeof(int);

int sharpsLen = sizeof(sharps) / sizeof(int);

 

// define note duration

int noteDuration = 1000 / 4; // quarter note

 

// define LDR sensitivity

int lightThreshold = 30;  // Increase this number to 50-150 if the function isn’t triggering with your laser emitters

 

void setup() {

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

pinMode(laser_btn[i], INPUT);

}//endfor

pinMode(bow_btn, INPUT);

// Serial kept for confirming everything works on Serial monitor

// Can be removed once everything works

Serial.begin(9600);

Serial.println(notesLen);

}

void loop() {

// if bow button pressed

if (isOn(bow_btn))

{

playSharps();

}

else {

playNotes();

}

delay(20);

}

 

// Play regular notes

void playNotes() {

// if LDR 0 on

if (isLit(ldr[0])) {

// for each laser (plays notes 0 to 3)

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

// if laser button on

if (isOn(laser_btn[i])) {

Serial.println(notes[i]);

tone(speakerPin, notes[i], noteDuration);

}//endif

}//endfor

 

// if LDR 1 on

} else if (isLit(ldr[1])) {

// for each laser (plays notes 4 to 8)

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

if (isOn(laser_btn[i])) {

Serial.println(notes[notesLen – (4 – i)]);

tone(speakerPin, notes[notesLen – (4 – i)], noteDuration);

}//endif

}//endfor

}//end elif

}

 

// Play sharp notes

void playSharps() {

if (isLit(ldr[0])) {

// plays notes 0 to 3

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

if (isOn(laser_btn[i])) {

Serial.println(sharps[i]);

tone(speakerPin, sharps[i], noteDuration);

}//endif

}//endfor

 

} else if (isLit(ldr[1])) {

// plays notes 4 to 8

for (int i = 0; i < (sizeof(laser_btn) / sizeof(int)); i++) {

if (isOn(laser_btn[i])) {

Serial.println(sharps[sharpsLen – (4 – i)]);

tone(speakerPin, sharps[sharpsLen – (4 – i)], noteDuration);

}//endif

}//endfor

}//end elif

}//end func

 

// Return true if LDR is lit by laser

bool isLit (int sensor) {

bool lit = false;

int lightLevel = analogRead(sensor);

if (lightLevel <= lightThreshold) {

lit = true;

}

return lit;

}

 

// Return true if button pressed down

bool isOn(int btn) {

int bState = digitalRead(btn);

return !bState;

}


Pitches.h file:

/*************************************************

* Public Constants

*************************************************/

 

#define NOTE_C4  262

#define NOTE_CS4 277

#define NOTE_D4  294

#define NOTE_DS4 311

#define NOTE_E4  330

#define NOTE_F4  349

#define NOTE_FS4 370

#define NOTE_G4  392

#define NOTE_GS4 415

#define NOTE_A4  440

#define NOTE_AS4 466

#define NOTE_B4  494

#define NOTE_C5  523

#define NOTE_CS5 554

#define NOTE_D5  587

#define NOTE_DS5 622

#define NOTE_E5  659

#define NOTE_F5  698

#define NOTE_FS5 740

#define NOTE_G5  784

#define NOTE_GS5 831

#define NOTE_A5  880

#define NOTE_AS5 932

#define NOTE_B5  988

How to Play

  1. Hold the end of the violin between your chin and left shoulder, in the same fashion as a regular violin. Hold the neck of the violin with your left hand and hold the bow in your right.
  2. Place the bow in line with the acrylic panel in front of the laser strings.
  3. Hold one of the four buttons on the neck to light up the corresponding laser emitter.
  4. Move the bow left or right to aim the LDR sensors with the light produced. Hitting the leftmost sensor will produce on of the notes CDEF depending on which laser/button is on, and the rightmost sensor will produce one of the notes GABC.
  5. Hold the button on the bow to obtain the sharp note equivalents of whichever laser/button is on. Remember that note all notes have a sharp note.

 

Interactions

buttons press handle -> laser one

laser on -> over LDRs -> sound of note

buttom press bow -> sharp notes

 

Design Decisions

The Viva violin uses four laser emitters to act as the “strings” of the instrument. This was inspired by the literal interpretation of the term “light strings”. The four lasers themselves are laid out on the violin in a row, similar to how strings are placed on a classic violin. Lasers were chosen over LEDs as they were found to be much more accurate for readings from a light sensor (used on the instrument’s bow).

The four buttons on the neck of the violin were used as an analogue to fretting strings. Each button is wired directly to one of the laser strings to emphasise this analogous connection.

The bow was kept similar to a classic violin bow in regard to its movement. It needs to be swiped across the strings to produce a note. Light dependent resistors were chosen as the sensors for the strings, as they are often found in common Arduino kits. Accessibility of components was an important factor in the creation of the instrument to ensure a simple prototype could be made by anyone with an Arduino kit.

The frame of the violin was created with a combination of wood and acrylic. This was done to connect it with both classic and electric violin design. The internals of the violin were left open using only clear acrylic panels as support beams to encourage modification of the DIY instrument. All the electronics are connected on a breadboard and can be removed or replaced depending on the needs of the instrument.

The Viva violin can produce 12 notes, starting from middle C (C4) to an octave above (C5). The initial plan was to use an Arduino music instrument shield which can emulate a multitude of instruments, including a classic violin using MIDI commands. Due to ordering time constraints, an alternative had to be used. The Piezo buzzer was chosen as an effective compromise, as it allowed the instrument to produce the required notes, along with being very simple to program, simplifying the sound modification for a DIY user.

 

Leave a Reply