Thursday, October 7, 2010

Arduino HVAC Servo Thermostat/Controller

introArduino HVAC Servo Thermostat/Controller

Welcome to my 'green' instructable! I am going to show you how to use an Arduino, two servo motors a temperature sensor and some metal (or wood) to make a digital thermostat for a through-wall HVAC unit.

According to CB Richard Ellis (a major real estate firm), New York City is a renters market, with only about 1/3 of the population owning their home (versus almost 70% home ownership for the rest of the US). This means over 5mm people in NYC live in rented apartments or homes. It is very rare for rental units to have any form of central air conditioning or even a thermostatically-controlled system.

Many apartments have permanent through-wall units like the one seen in the video below. Unfortunately, these units have no ability to regulate the temperature and can only be forced into heat, cold, or off.

According to the Consumer Energy Center, Heating and Cooling accounts for about 45 percent of your energy bill. The federal government estimates that the average homeowner spends more than $10,000 for heating and cooling over a ten-year period.

The cooling capacity of room air conditioners is measured in BTUs, or British Thermal Units, per hour. To cool a 700-1,000 sq ft apartment (a one bedroom or maybe a small 2bedroom), you need about 20,000 BTU's. This is the equivalent of 1.7 tons or 5,861 watts. At $0.15 per kWh, that means it costs $0.88/hour to run your HVAC unit!

Because HVAC units use a lot of energy (particularly when in 'air conditioning' mode during hot summer months) and renters do not have the ability to easily implement energy star (i.e. more efficient) units or to regulate their tempature, I wanted to find a way, without making permanent changes, to control an HVAC unit like a thermostat! Implementing this device can not only save you money, but can help maintain a more steady-temperature in your apartment, reduce energy consumption and help reduce the strain placed on our nations power grid during the hot summer months!
Final in unit 3.jpgFinal on Desk 1.jpg

step 1Overview of the product & parts list

Overview & Parts list:

Electronics Parts List:

1) Two Servo's. I used Hitec HS-311 ( ) which can be purchased for under $10 per servo. The SparkFun servo ( should also work.
3) Arduino (I used the Duemilanove -
5) a 4K7 resistor for the Temperature Probe:

Hardware Parts List:
1) I used Aluminum purchased from my local hardware store (Home Depot). The dimensions of the servo bracket are 4" x 1" x 0.25" and the two end-posts are 1" x 0.25" x 0.25". Alternatively, here is a link to purchase this sized piece of aluminum online: and
2) I used (6) 1/2" 8-32 SHCP (socket head cap screws) and (2) 1" 8-32 SHCP's. I would recommend purchasing these from your local hardware store, but they can also easily be purchased online. Here are the links: 1/2": and 1":
3) You'll need a tap that matches whatever screws you use in the previous step. Since I used 8-32 screws, I purchased an 8-32 tap. Once again, this can be purchased at your local hardware store but if you wish to order online, here is a link:
4) A number 29 drill bit (this corresponds to the 8-32 taps; if you use a different size screw & tap, purchase the appropriate drill bit). NOTE: Many hardware stores sell the taps with the drill bits, which will ensure you purchase the right size. Also available here:

1) I used a drill (can be a hand drill or drill press) and a hacksaw.
2) If you'd rather glue the servo's to the aluminum mount (in lieu of drilling and tapping the holes), I would recommend using JBWeld or Gorilla Glue

Arduino Library:
In addition to the servo library (included with the Arduino softwre), you need the OneWire library.
You can read more about the library here (optional): or just download the library via this link:

step 2Building the Servo Mount & Electrical Schematic

Here's a video overview of how to build the servo mount and the schematics of the electronics. Check out the photo's below for more!

Schematic.jpgBread Board 1.jpgBread Board 2.jpgBread Board 3.jpg

step 3Arduino Code

A txt file below contains the Arduino code. You can open this file to view the code and then copy/paste it into your Arduino software to run the program.

Video: A basic and then more-thorough walkthrough of the Arduino code.


step 4Debugging and Installing

NOTE: If you rest your arduino on a metal surface, make sure you have some rubber feet on the bottom! Otherwise the solder joints on the bottom of the Arduino will touch the metal which will short the board!

step 5Final Thoughts & Future Ideas

