Project 2 Final (week 6) – Rayya Hosn & Laurence Osborne

The project has been finalised and all the improvements have been made to the model to give it it’s final effect of a piano conducting music.

Fritzing

fritzing1

As seen above, the whole breadboard is used as we are connecting it to the foils and LEDs. Each of which have 6 of them. (because there are 6 keys/notes on our model)

FullSizeRender (1)

As for the foils seen above, they have come a long way since the previous weeks. We have figured out the secret to a smooth playing note in our model has to do with a clean designed foil. Which has proved right without any temperamental functions this time.

The Model

Final steps of completing the model are seen in the images below

And now it is ready to be peeled off as the paint has dried, in order to place the foils on top of the white keys and the overall effect will be complete.

This is the end Product with the foils and the LED bulbs inserted. Remembering that the Arduino breadboard is hidden underneath.

IMG_5798

As seen above, legs have been added to give the piano a platform, as a real piano has.

END RESULT!!

A link of the working model is found here of the notes, and the LED linked to each individual note working simultaneously.

IMG_5795

 

 

Advertisements

Project 2 Week 5 – Rayya Hosn & Laurence Osborne

Sensor

With the struggle of getting the LEDs to work, research was done and this tutorial of Foil Sensors was found 

http://www.instructables.com/id/Capacitive-Touch-Arduino-Keyboard-Piano/

We have worked through this to create this circuit. For the next step, we will be needing to connect the LEDs to the foil sensors, and to make each foil a key on the keyboard in order to play out a note.

Using the research we found, we had to download the CapeSense Arduino library in order to run the code that was applicable to the foil sensors seen above.

The Model

The breadboard can now be attached to the model in order to finalize the design and conncet all the wires to their corresponding keys 

 

The Code

This week, we have combined the Notes, and the Leds.

Capture

Project 2 Week 4 – Rayya Hosn and Laurence Osborne

Sensor

After experimenting with the touch sensors since their arrival, we found it to be quite interesting and fun to play around. in the photos below it is illustrated when the LED goes on as it is touched, and going off as the finger moves away from it and then back on as it is touched again.

The code for this will be pasted here by Laurence.

Model

As for the model, it has now progessed to fit each individual sensor (six of them) as keys on the keyboard.img_5266.jpg

As seen in the holes below, this is left vacant on purpose to allow the wires to pass through from male to female. From the arduino board, to the touch sensors.

img_5268.jpg

The holes are where the LED bulbs will shine their specific light accordingly.

Project 2 Week 3, Rayya Hosn & Laurence Osborne

The Parts Included

Now that the RGB LED’s that we ordered online have arrived, we decided to explore how they function and how they fit into our model. (which we are now able to carry on with it since we have got the exact sizes of the touch sensor and the LEDs)

RGB’s enable an LED to emit different colours either Red, Green, Blue or a combination of these.

kl

Using Arduino we successfully managed to enable an LED to produce a variety of colours.pottttyy

The Model

With the measurements taken, we now have a general shape to work with. The keys are going to be 30mm each. this is because the touch sensors are 25mm and we want to give that extra 2.5mm on each sides of the keys to be able to separate them.

FullSizeRender (3)

Week 2 Project 2 – Rayya Hosn, Laurence Osborne

The Project

After researching the abilities of Arduino with our vision for the project, we have found 2 routes in which we can execute follow through with.

The first is to use touch sensors underneath each key (we are thinking of having around 7 or 8 keyboard keys), and an RGB LED per key. The LED will light up in a different color according to the integer values.

The other route is to have proximity sensors. There will be 1 proximity sensor between 2 keys. This will then light up on its own through the calculation of distance. What that means is that the key that is closest to the sensor will be sent a certain amount of integers to light up in a color accordingly.

fullsizerender-2

The Code

As for coding each key with a different color lighting, we thought it would be a good idea to label each key as a different note, like an actual playing piano. The notes will then act as a button as seen below.

