Como Hacer Una Mood Lamp (proyecto Uvg)
by Watts Matt in Circuits > Arduino
1066 Views, 1 Favorites, 0 Comments
Como Hacer Una Mood Lamp (proyecto Uvg)



Esta es una mood lamp que funciona a base de un sensor DHT11 y 3 potenciómetros. tiene 2 modos: el primero el color cambia con los potenciómetros, y el segundo cambia a base de las lecturas del sensor DHT11.
Materiales Y Herramientas













Materiales:
1. Paletas
2. Goma caliente
3. Papel delgado
4. 1 Arduino
5. 1 Protoboard
6. 1 Led RGB
7. 1 Botón momentáneo
9. 1 Switch tipo SPST
10. 1 Sensor DHT11
11. 3 Potenciómetros
12. Cable tipo solid core (yo use cable de teléfono)
Herramientas:
1. Tijeras
2. Cuchilla
3. Pistola de goma caliente
Armar El Circuito

Programar

//Este es el codigo que yo use:
#include "DHT.h"
#define DHTPIN A3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,INPUT_PULLUP);
}
int mode = 0;
int h = 170;
int t = 15;
int delta=HIGH;
void loop() {
if (delta if (mode == 0) mode=1;
else mode=0;
}
delta=digitalRead(6);
if (mode == 0){
analogWrite(3, map(analogRead(A0), 0, 1023, 0, 127));
analogWrite(4, map(analogRead(A1), 0, 1023, 0, 127));
analogWrite(5, map(analogRead(A2), 0, 1023, 0, 127));
}
else{
if (not isnan(dht.readHumidity())) h=dht.readHumidity();
if (not isnan(dht.readTemperature())) t=dht.readTemperature();
analogWrite(3, map(h, 150, 190, 0, 127));
analogWrite(5, map(t, 10, 20, 0, 127));
}
}
Armar La Estructura Y Agregar Detalles






Recomiendo agregar el papel delgado hasta el final para evitar romperlo mientras se manipula.
Video De La Lampara Funcionando
