Tuesday, November 17, 2009

Delay 5v a 110/220v








Pare este circuito, usamos un optocoplador y un triac, para hacer encender la lámpara desde un blink de arduino.

Monday, November 16, 2009

pre amplificador micrófono

signos de microelectrónica

CiberObjetos   (día 3)


Circuito pre amplificador con un transistor npn.





Armando los circuitos




Ejercicio en casa

Sábado 14 de noviembre

salida digital a 110v

+ 5v --- 110v control. (circuito con optocoplador y triac)

internal timer (variables & words length)

LM35 (temperatura)

Preamplificador para audio

PWM sonido

Como algo nuevo en el código programamos una funcion "play()" y también usamos la estructura switch y case, para generar diferentes sonidos.



int sound=10;
int switcher=5;
int val=0;
int val2=0;
int into=0;
void setup(){
pinMode(sound, OUTPUT);
pinMode(switcher, INPUT);

}
void play(int val){
switch(val){
case 1:
digitalWrite(sound,HIGH);
delayMicroseconds(1700);
digitalWrite(sound,LOW);
delayMicroseconds(1700);
break;
case 2:
digitalWrite(sound,HIGH);
delayMicroseconds(1950);
digitalWrite(sound,LOW);
delayMicroseconds(1950);
break;
case 3:
digitalWrite(sound,HIGH);
delayMicroseconds(900);
digitalWrite(sound,LOW);
delayMicroseconds(900);
break;
}
}
void loop(){
val2=digitalRead(switcher);
if (val2==1){
into=1;
play(into);
}else{
into=2;
play(into);
}
}

fotocelda + dos salidas digitales

int potPin = 0; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
int led1=7; // digital output 1
int led2=6; // digital output2
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Serial.begin(9600);
}

void loop() {
val = analogRead(potPin); // read the value from the sensor
if(val >= 512){
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
}else{
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);
}
delay(200);
}







Entradas Analogas + comunicación serial

Usamos un potenciometro de 10k para ver el funcionamiento los puertos análogos. También el el código nos comunicamos de forma serial con nuestro PC, pudiendo observar los datos en la escala de 0 a 1023.





int potPin = 0; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor

void setup() {

Serial.begin(9600);
}

void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.print(val);
Serial.print(" ");
delay(200);
}

Sábado 7 de noviembre

temario del día.

+ Analog input (potentiometer, photoresistors)
+ Digital input (switchers)
+ Pwm (sound)
+ code: switch, creating functions, microseconds.

Salida PWM (pulse width modulation)

El segundo ejemplo a usar es 'fading',

// Fading LED
// by BARRAGAN


int value = 0; // variable to keep the actual value
int ledpin = 9; // light connected to digital pin 9

void setup()
{
// nothing for setup
}

void loop()
{
for(value = 0 ; value <= 255; value+=5) // fade in (from min to max) { analogWrite(ledpin, value); // sets the value (range from 0 to 255) delay(30); // waits for 30 milli seconds to see the dimming effect } for(value = 255; value >=0; value-=5) // fade out (from max to min)
{
analogWrite(ledpin, value);
delay(30);
}
for(value = 255 ; value >= 0; value-=5)
{
analogWrite(ledpin, value);
delay(30);
}

}



Salidas digitales

Para iniciar bajamos a la placa de arduino el 'hello world' físico: el ejemplo blink que viene en el software de arduino.

-------------------------------------
/*
* Blink

*
* The basic Arduino example. Turns on an LED on for one second,
* then off for one second, and so on... We use pin 13 because,
* depending on your Arduino board, it has either a built-in LED
* or a built-in resistor so that you need only an LED.
*
* http://www.arduino.cc/en/Tutorial/Blink
*/

int ledPin = 13; // LED connected to digital pin 13

void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}

void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}

-------------------------------------------------------------



resistencia

Sábado 31 de octubre

menú del día.

+ introduccion a la computacion fisica
- virtualidad como metáfora de información en interacciones con lo físico.
+ objetos y ambientes.
+ microcontroladores.
- tipos de microcontroladores y funcionamiento interno.
- Proyecto arduino -- avr-arduino.
+ Lenguajes de programacion y sintaxis. (processing -- arduino)
- rutinas, funciones y comunicacion serial.
- ejemplos blink y potenciometer.

Primer taller. oct 31- nov 7 - 14 - 21

El 31 de octubre de 2009, iniciamos con un primer grupo de interesados, una serie de (4) sesiones de 3 horas cada uno, con el fin de aprender un poco sobre el funcionamiento de las cosas, y reflexionar sobre las posibilidades que tenemos de expandir de alguna forma su interactividad e interrelacion con el ambiente y con lo que lo rodea.