int button_C = 2;
int button_D = 3;
int button_E = 4;
int button_F = 5;
int button_G = 6;
int button_A = 7;
int button_B = 8;
int button_Cup = 9;

int speaker = 13;

int buttonstate_C = 0;
int buttonstate_D = 0;
int buttonstate_E = 0;
int buttonstate_F = 0;
int buttonstate_G = 0;
int buttonstate_A = 0;
int buttonstate_B = 0;
int buttonstate_Cup = 0;

//NOTES         'c'  , 'd',  'e',  'f',  'g', 'a',  'b',  'C'
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 }; //freq
int Cur_tone = 0;

void setup()
{
  pinMode(button_C, INPUT);
  pinMode(button_D, INPUT);
  pinMode(button_E, INPUT);
  pinMode(button_F, INPUT);
  pinMode(button_G, INPUT);
  pinMode(button_A, INPUT);
  pinMode(button_B, INPUT);
  pinMode(button_Cup, INPUT);

  pinMode(speaker, OUTPUT);
}

void loop()
{
	buttonstate_C = digitalRead(button_C);
	buttonstate_D = digitalRead(button_D);
	buttonstate_E = digitalRead(button_E);
	buttonstate_F = digitalRead(button_F);
	buttonstate_G = digitalRead(button_G);
	buttonstate_A = digitalRead(button_A);
	buttonstate_B = digitalRead(button_B);
	buttonstate_Cup = digitalRead(button_Cup);

	if((buttonstate_C == HIGH) || (buttonstate_E == HIGH) || 
		(buttonstate_G == HIGH) || (buttonstate_D == HIGH) || 
		(buttonstate_F == HIGH) || (buttonstate_A == HIGH) || 
		(buttonstate_B == HIGH) || (buttonstate_Cup == HIGH) )
	{ 
		if (buttonstate_C == HIGH)
		{
			Cur_tone = tones[0];
		} 
		if (buttonstate_E == HIGH)
		{
			Cur_tone = tones[1];
		}
		if (buttonstate_G == HIGH)
		{
			Cur_tone = tones[2];
		}
		if (buttonstate_D == HIGH)
		{
			Cur_tone = tones[3];
		}
		if (buttonstate_F == HIGH)
		{
			Cur_tone = tones[4];
		}
		if (buttonstate_A == HIGH)
		{
			Cur_tone = tones[5];
		}
		if (buttonstate_B == HIGH)
		{
			Cur_tone = tones[6];
		}
		if (buttonstate_Cup == HIGH)
		{
			Cur_tone = tones[7];
		}

		digitalWrite(speaker, HIGH);
		delayMicroseconds(Cur_tone);
		digitalWrite(speaker, LOW);
		delayMicroseconds(Cur_tone);
	}
	else //in case no button is pressed , close the piezo
	{
		digitalWrite(speaker, LOW);
	}

}

Next Steps

Taking this further, we have now ordered the individual part that we would like to use (RGB LEDs and a touch sensor). After these parts have arrived we will have a greater understanding of how big the piano should be. Realistically we have planned for it to be just a bit bigger than a fist size, to give it a better overall effect.


	

Week 5 – RAYYA HOSN AND CHARLIE BRADLEY

 

IT’S THE FINAL COUNTDOWN

 

This week we worked on refining our code and our model. Due to the issue of the stepper motor not stopping, and the absolute function not registering we’ve had to review our concept and make minor changes to work out how to work it.

THE CODE

Being the main thing that drives the motor, we started with the code. Instead of using a absolute function, we have edited the code to simplify the process of modulating the outcome of a formula. This can be shown below:

int light = _last – _current;
if (light < 0) light = light + light * 2;

What this code does is make sure that all of the differences between numbers are positive. This will link in to our other code, which checks if this number is larger than the threshold, which would then activate the stepper motor again. This part of the code can be found below:

