Early Arduino Projects

Early Arduino Projects

1st Powering an LED

1st a

A simple LED circuit.

2nd Two Buttons Circuit

2nd a

In this circuit, two button should be pressed at the same time to power the LED

3rd Resistance of LEDs (Parallel and Serial Connection)

3rd a3rd b

Anodes of three LEDs connected parallel to each other, but the cathodes to the different buttons. If any button is pressed, it completes the circuit and the LED connected to that button switch on. However, since cathodes are connected parallel to each other, when two or more button pressed, the amount of light decreases for each LEDs. If the anodes were connected serially, it would not share the same voltage and all LEDs will radiate same amount of light even if all of them switched on.

4th Spaceship Extended

4th b 4th a

In this circuit, all LEDs are powered with different digital Pins and programmed separately. The original spaceship circuit in Arduino starter kit is consist of three LEDs. The extended version of code is down below.

int switchstate = 0;
void setup(){
// declare the LED pins as outputs
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
// declare the switch pin as an input
pinMode(2,INPUT);
}
void loop(){
switchstate = digitalRead(2);
// if the button is not pressed
// blink the red LEDs
if (switchstate == LOW) {
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 off
digitalWrite(6, LOW); // turn the red LED on pin 6 off
digitalWrite(7, LOW); // turn the red LED on pin 7 off
}
else {
digitalWrite(3, LOW); // turn the green LED on pin 3 off
digitalWrite(4, LOW); // turn the red LED on pin 4 off
digitalWrite(5, LOW); // turn the red LED on pin 5 on
digitalWrite(6, LOW); // turn the red LED on pin 6 on
digitalWrite(7, HIGH); // turn the red LED on pin 7 on
// wait for a quarter second before changing the light
delay(250);
digitalWrite(4, LOW); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
digitalWrite(6, HIGH); // turn the red LED on pin 6 on
digitalWrite(7, LOW); // turn the red LED on pin 7 on
// wait for a quarter second before changing the light
delay(50);
digitalWrite(4, LOW); // turn the red LED on pin 4 on
digitalWrite(5, HIGH); // turn the red LED on pin 5 off
digitalWrite(6, LOW); // turn the red LED on pin 6 on
digitalWrite(7, LOW); // turn the red LED on pin 7 on
// wait for a quarter second before changing the light
delay(50);
digitalWrite(4, HIGH); // turn the red LED on pin 4 on
digitalWrite(5, LOW); // turn the red LED on pin 5 off
digitalWrite(6, LOW); // turn the red LED on pin 6 on
digitalWrite(7, LOW); // turn the red LED on pin 7 on
// wait for a quarter second before changing the light
delay(50);
}
}

5th Love o Meter 

5th a

A temperature sensor was used to turn on LEDs. According to the voltage passing through the temp sensor, first, seccond then third LEDs turn on respectively. The value coming from temp sensor is variable therefore, it must be connected to an analog pin. However, an LED needs only two values to switch on (HIGH) and switch off (LOW).

6th Love o Meter Extended

5th b 5th c

Instead of three, I used five LEDs which represents cold, less cold, warm and hot. The code is down below.

const int sensorPin = A0;
// room temperature in Celcius
const float baselineTemp = 26.0;
void setup(){
 // open a serial connection to display values
 Serial.begin(9600);
 // set the LED pins as outputs
 // the for() loop saves some extra coding
 for(int pinNumber = 2; pinNumber<7; pinNumber++){
 pinMode(pinNumber,OUTPUT);
 digitalWrite(pinNumber, LOW);
 }}