Final Thoughts:
Thanks for watching! If you're looking for a great way to save energy, save money and still maintain a comfortable apartment, hopefully you've enjoyed this video. During the hot summer months, peak demand forces additional power plants to be brought online, which are often more expensive plants to run and contribute more pollution to our environment. If you have the ability to upgrade your HVAC system to an energy-star compliant or you can install a "professional" thermostat, please do! But if you live in an apartment building and simply don't have those options, please consider this project for the environment!

Future Ideas:
Once you have the servo's in place, there are some great ways you can expand on this project. Here are just a few:
1) Put the Temperature Sensor on a wire so that it can be strategically placed within the room
2) Add buttons to the Arduino in order to have four modes: Off, A/C, Heat, or Temperature Probe mode (i.e. allows you to force the unit off, into heat or A/C or allows the unit to act according to the temperature probe reading)
3) Use a 7-segment LED or an LCD to display the current temperature
4) Use an Ethernet Shield to enable Internet control or to publish your current temperature (i.e. through twitter). This idea is inspired by Adafruit's "Tweet-a-Watt" ( )
5) Use a third servo for to control the hot/cold potentiometer (note: using three servo's on the arduino requires the use of softwareservo's - see here for more:
7) Set temperature threshold ranges at the device using a keypad or a potentiometer
8) Setting the unit to automatically cool the apartment at certain times (i.e. before you arrive home at work) or to go into a "pulse" mode at night, alternating between off & cool in order to keep the apartment cool but not have the AC on all night
9) Use Evil Mad Scientist or ITP Boarduino for a cheaper & smaller unit!
See for the Evil Mad Scientist Boards which you can purchase as a kit which includes the PCB & ATMEL chip and a 16Mhz crystal & caps for ~$12
Read the NYU ITP tutorial on how to create a breadboard arduino!

Final Thoughts & Future Ideas

Arduino Based Meter - a many LED Driver

introArduino Based Meter - a many LED Driver

As the direct result of a question in the Instructables forum, for a bargraph to display data on the dashboard of a car, a custom electronics instructable.

Here, for your delectation is the Car-barDuino, a simple display system for analog and digital stuff, for a car, for a timer, for a thermometer, for whatever. I built it for a manifold pressure meter for friends car, I'm going to use it at work for some monitors in a research instrument.

Under the hood, it uses a micro configured to run "Arduino" sketches, so anyone can play with the code. All the spare I/O has been brought out to connectors to play with.

Enjoy and employ.

Arduino Based Meter - a many LED Driver

