49713 Designing for the Internet of Things
· 18 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Ambient lighting through temperature and light sensitivity.
While hosting house parties is no easy feat, one hassle that we constantly struggled with was changing bulbs in our living room according to the mood and overall environment. The living room also doubled as a sunroom for plants and a night study area, which are completely different setups and call for special lighting. In order to fix this, I build AmbiLight.
To sense the outside weather and light to adapt the indoor environment to it.
For the preliminary section of this project, I interviewed my roommate and conducted a co-design session with him. We pointed out numerous avenues of home improvement but came up with three ideas that would make the most difference. Because of our busy schedules, the only fun time that we get to spend together indoors is when we host house parties. We realized this was a great opportunity to make the preparation easier by solving the lighting issue. I examined and tested multiple sensors but understood that using a temperature sensor and LDR would make the most sense. The following is the list of components employed in the project:
After testing out the sensors individually, I was able to receive celsius and fahrenheit values of temperature, and sense if LDR is letting current pass through it or not.
Through code, I first detected if it's getting dark via LDR, taking a digital input at D1. If this condition holds true, either of the blue or red LED may light up, depending upon the temperature condition in the loop. The relation is:
//Tejas kashyap #IOT
int tempPin = A3;
int LDR = 1;
int output = 8;
int output2 = 7;
double temp = 0.0;
double tempF = 0.0;
void setup()
{
Particle.variable("temp", &temp, DOUBLE);
Particle.variable("tempF", &tempF, DOUBLE);
pinMode(tempPin, INPUT);
pinMode(LDR, INPUT);
pinMode(output, OUTPUT);
pinMode(output2, OUTPUT);
}
void loop()
{
int reading = analogRead(tempPin);
double voltage = (reading * 3.3) / 4095.0;
temp = (voltage - 0.5) * 100;
tempF = ((temp * 9.0) / 5.0) + 32.0;
Particle.publish("text",String(tempF));
Particle.publish("text",String(LDR));
if(LDR == 1)
{ digitalWrite(output2,LOW);
digitalWrite(output,LOW);
}
else if(LDR != 1)
{ if(tempF>=65.0)
{ Particle.publish("text",String(tempF));
Particle.publish("text",String(LDR));
delay(1000);
digitalWrite(output,HIGH);
digitalWrite(output2,LOW);
delay(3000);
}
else if(tempF<65)
{ Particle.publish("text",String(tempF));
Particle.publish("text",String(LDR));
digitalWrite(output2,HIGH);
digitalWrite(output,LOW); }
}
}
Click to Expand
Creating a useful, enchanted object was a delightful process which made me aware of the endless possibilities and the ease with which I can augment my environment for the better. In the future, I would like to work with Neopixel or other LED segments where the relation between weather and light can be more precisely depicted with a vast range of colors.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Ambient lighting through temperature and light sensitivity.
January 31st, 2019