This tutorial is about interfacing SSR(Solid State Relay) with arduino uno. An auto air conditioner on off switch is made as a diy project. Lets start with with what is SSR? SSR stands for Solid State Relay. Now whats the difference between normal relay and ssr? Normal relays are mechanical relays where as ssr is not mechanical. SSR uses opto-isolator mechanism to switch high power loads. Like mechanical relays the ssr provides electrical isolation between two circuits and opto-isolator(optocoupler) acts like a switch between two circuits. SSR have some advantages over mechanical relays. They can be switched on with much lower dc voltage and current. SSR can be switched on with minimum 3 volts dc. SSR can control much high power loads than mechanical relays. Switching speed of ssr is much greater than mechanical. Since their is no mechanical part in ssr so they produce no sound during switching.
SSR are offered by many companies. Some top companies are Broadcom, Crydom, IXYS, Omron, Panasonic, Phoenix Contact, Scneider Electric, TE Connectivity, Teledyne, Vishay. I am going to use Crydomssr in the project below.
SSR are offered by many companies. Some top companies are Broadcom, Crydom, IXYS, Omron, Panasonic, Phoenix Contact, Scneider Electric, TE Connectivity, Teledyne, Vishay. I am going to use Crydomssr in the project below.
AC auto ON/OFF on Temperature
I am going to measure the temperature of the room and depending on temperature i will make the switch the AC on or off. DHT22 1-wire temperature sensor is interfaced with the arduino to measure the temperature of the room.
DHT22 Temperature Sensor
The DHT22 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air. It outputs a digital signal on the data pin. Its simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it after every 2 seconds. DHT22 is an up gradation to DHT11. DHT22 is bigger temperature and humidity range also its more precise than dht11.
Solid state relay with arduino – Project Circuit Diagram
Project circuit is simple connect the DHT22 digital pin with the digital Pin#2 of arduino. Between the dht22 vcc and data pin insert a 10k pull up resistor. Ground the gnd pin of dht22. I powered the dht22 with the arduino +5 volt output. For SSR(Solid State Relay) i used the digital Pin#7. Connect the input +positive end of ssr directly to Pin#7 of arduino. Make the other pin ground. Insert a 10k pull dpwn resistor between the inputs of SSR. This resistor will tighten the ssr pinnot to float. On the other ends of the ssr connect the mains line of electricity.
Circuit diagram of the project is given on the right hand side. Arduino is powered through an external +12 volt power supply. |
The upper configuration worked for me. Running the ssr directly from digital pins of arduino. The crydom ssr given in the above pic that i used requires 3 to 32 volts dc to switch on the other circuit. At output side you can connect a maximum load of 240 volts ac and up to 40 amperes of current. Crydom ssr’s are nice and i used them in many of mine projects. I even purchased the used SSR’s from eBay and used them in my projects and i never received any complainants.
Some people said that this configuration did not worked for them I think it might be due to the input dc voltage required. May be the SSR’s they are using require more voltage and current at input side. So i recommend to used a transistor to switch on the ssr, instead of directly switching on the ssr with microcontroller gpio(General Purpose Input/Output) pin. The transistor configuration is gien on the left hand side. An NPN transistor is used to switch on the ssr with +12 volts. |
The base of the transistor is controlled by the microcontroller. I recommend to use this configuration as it ensures that voltage will not drop below 3 volts.Their are also other alternatives to SSR and we can control high power loads with them. I wrote a good tutorial on it.
Coming to the code portion. I first included the dht temperature sensor library in the code. The library is valid for DHT11, DHT21 and DHT22 temperature sensor means we can use the three sensors with the same library. I am using DHT22 so i passed the DHT22 as reference to DHT class. Than i declared the ssr controlling pin arduino Pin#7 as output and begin the dht sensor reading.
I controlled my home ac with the same configuration given above. The only problem that i faced is that the ssr gets too hot when the temperature increases 30 degree centigrade. So i installed a nice big heat sink with the ssr. It still heat up when the temperature goes above 33 but not as much hot as it was heating before heat sink installation.
Note: If you do not have DHT22 with you. You can connect any DHT11 or DHT21 sensor with the same configuration for DHT22. Just replace the DHT22 with DHT11 or DHT21.
I am using DHT22 as only a centigrade/Celsius temperature though it can also output Fahrenheit temperature. I am also not using its humidity value. I am switching the ac on off on the centigrade temperature. If the temperature is less than 22 degree centigrade the ssr remains off. It the temperature increases from 22 degree centigrade the ac automatically switches on. Between each reading i also inserted the 2 seconds delay to ensure that the DHT22 sensor has updated his reading and its not the same as previous one.
I controlled my home ac with the same configuration given above. The only problem that i faced is that the ssr gets too hot when the temperature increases 30 degree centigrade. So i installed a nice big heat sink with the ssr. It still heat up when the temperature goes above 33 but not as much hot as it was heating before heat sink installation.
Download the project code. Folder contains arduino .ino project file. Please give us your feed back on the project. If you have any queries please write them below in the comments section.
Filed Under: Arduino Projects, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.