step 1What it can (and can't) do

In its current form, we can drive 2, 7 segment displays and a 30 element bargraph. We can mix LEDs from red/green/yellow, but it can't drive white or blue. If there was enough interest, I'd redo the design to allow higher voltage LED technology to be used. The current design is open ended, since each MAX7221 can be connected to the next over just 5 wires, and each can drive 64 LEDs at once.

There are 15 levels of digital control of LED brightness, and a SINGLE resistor to set the maximum brightness of all of the LEDs on one chip.

The processor can be any standard Arduino (Atmega 168 or 328) and with the ICSP connector, you can burn your own bootloaders.

The input interface uses a simple current limiting resistor and two diode clamps to the 5V rail. DON'T make a habit of driving into the clamps !

There are no input scaling resistors on the circuit at the moment.

What it can (and can\

step 2How it works

Here are the schematics. At the right hand end, Its a generalised, basic ATmega 168 or 328 layout, with the FTDI interface cable for serial connection to the outside world, and the ICSP connector for fast programming and/or bootloader installation. The LEDs are driven by a Max 7221 or Max 7219 (datasheet)

There are currently only two analog inputs wired, and they have diode clamps to the 5V supply rails.

The unit is designed to run off a 12V supply, there is an on-board 5V regulator that barely gets warm at all in use.

Car-barduino.pdf(431x164) 152 KB
car bar schematic.pdf(1040x807) 77 KB

step 3Building one

I designed the PCB by hand, but the PCB was made professionally. I like putting big ground planes on my boards, since it kills noise dead at the source, but it makes the board hard to make well at home. Its also seriously double sided and plated through. Whereever ground connections are made to ICs, the connection is direct to the ground plane. There are also several capacitors, which again reduce noise, so don't omit them. I am sure Maxim must have had a neat layout planned when they designed the 7221 , but I'll be damned if I can see it yet. I gave up on my auto-router too - the tracking looked nasty.

The Bill of Materials shows what you need. Suggested sources ? In the UK, Rapid, RS and Farnell have everything. Farnell is Newark in the USA.

Assembly has been made deliberately easy, since Chris, who suggested it (Hi Chris !!) hasn't got access to surface mount assembly, and should present no problems at all to anyone with decent soldering skills. There are a couple of simple SM capacitors to fit, and a resistor, which should be fitted before the Arduino !!

If anyone is interested, I have some spare PCBs that I can sell on - it turned out to be as cheap to make 5 as 1 ! Go figure. The board has a couple of very minor screwups that I'll fix if I make more of 'em, but the lucky first buyers get to fix their own.

step 4Using it

The coding is pretty simple. I integrated the whole thing using the excellent LEDcontrol library in Arduino, and it worked off the shelf.

You need to look at my "ledSetup" command to allocate the right pins to the MAX7221, and I also made things better by limiting the scanregister to 4.

Take a look at my pin mapping functions in "BarGraph" I can do dots, and bars. A bit more work, probably with the mapping function and you could do some really neat animations.

The source includes a digital filter called an "exponential forgetter" or first order low-pass filter. Its designed around binary math as far as possible, for high speed operation using shifts and not explicit multiply operations.

The input (0.1024) digits is scaled to 0..30 digits currently: there's no reason not to scale it 0.99 for the 7 segs, and scale it 0..30 for the bar.

I've got several little projects lined up, a VU meter is pretty obvious - the next gen board'll squeeze in two rows of bar, probably only 20 bits per row !

Design requests.

A couple of folks have asked about adding OBD-II interfaces to the thing. I am looking at suitable interfaces for it at the moment - there are three different standard interfaces !!

What I WILL be doing on my next boards is two rows of 20 bars + 4 digits, 2 on each line. Optionally, you can have just 30 bars on each line.

Here's a (future) list of other projects running on the same hardware. If you've got a project you've done using it, let me know in the comments and I'll add a link here:

  • VU meter, coming soon
  • Reaction timer
  • Bath thermometer
  • Kitchen timer
  • TDS/EC meter
  • Moisture meter
  • Vacuum/Boost Gauge (gage !) by skullmaster20

Arduino + Temperature + Humidity

introArduino + Temperature + Humidity

A simple temperature sensor using one LM35 Precision Temperature Sensor , Humidity Sensor and Arduino, so you can hookup on your future projects. The circuit will send serial information about the temperature and humidity so you can use on your computer. I have taken data from my compost. The project is related to an existing product daily dump with which anyone can convert kitchen waste into compost at home. For more details about product go to Digicompost displays the changes (change in temp, humidity) happening inside dump

step 1Materials

- Arduino (You can use other microcontroller, but then you will need to change the code).
- LM35 Precision Centigrade Temperature Sensor , you can get from any electronic store. Here is the DATA SHEET.
- BreadBoard.
- Humidity Sensor.
- Wires.

step 2Setting up Arduino + Temperature

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. For more information log on to (

Connecting a temperature sensor:
The LM35 has three legs and looks like a transistor. The two outside legs are
+5v and Ground, and the middle leg develops the sample voltage.

The Analog to Digital Converter (ADC) converts analog values into a digital approximation
based on the formula ADC Value = sample * 1024 / reference voltage (+5v). So with a +5 volt
reference, the digital approximation will = input voltage * 205. (Ex. 2.5v * 205 = 512.5)

The LM35 is a precision linear temperature sensor that supplies 10mv per degree Celsius.
This means at 15 degrees Celsius, it would produce a reading of .150v or 150 millivolts.
Putting this value into our ADC conversion ( .15v * 205 = 30.75) we can get a close
approximation of the Celsius temperature by dividing the digital input count by 2.

If the LM35 were supplied by a different reference voltage (9v or 12v) we would have
to use a different conversion method. For this circuit, dividing by 2 works well.

step 3Connecting Humidity Sensor

There are two pins on to the humidity sensor one is for ground and other for out which goes on the pin 3 on to arduino. I have used a local made sensor for testing humidity/ moisture but one can go for SHT15 which have both temperature and humidity.

step 4Setting up code!!!

Plug in your arduino to the computer, open the application select proper port and model no. before you start any coding. After everything is done write down the code as shown below:

int pin = 5; // analog pin
int putPin = 3; // humidity
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;

float humi = 0;
float prehum = 0;
float humconst = 0;
float truehum = 0;
float pretruehum = 0;
long pretruehumconst = 0;
long valb = 0;

void setup()
Serial.begin(9600); // start serial communication

void loop()

for(i = 0;i<=7;i++){

samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
tempc = tempc + samples[i];

tempc = tempc/8.0;
tempf = (tempc * 9)/ 5 + 32;

valb = analogRead(putPin); // humidity calculation
prehum = (valb/5);
humconst = (0.16/0.0062);
humi = prehum - humconst;
pretruehumconst = 0.00216*tempc;
pretruehum = 1.0546-pretruehumconst;
truehum = humi/pretruehum ;

Serial.print(" Celsius, ");
Serial.print ("Humidity: ");
Serial.print ((long)truehum);
Serial.println ("% ");

tempc = 0;

delay(1000); // delay before loop

After everything is done click on the upload button which will take a little while to upload and when the uploading is done make sure you click on the Serial Communication to get the readings from the sensor !!!
Setting up code!!!

Arduino EMF (Electromagnetic Field) Detector

introArduino EMF (Electromagnetic Field) Detector

A while back I saw an EMF (Electromagnetic Field) Detector at that used a led bargraph. I decided to modify it to use a 7-Segment LED Display! Here's my project. Sorry I don't have any pictures of it in use. Hopefully I can post some soon.

Credit goes to Aaron ALAI for the original project . Also Conner Cunningham at Make: for doing a remake .

Have fun, work hard, & play nice! If you have questions please ask them!


step 1The Stuff:

The parts & tools.

- Arduino
- 7-Segment LED Display
- 3.3M Resistor (Orange, Orange, Green)
- 470 ohm resistor (Yellow, Violet, Brown) or a similar value for the LED display
- Wire. I'm using 26 gauge wire
- Breadboard

- Computer with Arduino IDE
- USB A-B cable for Arduino
- Wire Strippers
The Stuff:

step 2Wire the 7-Segment LED Display

This is probably one of the most confusing parts of the project, so I'll try to be clear. But if I'm not please ask any questions you have.
I used pins 2-8 on my arduino for the display. I wired the pins on the display counter-clockwise starting at the upper-left corner. Hopefully the pictures help explain it better.

Picture 1) Display before installation.
Picture 2) Display after installation.
Picture 3) Pin 1 on the display goes to pin 2 on the Arduino.
Picture 4) Pin 2 on the display goes to pin 3 on the Arduino.
Picture 5) Pin 4 on the display goes to pin 4 on the Arduino.
Picture 6) Pin 5 on the display goes to pin 5 on the Arduino.
Picture 7) Pin 6 on the display goes to pin 6 on the Arduino.
Picture 8) Pin 8 on the display goes through the 470 ohm resistor to the side rail on the bread board
Picture 9) Pin 9 on the display goes to pin 7 on the Arduino. Also Ground on the arduino is connected to the side rail on the arduino.
Picture 10) Pin 10 on the display goes to pin 8 on the Arduino.

