-Con esta informacion creamos un video en openshot con las instrucciones que nos daba el ejercicio del blog teconlogia pedro mercedes.
miércoles, 18 de mayo de 2016
Proyecto con opensshot
-Con esta informacion creamos un video en openshot con las instrucciones que nos daba el ejercicio del blog teconlogia pedro mercedes.
martes, 5 de abril de 2016
Casa inteligente
Casa Inteligente
PARTICIPANTES: Valeria Alvarado Muñante CURSO: 4ºD FECHA: 5/04/2016
Andrea Campos Segovia
Nacho Hernández Martínez
Marta Rodríguez Caraballo
Descripción del proyecto: Vamos a hacer una casa inteligente, consiste en que se encienda la luz con el movimiento en el pasillo, un sistema de apertura para la puerta del garaje que va unido a un meidor de temperatura y cunado llegue a una cierta temperatura se abre la puerta. El de la luz sirve para iluminar el pasillo, el garaje sirve para que se meta el vehículo, el timbre sirve para llamar a la puerta y la calefacción detecta la temperatura y cuando es menor de cierta temperatura se activa automáticamente.
Sistemas que vamos a utilizar: para la luz calibración de sensores, para el garaje vamos a utilizar un sistema con servomotor, para el timbre el beep y para la calefacción el detector de temperatura.
Esquemas Eléctricos :
Sistemas que vamos a utilizar: para la luz calibración de sensores, para el garaje vamos a utilizar un sistema con servomotor, para el timbre el beep y para la calefacción el detector de temperatura.
Esquemas Eléctricos :
- Vamos a usar para apertura del garaje:sistema de servomotor y medidor de temperatura:
CÓDIGO:
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#include <Servo.h>
Servo myServo; // Create Servo object to control the servo
int delayTime = 7000; // Delay period, in milliseconds
void setup() {
Serial.begin(9600);
dht.begin();
myServo.attach(9); // Servo is connected to pin D9
}
void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Fallo al leer el sensor DHT11");
return;
}
if (t> 28) {
myServo.write(180); // puerta abierta
delay(100);
}
if (t<= 28 ) {
myServo.write(90); // puerta cerrada
delay(100);
}
Serial.print("Humedad: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperatura: ");
Serial.print(t);
Serial.print(" *C ");
Serial.println("");
}
2. Vamos a usar para la luz:
Material eléctrico necesario: cables, leds , resistencias, pulsador, zumbador, placa arduino,
Material mecánico: madera, pegamento.
Seguimiento del Proyecto:
- 06/04/2016
Hoy hemos hecho los bocetos de la casa que vamos a hacer en el proyecto .
Ademas hemos buscado los circuitos que vamos a usar .
. 04/05/16
Durante estas semanas hemos construido la casa de madera y también hemos hecho los circuitos que necesitamos para la casa inteligente.
. 19/05/16
Esta semana hemos terminado de colocar la luz y vamos a empezar a montar la puerta del garaje y la calefacción.
. 16/06/2016 :
MATERIALES
|
PRECIO
|
MADERA
|
5 EUROS
|
CABLES
|
1 EURO
|
BOMBILLAS
|
2 EUROS
|
DETECTOR TEMPERATURA
|
10 EUROS
|
DETECTOR MOVIMIENTO
|
10 EUROS
|
SERVO
|
8 EUROS
|
PLACA ARDUINO
|
15 EUROS
|
martes, 1 de marzo de 2016
Teclado Musical
CÓDIGO:
/*
Arduino Starter Kit example
Project 7 - Keyboard
This sketch is written to accompany Project 7 in the
Arduino Starter Kit
Parts required:
two 10 kilohm resistors
1 Megohm resistor
220 ohm resistor
4 pushbuttons
piezo
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// create an array of notes
// the numbers below correspond to
// the frequencies of middle C, D, E, and F
int notes[] = {262, 294, 330, 349};
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 == 1023){
// play the first frequency in the array on pin 8
tone(8, notes[0]);
}
else if(keyVal >= 990 && keyVal <= 1010){
// play the second frequency in the array on pin 8
tone(8, notes[1]);
}
else if(keyVal >= 505 && keyVal <= 515){
// play the third frequency in the array on pin 8
tone(8, notes[2]);
}
else if(keyVal >= 5 && keyVal <= 10){
// play the fourth frequency in the array on pin 8
tone(8, notes[3]);
}
else{
// if the value is out of range, play no tone
noTone(8);
}
}
jueves, 25 de febrero de 2016
theremin controlado por luz
VÍDEO 1:
CÓDIGO:
/*
Arduino Starter Kit example
Project 6 - Light Theremin
This sketch is written to accompany Project 6 in the
Arduino Starter Kit
Parts required:
photoresistor
10 kilohm resistor
piezo
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;
// LED pin
const int ledPin = 13;
void setup() {
// Make the LED pin an output and turn it on
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// calibrate for the first five seconds after program runs
while (millis() < 5000) {
// record the maximum sensor value
sensorValue = analogRead(A0);
if (sensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
// record the minimum sensor value
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}
// turn the LED off, signaling the end of the calibration period
digitalWrite(ledPin, LOW);
}
void loop() {
//read the input from A0 and store it in a variable
sensorValue = analogRead(A0);
// map the sensor values to a wide range of pitches
int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);
// play the tone for 20 ms on pin 8
tone(8, pitch, 20);
// wait for a moment
delay(10);
}
CÓDIGO:
/*
Arduino Starter Kit example
Project 6 - Light Theremin
This sketch is written to accompany Project 6 in the
Arduino Starter Kit
Parts required:
photoresistor
10 kilohm resistor
piezo
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;
// LED pin
const int ledPin = 13;
void setup() {
// Make the LED pin an output and turn it on
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// calibrate for the first five seconds after program runs
while (millis() < 50) {
// record the maximum sensor value
sensorValue = analogRead(A0);
if (sensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
// record the minimum sensor value
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}
// turn the LED off, signaling the end of the calibration period
digitalWrite(ledPin, LOW);
}
void loop() {
//read the input from A0 and store it in a variable
sensorValue = analogRead(A0);
// map the sensor values to a wide range of pitches
int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);
// play the tone for 20 ms on pin 8
tone(8, pitch, 20);
// wait for a moment
delay(10);
}
CÓDIGO:
/*
Arduino Starter Kit example
Project 6 - Light Theremin
This sketch is written to accompany Project 6 in the
Arduino Starter Kit
Parts required:
photoresistor
10 kilohm resistor
piezo
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;
// LED pin
const int ledPin = 13;
void setup() {
// Make the LED pin an output and turn it on
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// calibrate for the first five seconds after program runs
while (millis() < 5000) {
// record the maximum sensor value
sensorValue = analogRead(A0);
if (sensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
// record the minimum sensor value
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}
// turn the LED off, signaling the end of the calibration period
digitalWrite(ledPin, LOW);
}
void loop() {
//read the input from A0 and store it in a variable
sensorValue = analogRead(A0);
// map the sensor values to a wide range of pitches
int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);
// play the tone for 20 ms on pin 8
tone(8, pitch, 20);
// wait for a moment
delay(10);
}
VÍDEO 2:
CÓDIGO:
/*
Arduino Starter Kit example
Project 6 - Light Theremin
This sketch is written to accompany Project 6 in the
Arduino Starter Kit
Parts required:
photoresistor
10 kilohm resistor
piezo
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;
// LED pin
const int ledPin = 13;
void setup() {
// Make the LED pin an output and turn it on
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// calibrate for the first five seconds after program runs
while (millis() < 50) {
// record the maximum sensor value
sensorValue = analogRead(A0);
if (sensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
// record the minimum sensor value
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}
// turn the LED off, signaling the end of the calibration period
digitalWrite(ledPin, LOW);
}
void loop() {
//read the input from A0 and store it in a variable
sensorValue = analogRead(A0);
// map the sensor values to a wide range of pitches
int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);
// play the tone for 20 ms on pin 8
tone(8, pitch, 20);
// wait for a moment
delay(10);
}
jueves, 18 de febrero de 2016
lampara de colores
CÓDIGO:
*
Arduino Starter Kit example
Project 4 - Color Mixing Lamp
This sketch is written to accompany Project 3 in the
Arduino Starter Kit
Parts required:
1 RGB LED
three 10 kilohm resistors
3 220 ohm resistors
3 photoresistors
red green and blue colored gels
Created 13 September 2012
Modified 14 November 2012
by Scott Fitzgerald
Thanks to Federico Vanzati for improvements
http://arduino.cc/starterKit
This example code is part of the public domain
*/
const int greenLEDPin = 9; // LED connected to digital pin 9
const int redLEDPin = 10; // LED connected to digital pin 10
const int blueLEDPin = 11; // LED connected to digital pin 11
const int redSensorPin = A0; // pin with the photoresistor with the red gel
const int greenSensorPin = A1; // pin with the photoresistor with the green gel
const int blueSensorPin = A2; // pin with the photoresistor with the blue gel
int redValue = 0; // value to write to the red LED
int greenValue = 0; // value to write to the green LED
int blueValue = 0; // value to write to the blue LED
int redSensorValue = 0; // variable to hold the value from the red sensor
int greenSensorValue = 0; // variable to hold the value from the green sensor
int blueSensorValue = 0; // variable to hold the value from the blue sensor
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
// set the digital pins as outputs
pinMode(greenLEDPin,OUTPUT);
pinMode(redLEDPin,OUTPUT);
pinMode(blueLEDPin,OUTPUT);
}
void loop() {
// Read the sensors first:
// read the value from the red-filtered photoresistor:
redSensorValue = analogRead(redSensorPin);
// give the ADC a moment to settle
delay(5);
// read the value from the green-filtered photoresistor:
greenSensorValue = analogRead(greenSensorPin);
// give the ADC a moment to settle
delay(5);
// read the value from the blue-filtered photoresistor:
blueSensorValue = analogRead(blueSensorPin);
// print out the values to the serial monitor
Serial.print("raw sensor Values \t red: ");
Serial.print(redSensorValue);
Serial.print("\t green: ");
Serial.print(greenSensorValue);
Serial.print("\t Blue: ");
Serial.println(blueSensorValue);
/*
In order to use the values from the sensor for the LED,
you need to do some math. The ADC provides a 10-bit number,
but analogWrite() uses 8 bits. You'll want to divide your
sensor readings by 4 to keep them in range of the output.
*/
redValue = redSensorValue/4;
greenValue = greenSensorValue/4;
blueValue = blueSensorValue/4;
// print out the mapped values
Serial.print("Mapped sensor Values \t red: ");
Serial.print(redValue);
Serial.print("\t green: ");
Serial.print(greenValue);
Serial.print("\t Blue: ");
Serial.println(blueValue);
/*
Now that you have a usable value, it's time to PWM the LED.
*/
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);
}
Love of meter
CÓDIGO:
/*
Arduino Starter Kit example
Project 3 - Love-O-Meter
This sketch is written to accompany Project 3 in the
Arduino Starter Kit
Parts required:
1 TMP36 temperature sensor
3 red LEDs
3 220 ohm resistors
Created 13 September 2012
by Scott Fitzgerald
http://arduino.cc/starterKit
This example code is part of the public domain
*/
// named constant for the pin the sensor is connected to
const int sensorPin = A0;
// room temperature in Celcius
const float baselineTemp = 20.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<5; 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) * 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);
} // if the temperature rises 2-4 degrees, turn an LED on
else if(temperature >= baselineTemp+2 && temperature < baselineTemp+3){
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
} // if the temperature rises 4-6 degrees, turn a second LED on
else if(temperature >= baselineTemp+3 && temperature < baselineTemp+4){
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, 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);
}
delay(1);
}
martes, 9 de febrero de 2016
Leyendo en analogico
CÓDIGO:
int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
int val = analogRead(A5);
digitalWrite(ledPin, HIGH);
delay(val);
digitalWrite(ledPin, LOW);
delay(val);
}
miércoles, 3 de febrero de 2016
Recibiendo del ordenador
CÓDIGO:
int ledPin=13;
int incomingByte;
void setup() {
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
}
void loop() {
if(Serial.available()>0){
incomingByte=Serial.read();
if(incomingByte=='H'){
digitalWrite(ledPin, HIGH);
}
if(incomingByte=='L'){
digitalWrite(ledPin,LOW);
}
}
}
Enviando al ordenador
CÓDIGO:
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("hello it,s me");
delay(1000);
}
martes, 26 de enero de 2016
Calibración de sensores
CÓDIGO
int ledPin=10;
int ldrPin=A1;
int potPin=A5;
void setup() {
pinMode(ledPin,OUTPUT);
}
void loop() {
int ldrValue=analogRead(ldrPin);
int threshold=analogRead(potPin);
if(ldrValue>threshold){
digitalWrite(ledPin,LOW);
}else{
digitalWrite(ledPin,HIGH);
}
delay(10);
}
LDR
código
int ledPin=10;
int ldrPin=A1;void setup() {
//nothing here
}void loop() {
int ldrValue=analogRead(ldrPin);
int ledValue=map(ldrValue,0,1023,0,255);
analogWrite(ledPin, ledValue);
delay(10);
}
escribiendo en analogico
Escribiendo en analógico 1
CÓDIGO
int ledPin = 10;
int fade = 0;
void setup() {
// nothing here
}
void loop() {
analogWrite(ledPin, fade);
delay(500);
fade = fade + 50;
if (fade > 255) fade = 0;
}
COMENTARIO
hemos cambiado :
Delay de 10 a 500
fade dẹ10 a 50
Suscribirse a:
Entradas (Atom)