if (_last == _current || light < threshold) isChanged = false;
return isChanged;

We also learnt about tabs, how introducing tabs to the code can simplify the complexity of the code, and make sure everything is in its proper place without compromising the code itself. We have used tabs to separate the stepper motor’s code from the rest of the code to ensure no tangling is endured.

To view the code for this section click here.

FLOWCHART ON HOW IT WORKS

Picture1.png

FRITSING

This shows the current set-up of our Ardunio board:

Flower 1_bb.jpg

MODEL

ezgif-2-724b93524a.gif

The model has been made out of card to ensure the motor is able to animate the flower. If wood were to be used it would been to much force for the stepper motor to move.

Each of the petals are connected to the pulley located on the motor. Each time the motor turns the string will become taught and animate the arms.

IMG_20170218_175746.jpg

We created a container for the Ardunio to be placed in, also to support the motor. We also included a hole, so that we can control when the change in light takes place.IMG_20170218_175751.jpg

In order to ensure the readings from the light sensor was accurate, we changed the light sensor to be more advanced. This light sensor already had a resistor built into it, so removed the clutter found on the breadboard further.

IMG-20170217-WA0003.jpeg

A video of the working model can be viewed here.

WHAT DIDN’T WE DO?

Unfortunately due to the time constraints we were not able to fulfil all of our desired requirements. We were not able to install the speaker, which was due to the long amount of time that was spent on trying to fix the code. I feel that if we were to take this forward we would focus more on the form of the model, making it look more like a rose.

 

 

WEEK 4 – RAYYA HOSN AND CHARLIE BRADLEY

This week we focused on refining our project further to remove the use of a shaft, or the develop the shaft into being part of the flower. After receiving some advice, we looked at changing the flower type to suit the scenario, possibly an iris. This would mean that we could blend the stem into being an stigma.

We also wanted to include more sensory receptors into our design, so we have decided to increase our outputs to producing music as well as pulsing. If we have enough time later on in the project, we may try a blossom that pulses to the music.

                                                Night Light                         Motor Schematic

Arduino

……………………

Concept on movement 3

fullsizerender

The main shaft of the rose will move up and down, with the help of the spring to return back to its resting position. The shaft has arms connected to it, which are attached to the petals. This movement will open the petals as the shaft moves up and the arms push out, resulting in the petals to “blossom”. The arms will act as stoppers to keep the shape of the blossomed rose intact, instead of the petals falling backwards.

The input mechanism, which is a photo sensor,  will create 2 outputs. A sound and a motion output.

Final concept of movement:

We decided to stick with concept of movement 2, as it allowed for a simple way to provide motion. I removes all the complexity of cogs, increases the possibility of accuracy and allows us to focus on the code. We have adapted the movement to have 4 “petals” which will animate and produce the flower.

We decided to follow through with a winding system where the petals will be pulled open in the below form. The strings are attached to each petal individually, and wrapped around a cylindrical pulley. Which with the detection of light change, will start to wind, leading the petals to open. Therefore as the string unwinds, the petals will close.

fullsizerender-1

Below you can see a cad preview of what it would look like, provided we have enough time to 3D print the project.

Picture1.png

How does it work?

We have come up with a flowchart to demonstrate how the code should be structured to allow for the flower to animate.

Blank Diagram - Page 1.jpeg

We tried to realise this through the code, but unfortunately it didn’t work. We were able to get it so that it would rotate backwards and forwards, relating to the number of rotations set, but unfortunately it would not recognise the absolute function and would not work. (the code seen below):

boolean checkIsChanged(int _current, int _last)
{
boolean isChanged = false;
Serial.println(abs(_last – _current));

if (abs(_last – _current) > 20)
{

isChanged = true;
}
return isChanged;
}

If you would like to see the entire code for this part of the project please click here

 

 

ARDUINO WEEK 3 – RAYYA HOSN AND CHARLIE BRADLEY

