IMG_5463.jpg

Humidity Detecting Lamp

Physical computing: humidity sensing lamp

A lamp used to indicate the moisture present in the air through color in order to prevent frequent nosebleeds and indicate that I should turn my humidifier on.

With a motion sensor, the lamp intended for my bedroom has two states in order to conserve electricity and provide suitable lighting for sleep and getting ready in the morning. Humidity level changes the color of the LED strips; an a rocker switch was also added to turn off the lamp completely when I am away from my apartment.

Final product

Final product

IMG_5468 2.jpg
Turning on lamp and activating humidity display mode

Turning on lamp and activating humidity display mode

Different humidity levels of the lamp and their corresponding color. Color changes in increments on the RGB scale. 1. Red Hue: 0-30% humidity level, 2. Pink Hue: 30-60% humidity level, 3. Purple Hue: 60-90% humidity level, 4. Blue Hue 90-100% humidity level

Different humidity levels of the lamp and their corresponding color. Color changes in increments on the RGB scale. 1. Red Hue: 0-30% humidity level, 2. Pink Hue: 30-60% humidity level, 3. Purple Hue: 60-90% humidity level, 4. Blue Hue 90-100% humidity level

 

Idle and. Active state of lamp

Idle State of Lamp: designed to save money on the electricity bill

Idle State of Lamp: designed to save money on the electricity bill

Active State: when lamp senses motion and displays the humidity level

Active State: when lamp senses motion and displays the humidity level

Inner Wiring of the lamp

Inner Wiring of the lamp

 

Process

Sketching out dimensions and laser cut pieces of the lamp prior to beginning physical fabrication

Sketching out dimensions and laser cut pieces of the lamp prior to beginning physical fabrication

 

Electronics Process

PIR motion sensor affecting an LED

PIR motion sensor affecting an LED

Understanding placement of lights on the inner column of the lamp

Understanding placement of lights on the inner column of the lamp

Coding the humidity levels to affect the color of the LED’s

Coding the humidity levels to affect the color of the LED’s

Soldering a rocker switch and attaching to Arduino

Soldering a rocker switch and attaching to Arduino

Wiring Diagram for Lamp

Wiring Diagram for Lamp

 

Physical Prototyping

Stained and laser cut pieces

Stained and laser cut pieces

Cut pieces at a 30* angle each

Cut pieces at a 30* angle each

Top portion of lamp with pieces taped together–looking at connection points of pieces

Top portion of lamp with pieces taped together–looking at connection points of pieces

Bottom panel before circuitry placement

Bottom panel before circuitry placement

Pieces glued together and drying

Pieces glued together and drying

Inner lighting column of the lamp

Inner lighting column of the lamp

 

Code from project:

/*
  Project Two: An Assistive Device for someone you know well
  Designed a lamp used to detect the humidity of the room meant for me to prevent my chronic nosebleeds in winter.
 
  Code can be used to program a lamp that takes in the humidity reading through a DHT sensor and depending on whether motion is sensed in the PIR sensor, one of two LED states is activated. There is also a rocker switch used to turn the lamp on/off
  Sensors and switches used: DHT22, RGB LED strip, PIR Motion Sensor, Rocker switch
  Used the Pololu LED strip library, DHT sensor library, and Adafruit's
https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/using-a-pir-w-arduino
*/
#include "DHT.h"
#define DHTTYPE DHT22
#include <PololuLedStrip.h>
const int DHTPIN = 8;
const int ledPin = 13;
const int inputPin = 2;
const int buttonPin = 5;
int buttonState = 0;
int pirState = LOW;
int val = 0;
int ledState;
DHT dht(DHTPIN, DHTTYPE);
//two ledStrips
PololuLedStrip<12> ledStrip;
PololuLedStrip<11> ledStrip2;
#define LED_COUNT 60
rgb_color colors[LED_COUNT];
int lastHumid = 0;       // compares the last temperature of the loop
void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  pinMode(DHTPIN, INPUT);       //humidity sensor is an input
  pinMode(buttonPin, INPUT);    //switch pin is an input
  dht.begin();
}
void loop() {
  float h = dht.readHumidity();
  int humidReading = h;
  int humidity;
  //prints humidity level reading
  Serial.print(F("Humidity: "));
  Serial.println(h);
  val = digitalRead(inputPin);  // read input value of motion sensor
  digitalWrite(ledPin, val);  //if motion is sensed the led is HIGH and vice versa
  ledState = digitalRead(ledPin);  //reads whether the led on breadboard is on
  buttonState = digitalRead(buttonPin);  //reads the state of the switch
  for (uint16_t i = 0; i < LED_COUNT; i++)
  {
    humidity = map(humidReading, 0, 100, 0, 255);  //change 0-100 scale of DHT sensor to 0-255 RGB scale
    rgb_color red = rgb_color(280 - humidity, 40, humidity); //range of colors of LED
    rgb_color black = rgb_color(20, 20, 17);  //idle state of LEDs
    //turn on active state if motion is sensed and switch is on
    if (buttonState == HIGH) {
      if (ledState == HIGH) {
        colors[i] = red;
      }
    }
    //turn off if motion is not sensed and switch is off
    else if (buttonState == LOW) {
      if (ledState == LOW) {
        colors[i] = black;
      }
    }
    ledStrip.write(colors, LED_COUNT);
    ledStrip2.write(colors, LED_COUNT);
  }
  lastHumid = humidity;   //compare the humidity reading to last loop
}