void loop(){
 // read the value on AnalogIn pin 0 
 // and store it in a variable
 int sensorVal = analogRead(sensorPin);
 // send the 10-bit sensor value out the serial port
 Serial.print("sensor Value: ");
 Serial.print(sensorVal); 
 // convert the ADC reading to voltage
 float voltage = (sensorVal/1024.0) * 5.0;
 // Send the voltage level out the Serial port
 Serial.print(", Volts: ");
 Serial.print(voltage);
 // convert the voltage to temperature in degrees C
 // the sensor changes 10 mV per degree
 // the datasheet says there's a 500 mV offset
 // ((volatge - 500mV) times 100)
 Serial.print(", degrees C: "); 
 float temperature = (voltage - .5) * 100;
 Serial.println(temperature);
 // if the current temperature is lower than the baseline
 // turn off all LEDs
 if(temperature < baselineTemp){
 digitalWrite(2, LOW);
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 } // if the temperature rises 1-2 degrees, turn an LED on 
 else if(temperature >= baselineTemp+1 && temperature < baselineTemp+2){
 digitalWrite(2, HIGH);
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 } // if the temperature rises 2-3 degrees, turn a second LED on 
 else if(temperature >= baselineTemp+2 && temperature < baselineTemp+3){
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 } // if the temperature rises 3-4 degrees, turn a second LED on 
 else if(temperature >= baselineTemp+3 && temperature < baselineTemp+4){
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 } // if the temperature rises 4-5 degrees, turn a second LED on 
 else if(temperature >= baselineTemp+4 && temperature < baselineTemp+5){
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, HIGH);
 digitalWrite(6, LOW);
 }// if the temperature rises more than 6 degrees, turn all LEDs on
 else if(temperature >= baselineTemp+4){
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, HIGH);
 digitalWrite(6, HIGH);
 }
 delay(1);
}

7th Ambient Light and RGB LED

6th a

8th Servo Controller Extended

7th a

In the original started kit circuit, the angle of servo was associated with the level of potentiometer. In order to improve and add a different kind of input, I used an LDR, also calibrate it according to light condition of my study room. The arduino code is down below.

// include the servo library
#include <Servo.h>
Servo myServo; // create a servo object 
//int const potPin = A0; // analog pin used to connect the potentiometer
const int sensorPin = A0;
//int potVal; // variable to read the value from the analog pin 
int sensorVal;
int angle; // variable to hold the angle for the servo motor 
void setup() {
 myServo.attach(9); // attaches the servo on pin 9 to the servo object 
 Serial.begin(9600); // open a serial connection to your computer
}
void loop() {
 sensorVal = analogRead(sensorPin); // read the value of the potentiometer
 // print out the value to the serial monitor
 Serial.print("sensorVal: ");
 Serial.print(sensorVal);
 // scale the numbers from the pot 
 angle = map(sensorVal, 250, 800, 0, 179);
 // print out the angle for the servo motor 
 Serial.print(", angle: ");
 Serial.println(angle); 
 // set the servo position 
 myServo.write(angle);
 // wait for the servo to get there 
 delay(15);
}

9th Light Theremin Extended

8th a

Two LDR s used, one controls the amplitude and the other one volume.

10th Keyboard Instrument Extended

9th a

Additionally I put one more button which is corresponding to the F note. The code is down below:

int notes[] = {262, 294, 330, 349, 391};
void setup() {
 //start serial communication
 Serial.begin(9600);
}
void loop() {
 // create a local variable to hold the input on pin A0
 int keyVal = analogRead(A0);
 // send the value from A0 to the Serial Monitor
 Serial.println(keyVal); 
 // play the note corresponding to each value on A0
 if(keyVal == 1022){
 // play the first frequency in the array on pin 8
 tone(8, notes[0]); }
 else if(keyVal >= 513 && keyVal <= 513){
 // play the second frequency in the array on pin 8
 tone(8, notes[1]); }
 else if(keyVal >= 505 && keyVal <= 20){
 // play the third frequency in the array on pin 8
 tone(8, notes[2]); }
 else if(keyVal >= 5 && keyVal <= 510){
 // play the fourth frequency in the array on pin 8
 tone(8, notes[3]); }
 else if(keyVal >= 6 && keyVal <= 19){
 // play the fourth frequency in the array on pin 8
 tone(8, notes[4]); }
 else{
 // if the value is out of range, play no tone
 noTone(8); }}

11th Digital Hour Glass

10th a

 

Posted in Arduino | Comments Off on Early Arduino Projects

Lecture001_Processing_Homework

Noise:

2.0circles.

Script: http://www.openprocessing.org/sketch/131404

Bubbles:

4.0circles

Scripthttp://www.openprocessing.org/sketch/131236

