Inspiration
This summer, my air conditioning coil froze and caused my air conditioner to stop working creating an expensive repair bill that could have been prevented if I knew the coil had frozen in time.
What it does
How I built it
I built the coil checker using raspberry pi, a simple thermometer sensor and the nexmo SMS API.
Challenges I ran into
I had the option to use a cron job to fire off the node.js code, but I chose to put a sleep within the code to make it easier for someone to use quickly. I actually prefer the cron job, and I will use cron in my home implementation instead of the sleep function.
Accomplishments that I'm proud of
Sent messages easily using SMS to alert me if my airconditioner coil freezes in just a few lines of code.
What I learned
Its very easy to create SMS alarms in node.js and raspberry pi
What's next for Coil Checker
I want to use the humidity to ensure water vapor isn't forming inside the ducts.
Code
var https = require('https'); var sensor = require('node-dht-sensor'); var sleep = require('sleep');
while(){ sleep.sleep(1800); sensor.read(22, 4, function(err, temperature, humidity) { if (!err) { if (temperature.toFixed(1)<=0){ callSMSAlert(); } });
}
function callSMSAlert(){ var data = JSON.stringify({ api_key: 'YOUR KEY', api_secret: 'YOUR SECRET', to: 'TARGET PHONE NUMBER', from: '441632960961', text: 'Your air conditioner coil is freezing' });
var options = { host: 'rest.nexmo.com', path: '/sms/json', port: 443, method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) } };
var req = https.request(options);
req.write(data); req.end();
var responseData = ''; req.on('response', function(res){ res.on('data', function(chunk){ responseData += chunk; });
res.on('end', function(){ console.log(JSON.parse(responseData)); }); }); }
Built With
- javascript
- node-dht-sensor
- node.js
- sleep
Log in or sign up for Devpost to join the conversation.