Showing posts with label college dmss dmss5 mmpt electronics. Show all posts
Showing posts with label college dmss dmss5 mmpt electronics. Show all posts

Tuesday, November 17, 2009

Week10

DMSS5 - Wk10


//**************************************************************************//
int analogData; // outgoing ADC value
int digitalPin;
int i; //used for the loop
byte x = 0; //byte to store digital status


void setup() {
//setup serial baudrate is set at the highest speed for USB connection
Serial.begin(57600);
//enable digital pullups. All digital pins are set high
//and will only output change when connected to ground
for(i=2;i<8;++i)>
{
digitalPin = i;
pinMode(digitalPin, INPUT);
digitalWrite(digitalPin, HIGH); //enable internal pullups
}
}

//Main Loop
void loop() { //read the digital pins in one go
x = PIND;
x = x >> 2; // Shift by 2 to avoid TX and RX pins
Serial.print(x, BYTE);

/* get analog in, for the number enabled */
analogData = analogRead(0); // Read current analog pin value
Serial.print(analogData >> 7, BYTE); // shift high bits into output byte
Serial.print(analogData % 128, BYTE); // mod by 128 for the small byte

analogData = analogRead(1); // Read current analog pin value
Serial.print(analogData >> 7, BYTE); // shift high bits into output byte
Serial.print(analogData % 128, BYTE); // mod by 128 for the small byte

Serial.print(255, BYTE); // end of digital signifier
delay(10);

}




Sunday, November 1, 2009

Accelerometer and proximity reader

DMSS5 Wk8

This week we just got familiar and tested out the acceleometer and the proximity sensor. They wererelatively simple and the diagrams below pretty much explain it all:

Friday, October 9, 2009

Adding Max to the equation...

DMSS5 Wk5

Using variables

  • Makes our code more human readable
  • Necessary for storing a value
  • A variable is a way of naming and storing a value for later use by the program, such as data from an analog pin
  • Variables must be declared before use
Just started with some recap on the use of variables and the theory.

Also discussed the notion of the pull-up resistor built into the Arduino pins and the obvious difference from the pull-down resistor. Looks a little something like the diagram below:


As stated in the diagram code is used to open the switch. The full code is below with the line to open the switch in bold.

void setup()
{
pinMode(3, INPUT);
digitalWrite(3, HIGH);
}

void loop()
{
int digiinput = digitalRead(3);
}



Got into Arduino Serail for the first time today (Tuesday) also. Was interesting, and simple what it boils down to is:

  • allows Arduino to talk to the computer
Programs to read Arduino Serail include:

  1. zterm
  2. hyperterminal
  3. cornflake (apparantly the best one)
New function for use with Serial:
Serial.print(1, BYTE)

Monday, October 5, 2009

Moving onward...

DMSS5 Wk3

Went on a trip back in time so to speak here, going back to basic elctronics, which I unfortunately hadn't only briefly touched on since my JC back in '02. However, I found the stuff relatively easy to manage and understand. Rough notes taken are below.

  • electricity - voltage and current
  • for a given voltage the resistance of the circuit will set the current
  • large resistance will restrict the current more than a small resistance
  • Ohms Law: I = V/R
Resistors in series: Rt = R1 + R2

Resistors in parallel: 1/Rt = 1/R1 + 1/R2

Examples of equations and diagrams:
  • 2 resistors each of 1kOhm are connected in series with an SV battery across them:
  • current is the same everywhere as there is only one path
  • Potential Divider - useful for simple sensor circuits
  • Arduino - open-source physical computing platform based on a simple i/o board
  • based around a programmable microcontroller (Atmega168)
  • i/o = input/output
  • digital + analog (+ serial)
  • IDE = integrated development environment
  • Firmware is software that is embedded in a hardware device such as a microcontroller
  1. Write our firmware
  2. Compile
  3. Debug
  4. Compile
  5. Debug
  6. Compile
  7. Upload to arduino
  • solenoid is an electronic switch
http://www.arduino.cc/playground/projects/arduinousers

HIGH = 5v
LOW = 0v

Anode +
Cathode -


We later looked at some makezine tutorials on youtube (makezine.com)

In this lectue we were introduced to the idea of critiquing performances. We started off with a performance by Michael Waiswisz, with his NIME called the Hands. If was too sort of paddle like glove devices with buttons and sensors. It also has a microphone for him to input the original sounds before he altered and played them using the device. He seemed a bit crazy to say the least, but he definitely knew what he was doing, and I liked it, (despite my usual distaste for all things more noisy than straight-up musical).

Watch the video here: http://www.youtube.com/watch?v=SIfumZa2TKY


DMSS5 Wk4

Today we just continued on the arduino stuff, so just some diagrams and simple notes to be shared today.

  • Arduino Pin 13 has a built in resistor

  • Resistors used like in the diagram to the above right are called pull down resistors