Arduino Heating or Cooling Control - SHProject 5

by DeviceCtrl in Circuits > Arduino

972 Views, 9 Favorites, 0 Comments

Arduino Heating or Cooling Control - SHProject 5

PXL_20240710_164903402.jpg

My daughter's bedroom is situated at the opposite end of the house from the HVAC system. Therefore, it can be a bit cold in the winter and hot during the summer months. To solve this problem, I used an Arduino to monitor the room temperature and turn on and off a space heater or window A/C unit depending on the season. This will require wiring 120vac to a sold state relay and then to AC outlet. Do not attempt this unless you have experience with house voltage and understand this can be very dangerous if done incorrectly.

Downloads

Supplies

arduino uno pinout.png

Arduino Uno

DS18b20 Temperature sensor

I2C IIC 1602 LCD Display Module 16x02

360 degree Rotary Encoder

Solid State Relay

Heat Sink

120vac 20amp electrical outlet

120vac rated power cord pig-tail

project box

Radiator Heater - Oil Heater with Overheat Protection

Window A/C unit

Arduino Schematic

bedroom_Arduino_schematic.png
IMG_20190823_121000.png

I like to begin my Arduino projects by mocking up the wiring using bread boards and jumper wires. Adding each component one by one, ensuring that I have hooked them up correctly and they are giving the expected results. So follow the above diagram to construct the device. (It's good if you have help and expert advice, like I do.)

DS18B20 Temperature Sensor - Stainless Steel

F4778LPLXC72XK0.png
FZL0RHJLXC72Z4M.jpg

The DS18B20 requires a 4.7k ohm resistor between power and the signal wire. The nice thing about these temperature sensors is that you can connect multiple sensors to the same digital pin. And you still only need one resistor. (see the images above) In addition, they come in different lengths and in-cased in water-resistant housings.

It's smart to start with the DS18B20 sensors because you will need to discover each device id using the example code installed when you down the Arduino library Dallas Temperature. Look for file Tester.pde or oneWireSearch.ino

There are 2 temperature sensors. One will just be mounted in the open air. The second will also be mounted up against the exterior wall. This is a brick wall that is 13 inches thick, but has no insulation.

Downloads

LCD Display

i2c-1602-lcd_wiring.jpg
1TKZH.png
i2c-1602-lcd_backlight.jpg

This LCD display is very easy to setup and use. Arduino has a library that works well. Find it here: Arduino I2C LCD Reference. To use this library, open the Library Manager in the Arduino IDE and install it from there. They have some great examples. My display was capable of some extended characters. Included is a table showing them.

These LCDs are nice and bright. However, that is not always the best for use in a bedroom. On the back there is variable resistor that can dim the foreground (ie the characters). But the background light intensity is set to a fixed value by a jumper. Remove the jumper and connect a variable resistor and its now possible to change the background light intensity.

The Setpoint

360 Degree Rotary Encoder.jpg

The SetPoint is the desired temperature in the prescribed living space. Often we speak about setting the temperature in our home. Strictly speaking one can't set the temperature, the temperature can only be measured. In HVAC system they talk of the SetPoint. This is the target temperature we want our heating/cooling system to achieve. If you have looked at my code, you see that the Arduino maintains 2 SetPoints, the heating SetPoint and the cooling SetPoint. Rarely, do we want those to be the same value, especially in a bedroom. The 360 degree Rotary encoder is an easy and intuitive user interface to raise and lower the desired SetPoint.

Arduino has a library that works well. Find it here: Arduino RotaryEncoder Reference. To use this library, open the Library Manager in the Arduino IDE and install it from there. They also have some great examples.

Wire the SSRelay to Electrical Outlet

ssrelay-outlet.png
powercord-pigtail.png

While it is possible to hard-wire a 120vac line to the project box, I choose not to, as it really requires a licensed electrician. I used a 120vac rated power cord called a pig-tail. The ground wire (green) and the neutral wire (white) connects to the ground screw and neutral side, respectively on the outlet. The black wire connects to the + positive side or input side of the solid state relay. The output side of the SSR returns to the electrical outlet.

Always be very careful working 120vdc line voltage.

Assemble in Project Box

project_box.png
heatsink.png

I attached the heat-sink to the SSR and cut a slot in the project box so it projected outside the box. The AC unit draws a lot of amps and causes the SSR to heat. Its kind of ugly, but its under a small night stand so its out of sight.

Arduino Ethernet Shield

61aiitos81L._AC_SL1000_.jpg

While preparing and mounting all the components, don't forget to first mount the Ethernet shield to the Arduino Uno. During the renovation of my home, I had the foresight to install Cat6 Ethernet cable and low-voltage wiring everywhere. If an Ethernet cable is not available, Arduino makes a WiFi shield for the Uno.

Connect Heating or Cooling Unit

PXL_20240710_170055358.jpg
heating_setup.png
41DsMPY0pOL._SY90_.jpg

Once the power cord is plugged in the wall, then we can plug in heat radiator or the window AC unit

Polling the Supplemental HVAC Unit

FHRDZ5BLXDJ6XWO.png

I wanted to track this units activity to compare how much it is used. I have my PC poll HVAC unit every minute and store the readings in a SQL database. This gives me both up-to-date usage readings and daily, monthly and yearly history. (This became very important when analyzing HVAC costs/usage.)


I decided to use UDP protocol instead of TCP. Arduino's Ethernet/WIFI library include software to communicate using UDP. Every minute my PC sends a timestamp in the form of r2406131422054 - this translate to 2024-06-13 14:22:05 4=Thursday (ie day of the week)

Sending a timestamp to my Arduino devices is very handy. It allows the device to know the date and time (within a second) without any additional code, NTC sync or RTC device.


If the device receives this string, it immediately responds with a tab delimited string of the current sensor readings. like: 768\tC\t77\t1\t0\t806