Radial Rectangle and Ellipse Array:

6.0radial

Scripthttp://www.openprocessing.org/sketch/131269

Posted in Processing | Tagged , , | Comments Off on Lecture001_Processing_Homework

Testing out Octocoupler (02 May 2014)

Simple blinking LED code used for this experimentation. 1.5 volts IR LED and 5 volts LED are blinking respectively from the same arduino code, however both of them are powered from different power sources. Two circuits separated with an octocoupler.

IMG_2483 IMG_2484 IMG_2485 IMG_2486

Arduino Code is down below:

///////////////////////////////////////////////////
// Blinking Test for UV and IR LEDs //
// IR is 1.5 Volts, however UV 5 Volts //
// So Octotoupler used for two different cicuits //
///////////////////////////////////////////////////
//LTV4N35 used/////////////////////
//Arduino - Octocoupler //
/* PIN 10 = PIN 1 */
/* GND = PIN 2 */
/* -LED = PIN 5 */
/* -1.5 V = PIN 6 */
int led_IR= 10;
int led_UV = 9;
void setup() { 
 pinMode(led_IR, OUTPUT); 
 pinMode(led_UV, OUTPUT); 
}
// the loop routine runs over and over again forever:
void loop() {
 digitalWrite(led_IR, HIGH); // turn the Infrared LED on 
 digitalWrite(led_UV, LOW); // turn the Ultraviolet LED off
 delay(750); // wait for a second
 digitalWrite(led_UV, HIGH); // turn the Ultraviolet LED on 
 digitalWrite(led_IR, LOW); // turn the Infrared LED off 
 delay(750); // wait for a second

}
Posted in Arduino, Prototyping | Comments Off on Testing out Octocoupler (02 May 2014)

Making of complement surface

To be able to put different materials on the glass, and provide a tactile input to the spectator, a complement surface had been made by using Tinkerman method. Complement surface consists of a waterproof silicon, which was applied to a plastic film by using a soft foam roller. Yet, this process creates a texture very similar to human skin and responsive to the FTIR surface.

IMG_2491

Posted in Prototyping | Comments Off on Making of complement surface

Digital Media – Final Prototype

 Prototype the Structure

Several custom built hardwares and advanced computing techniques had been used to build the interface of this project. The physical structure consists of two basic modules which are, FTIR interface and Cymascope. Each module has almost the same body and when combined together, they create the entire installment. Additionally an Arduino microcontroller located inside of the FTIR module that controls most of the events happening inside the prototype.

DIAGRAM

The top surface of the FTIR module consists of 35 by 25 centimeter piece of 10mm thick acrylic glass. Also, the frame that holds the glass in place is covered with a custom made array of Infrared LED’s. These special LED’s emits only infrared light which is not visible to the human eye. A similar system could be built with normal LED’s however, it would cause serious problems such as, being affected by natural or ambient light, as I experienced in my previous prototypes.

IMG_2511 IMG_2512

To be able to put different materials on the glass, and provide a tactile input to the spectator, a complement surface had been made by using Tinkerman method. Complement surface consists of a waterproof silicon, which was applied to a plastic film by using a soft foam roller. Yet, this process creates a texture very similar to human skin and responsive to the FTIR surface.

The materials that create a texture on the FTIR surface are, mat (represents the distortion effect), bubble wrap (noise effect), soft towel (ambient echo), and table cloth made of synthetic cotton (delay effect). Pressure that spectators finger will apply on these materials, going to measured by a touch sensor located below the frame and going to set the effect level. As the spectator touches on the materials, relative effects will be triggered and applied on the ambient sound.

FTIR surface video can be found on this link: https://www.youtube.com/watch?v=D26N-rHWL_s

IMG_2507 IMG_2506 IMG_2508

An Arduino microcontroller used to operate components of the prototype such as, LED’s and pressure sensor. Basically, it has three tasks to do. First of all, controlling the IR LED’s condition, whether they are switched on or off, to decrease power consumption. Since IR LED’s are 1.5 volts, an octocoupler used to separate two circuits that are working with different voltages. Secondly, controls the color of RGB LED’s to create unique color mixture on the liquid holder. Finally, gets data from pressure sensor which is placed under the acrylic frame.