If you have any question please ask them!

step 3Add the Probe/Antenna

Make the antenna/probe:
- Cut a 6-7 in. piece of solid core wire.
- Strip one end so you can plug it into your breadboard
- Strip the other end about 2 in. from the end.

Add the antenna: (Pictures 2-6)
- Take the 3.3M ohm resistor and connect it from the ground on the arduino to a point on the breadboard
- Add another wire from where the resistor is connected to analog pin 5 on the arduino.
- Add the antenna to where the resistor and the wire are connected on the breadboard.

step 4The Code

Here's some basic steps to program your arduino.

1) Download the source code from below
2) Open the file in the Arduino IDE
3) Press the "Upload to I/O Board" button
4) Once the program is uploaded it will start running

Hopefully there are enough comments in the code, but if you have any questions, please ask them.

There is no difference between the .pde file & the .txt
Picture 4.png

step 5Play with it!

Now go measure EMF's! Here's a few ideas:
- Your dog/cat
- You
- Computer
- Cell phone
- TV

Make sure to use common sense, I'm not responsible for any damage to you or your arduino!

Play with it!
Related Posts Plugin for WordPress, Blogger...
Disclaimer: All the information in this blog is just gathered from different sites in the web and placed here and I am not the owner for these content

Popular Projects


My Blog List

Give Support

Give Support
Encourage me Through Comments & by Following