During week three we recapped how to introduce switches into a circuit. The main purpose of the lesson was to program the switch to become a dim switch, allowing the light to brighten to different levels, gradually increasing.

ezgif.com-422deb27bf (1).gif

We have decided to explore 2 ways in which a flower could be animated:

Mechanism 1:

We have decided to incorporate this technique into our animation of a flower. It would allow for a pulsing motion to be achieved with the usage of a switch.

ezgif-com-12439a0eb8

To further test out technique, we have modeled a mechanism that could be used to animate the flower, as well as researched into memory based products, such as smart materials.

We went on to develop the mechanism to include other petals, seeing if the same motion would be able to convey the opening and closing of a flower.ezgif-com-73f9dcca67

To develop further we would be able to add another two petals by using a tongue and groove joint, making 4 petals animate.

– -> side note – if we were to be making the project with unlimited funds, we would be able to make the use of smart materials from using thermochromic paint to memory metals we would be able to experiment with many unique and cool shapes and movements. (SMART Materials)

Mechanism 2:

ezgif-com-1be138cdf3

With this model you can slide a shaft down to animate the petals. The motion shows opening of the flower in a more abstract way, more like the beginning of a bud blooming.

 

The motion for this model is not as vast as the previous one, however we are able to convey the message we wanted to.

Summary:

As you can see from both sketch models the flower is an abstract version, that encapsulates the motion of a flower opening. Although these sketch models need some work, we are adamant that we are on the right track towards having a working prototype.

We are going to go onto developing the shaft, and exploring other ways in which the flower could be animated.

Week 2 Arduino – Rayya Hosn & Charlie Bradley

This week we have decided to focus on the physical aspect of our project, how it looks. We have started off by producing a few concept sketches, exploring the waters, and seeing what would be able to work well.

16522065_10158183258970367_1841810789_o.jpg

During this stage we decided that we might be able to stray away from the blossoming of the Rose and focus on using light sensors to bend towards the light or to represent the life of a Rose. We have create a mood board to express a few ideas/ inspirational items that would help us in animating and conveying our project.

Screen Shot 2017-02-20 at 09.27.19.png

Origami of a Rose

We have also created a sketch model to experiment with some of these techniques. And have found the blossoming of the rose to be the simplest form to portray. From the use of the origami we were able to deduce that the shape of the rose does not have to be realistic, but could be abstract. From this we learnt that we should focus more on the motion of the blossoming than the overall shape.

Summary:

Due to our very basic understanding of Ardunio, we have decided to stick with the blossoming/dying of the rose.

This week we were walked through a step by step process of how to make a switch. We initially started with clicking the button to switch on the light, then clicking it again to switch off, this could be used in our design to allow for the user to decide when the flower should open or close.

Project inspiration/Intro to Arduino – Rayya Hosn & Charlie Bradley

When introduced to this project our initial thoughts were to create a pulsing motion through the use of sound. However, we decided to tone the technical aspect down, and focus on utilising Ardunio to create a simple motion, capable of telling a story. To do this we have decided to use the blossoming of a rose as inspiration for our project.

As you can see from this video, every flower blossoms in different ways, their motions being unique depending on the flower. (Blossoming of a flower video)

We have decided to focus on the Rose as it provides a large motion and symbolises passion, love and desire.

In our first week we were introduced to Arduino, and how we could use codes to allow an LED light to blink. We would be able to use this to create a pulsing motion with our flower, maybe turning on and off a motor when required?

We found the blossoming of a flower to be interesting to impersonate, in relation to music (sound). As the tempo of the music increases, the “flower” will start to open. and by the time the chorus comes in, the flower is opened.

Ocean Waves are another motion we were intrigued by. We imagined having rods flowing up and down in a smooth gliding movement as you run your hand across it. (Sensory)tumblr_oeoslclr1t1sjc5sqo1_400

wave-ocean-animated-gif-20