photo 2 photo 1

Cymascope module of the installment consists of a black acrylic liquid holder, a speaker, sound transmitter tube, membrane and RGB LED’s. The final solution to transfer sound waves from the speaker to liquid is created by the influence of tonoscope. One end of the tube glued to the speaker and the other end enclosed by a flexible membrane. Thus, any interaction between the air inside and outside of the tube had been blocked. As a result, the motion created by up and down movement of the speaker can directly be transferred to the liquid holder. Ultimately, according to the vibration frequency different patterns can emerge on the liquid surface. Liquid holder has chosen to be black, in order to reduce reflections coming from other sources rather than LED’s. The reason why the RGB light sources located on the sides of the liquid holder is to make colorful patterns visible from all sides.

Cymascope video can be found on this link: https://www.youtube.com/watch?v=fs0oehisD8U

 

Posted in Arduino, Max MSP, Processing, Prototyping | Comments Off on Digital Media – Final Prototype

Colorful Cymatic Patterns

Sound level creates different color variations, also speaker placed under liquid holder creates emerging patterns on the water. Sounds of “city traces/soundscape city diary” (https://www.youtube.com/watch?v=tS3JNgok5n8) from youtube was used as a sound source.

https://www.youtube.com/watch?v=fs0oehisD8U

 

Posted in Max MSP, Photography, Prototyping | Comments Off on Colorful Cymatic Patterns

FTIR Interface – Blog Tracking and Sound Manipulation

https://www.youtube.com/watch?v=D26N-rHWL_s&feature=youtu.be

Posted in Arduino, Max MSP, Prototyping | Comments Off on FTIR Interface – Blog Tracking and Sound Manipulation

Prototype Graphical Illustration

DIAGRAM

Posted in Arduino, Photography, Prototyping | Comments Off on Prototype Graphical Illustration

Making of FTIR 03-05-2013 (Testing out the whole setup)

Day6

Everything was ready and tested out. The result was satisfying…

1609956_10203196121842464_4321477423783972456_n 10277727_10203196121962467_1105668362901714561_n 10330382_10203196121922466_8228136132995506056_n IMG_2511

Posted in Photography, Prototyping | Comments Off on Making of FTIR 03-05-2013 (Testing out the whole setup)

Making of FTIR 02-05-2013 (Electronics Assemblage)

Day 5

All pieces was ready to put together, and electronics that I need had been arrived. At this stage, I designed a holder to keep all electronics in order, hence I will not be struggling to find which wore goes to where.

IMG_2475 IMG_2476 IMG_2477

The holder is made of cardboard and keeps all materials in order. Besides, all materials are demountable, so if anything goes wrong it would be very easy to replace.

IMG_2511

Posted in Prototyping | Comments Off on Making of FTIR 02-05-2013 (Electronics Assemblage)

Making of FTIR 30-04-2013 (main body)

Day 3

After the frame and sub-frame pieces glued together and dried, I started to built main body of the installment. Dimensions are, Width:300mm, Depth 400mm, Height: 450mm. The height was decided after testing out the view angle of the camera. The structure consists of plywood which is then covered with cardboard for fully enclosure.

IMG_2467 IMG_2468 IMG_2469 IMG_2470 IMG_2503IMG_2466

Posted in Prototyping | Comments Off on Making of FTIR 30-04-2013 (main body)

Making of FTIR 01-05-2013 (frame electronics)

Day 4

Once the frame and sub-frame ready, I started to asseble IR LED s and solder them in a way that, creating an LED strip. This process took a long time, since there was 60 LED s to be soldered.

IMG_2437 IMG_2438 IMG_2472

All the LED s soldered together and fits into the holes drilled on the frame.

IMG_2473 IMG_2474

Later on, the led s tested whether they are working or not and when proved, placed into frame,then each strip soldered together and covered with silicone in order to protect them from external factors. Finally, acrylic strips placed into the hole carved before for maximum protection and to create smooth end.

Posted in Prototyping | Comments Off on Making of FTIR 01-05-2013 (frame electronics)