Lewis Tudge/ Jacob Avent – Week 5

This week we started to design and make the final prototype for the firefly penny box. We spent a lot of time developing the way that the machine will read and count pennies once inserted into the box, and have the pennies remain inside the box after inserting. Having spoken to coursemates, one suggested rather than having the coin inserted horiztally (like we had been trying), to have the coin vertical, like in a pool table’s design. This seemed like an elegant solution, and the button click itself orked as a stopped to force the coins to remain inside the box. We originally planned to have vertical split doors that the fireflies would pop out of, but found through testing that the flies were catching on the way back in, and it seemed too difficult to make work reliably. Hence, we ended up with single doors, each moved via servo directly.



week 4 – arduino project – keaney/scotten

this week jemilla and I were adjusting our code to get a knock sensor to work but found that when doing so, the vibrations were hard to keep consistent. this was due to the surfaces that we were working on and how hard we were hitting every time and consequently the knock sensor began to look less feasible.

we persisted however and when we attached it to a surface as opposed to letting it sit loosely on it then we could keep the knocking consistent. the next issue we came across was making the knocks more interesting as we wanted to have the users beat the knock to a rhythm in order to make the arduino work but soon found this to be very hard to control.


this model above was our new iteration that we had been using a knock sensor to activate a fan with.


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.


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);
		digitalWrite(speaker, LOW);
	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.


Final Model & Conclusion, Week 5 – Charlie Camsell & Kyrie Roberts

Our final week of the project had us finishing our model and code to present to the class. We had run into some issues trying to get the temperature sensor working with the step motor, which resulted in a number of changes in the end product.


Our step motor had to have it’s entire library code placed into a separate tab to the main code where some parts had been tweaked to suit us. Also, our temperature sensor seemed to give inaccurate readings whenever we altered where change would be detected (for example, whenever it went past 10 degrees).

We decided to have our motor react whenever we turned a potentiometer past a certain point, thus using the potentiometer instead of the temperature sensor as the input.

The model itself uses a worm gear attached to the motor that moves two other gears to open the leaves – a flower was attached on top for added visual and emotional appeal.


Below is a video of the end product in motion.

Week 5: physical computing, Hugo Harvey, Jake Honeywill


After sketching out concepts and doing some work in rhino we were confident enough to go straight into our final model. First of all we tried to complete the coding side of the design by adapting an existing one we found on the internet. The code and arduino board setup allowed us to get a given rotation (90 degrees) from a servo in response to light intensity.



The next stage was to make the model. we started with a simple square base and then cut out slots to allow the leaves to pivot freely on metal rods. After the base was completed the next stage was to build the pivots and ‘leaf arm’ these 4 items would then be fixed into the slots in the base to allow the leaf to open and close. Thirdly was the task of attaching the ‘leaf arms’ to the servo to do this metal rods were connected to form a linkage and transfer the rotation of the servo to the movement of the leaves. Finally the leaves were made from foam and then stuck on to the leaf arms.


Joe Tapson, Laurence Osborne Blog week 6

For our final week, we focused on construction of the final prototype. We established the flow chart for our code before assembly of the final model.


The construction of the final model was intent on reducing friction so that the DC motors (with their low torque output) could be able to move the segments. The segments were made using lower thickness PLA as well as use of washers to split the segments and reduce friction.


The motor shield required installation of the adafruit library into the Arduino software. Once installed, the DC motor ran continuously. However, the segments were still too heavy for the motors to move.


To further refine our prototype, our final proposal is that we would motors with inbuilt gearboxes to increase the torque output. The segments would also be replaced with two chassis pieces that are joined via two flexible plastic tubes. This would better emulate the form of a caterpillar’s movement.

Sensory Replication using Arduino – Week 5

In this last week of the project we had quite a bit of work to do. We started our week with getting the final model built and built well. It took a lot longer than anticipated as the linkage wasn’t working well with the rail system we had. Too much friction or too little friction allowed for the linkage to fail. This was resolved with small 2mm aluminium tubes which allowed a snug fit and a nearly friction-less connection.



We also had to use a different type of code as the initial one worked for one rotation but then looped constantly. This code type is called a switch case code, this allowed us to have a check if the button had been pressed and if it has been pressed currently. With more cases led to more control over the servo which did fix our problem and is all around a better code.


All in all, we were happy with the way the project turned out and were excited to be taking this project to the next level by using it in our next project for the semester.

Thomas Bown & Stefan Guiton

ezgif.com-optimize (1).gif

Week 5; Dom Heyland, Toby Nalder

During our final week we have continued to work and refine our code for our array of lights which will illuminate once a light sensor is covered. Playing around with different input and output numbers we where able to achieve a smooth transition from dark to light which looked affective on our light display.

int ledPin = 9;
int potPin = 0;
int minLight = 0;
int maxLight = 600;
int val = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
  pinMode(potPin, INPUT);

void loop() {
  // put your main code here, to run repeatedly:
  val = analogRead(potPin);
  if (val > minLight && val < maxLight)
    val = map (val, minLight, maxLight, 255, 0);
    val = 0;
  analogWrite(ledPin, val);

Each LED runs parallel and is control by a single pin. Once our light display had been soldered together, when testing it with the 5volt output each LED was lit. However some where brighter than others, as not all LED’s where the same.



When it came to including the light sensor into the circuit , once covered not all lights where clearly lit up as shown.



After trying to fix the code we found that the led step up was the problem due to not all the lights being the same. Because the LED’s we used had different voltage ratings, the resistors we calculated to use were too big to allow enough current through to properly light them up. We then replaced our original setup with a larger breadboard, with all the same LED’s. Using this gave no uncertainties with the connections through our soldering and conductive tape. The 33 ohm resistors are still slightly too large to achieve full brightness, and wouldn’t allow current to any more than 10 LED’s.





With our final model, we achieved a good firefly effect, where a field of LED’s hidden behind black fabric, illuminate when the light sensor is covered by a hand so it’s in the dark. The darker it is the brighter the LED’s are thanks to a PWM pin.

Future improvements we would make are to use less powerful resistors allowing more LED’s to shine brighter and to add extra light sensors so that the LED’s can illuminate in an array.






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.


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.




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

Flower 1_bb.jpg



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.


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.


A video of the working model can be viewed here.


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 5 – Arduino

In our final week we have continued to develop our model for our mechanical peacock tail; using experience from past attempts making the arm of the servo move to a certain angle and connecting the two together along with a photocell as our trigger to make the sequence work.


We faced a few difficulties when creating the model firstly by attaching the servo to the tail, making the tail evenly space out and finding the right code to make the servo spread the tail out quickly and then retract slowly once reaching its optimum angle.


The solution to help us out with the tail was to use 2 servos in the circuit to allow the arm to start vertically and both spread out to their respective angles. Once this problem was solved we created the final model and attached the servos to the tail, leaving the Arduino and breadboard in a neatly created box hidden away. The photocell was then left outside the box to allow the user to cleanly touch the sensor and trigger the mechanism.


Samuel Doubleday, Rob Harvey