Introduction: Arduino Home Energy Saver
You're building a Home Energy System that is meant to monitor your homes energy in order to cut down on electricity and other utility bills. In this model, your device will be able to check on the temperature of your house and adjust it accordingly, check to see if any doors or windows are left open in order to save on heating and air conditioning, and allow the user manual control over the brightness of the lights in your home. Let's get started!
Step 1: Parts and Materials
You will need a variety of parts to complete this system. First and foremost, you will need a Sparkfun Redboard starter kit, powered by Arduino. This kit and the hardware inside will be where you set up the entire system. Secondly, you will need a copy of MATLAB on your desktop or laptop, as well as all of the necessary toolboxes in order to make it compatible with the Redboard. In order to do so, open MATLAB. On the MATLAB Home tab, in the Environment Menu, select Add-Ons --> Get Hardware Support Packages Select the "MATLAB Support Package for Arduino Hardware" and download the Arduino Hardware Support Package.
The rest of the parts you will need are indcluded in the Sparkfun Redboard package. You will need wires, one LED, resistors, a diode, a piezo element (speaker), a temperature sensor, a transistor, a photoresistor, and a DC Motor. Luckily, all of these pieces are found in your starter pack.
Step 2: Setting Up Your Light Controls
In this system, an LED light will be our home lights. Attached is an image of the circuit required for you to set up the LED control on your Redboard. In this scenario, you will NOT need the blue piece on the circuit.
The following code will set up your control over the LED light. When running the code, a menu will pop up, allowing the user to select brightness between high, medium, low, or off. Depending on what you choose, the code will set the LED to be a certain level of brightness or dimness. This will be an infinite loop.
choice = menu('How bright would you like your lights?','High','Medium','Low','Off')
if choice == 1
elseif choice == 2
elseif choice == 3
elseif choice == 4
Step 3: Setting Up Door and Window Alarm
The first attached circuit will show you how to set up a small speaker on your Redboard. This speaker will act as an alert to let the user know that a window or door in their home has been left open for more than 10 seconds. This circuit uses wires, the piezo element, and 3 wires.
The second attached circuit is of the photoresister. This is able to tell if the surrounding area is dark or light. The light exposure will let the MATLAB code know if the door is open or closed, and will relay the information to the piezo element, telling it to make a sound. In this circuit, you will NOT need to attach the LED, the purple wire, or the resistor to the right.
The following code will read the amount of light from the photoresister, then pause the code to see if the door is left open for more than 10 seconds. It will read the photoresistor again, then tell the piezo to buzz if the light level is still too high.
photov = readVoltage(a,'A1')
if photov > 4
photov = readVoltage(a,'A1')
if photov >4
Step 4: Setting Up Temperature Sensors
The first attached circuit will set up your temperature sensor. This will gather temperature data from wherever your system is placed. It will send this information to MATLAB.
The next circuit attached sets up the DC motor. This motor acts as a fan. If the temperature sensor readings are too high, the fan will turn on, and attempt to cool down your house.
The following code will allow the temperature sensor to read data over a set amount of time. This code is set to loop through 100 times, but can easily be adjusted to loop many more times, so the sensor can run throughout the day. As it gathers temperature data, the code checks to see if the temperature ever goes above the set temperature. If it does, the fan will automatically turn on. When the set amount of time ends, it will produce a plot that tells you the temperature throughout the time period that you can analyze in order to adjust the heating and air conditioning in your house.
temps = 
times = 
v = readVoltage (a,'A0')
tempC = (v-0.5).*100
tempF = 9/5 .* tempC + 32
if tempF > 75
temps = [temps,tempF]
times = [times,i]
title('Temperature of Your Home Over Time')
Step 5: Conclusion
You're all set! Enjoy your new home energy saver, and make sure to use it to your advantage!