Sunteți pe pagina 1din 4

Microcontroller Projects All About Microcontrollers

Ads by Google

Arduino Project About Electrical Wiring AC DC Power Supply

Control Relay Electrical Wire A Make Up

SSR(Solid State Relay) Interfacing with Arduino: Auto AC(Air


Home
Conditioner) ON/OFF Switch
Microcontroller Projects
This tutorial is about interfacing SSR(Solid State Relay) with arduino uno. An auto air conditioner on off switch is made
Stm32f103 Projects
as a diy project. Lets start with with what is SSR? SSR stands for Solid State Relay. Now whats the difference between

Arduino Projects
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
Esp8266 Projects 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
Pic Microcontroller Projects
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.
Knowledge based
SSR are offered by many companies. Some top companies are Broadcom, Crydom, IXYS, Omron, Panasonic, Phoenix
About/Contact Us Contact, Scneider Electric, TE Connectivity, Teledyne, Vishay. I am going to use Crydomssr in the project below.

Nodemcu dc motor speed control 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.
China Micro DHT22 Temperature Sensor

Switches - 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
China 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
Manufacturer than dht11.
Project Circuit Diagram
Micro switch, waterproof
switch China Project circuit is simple connect the DHT22
digital pin with the digital Pin#2 of arduino.
manufacturer & exporter. Between the dht22 vcc and data pin insert a
switch-china.com 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.
Microcontroller Projects
Crydom SSR(Solid state relay) interfacing with arduino and dht22 temperature sensor

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.

SSR with microcontroller and transistor

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.

Control Heavy Loads with Microcontrollers

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.

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.

Project Code
Download the project code from the links given at the bottom of the Post.

//***********************************************
//Property off: www.microcontroller-project.com *
//Written by : Usman Ali Butt *
//Date : 7/5/2017 *
//***********************************************

#include "DHT.h"
#define DHTPIN 2 //DHT22 digital pin to Arduino pin connection

// Uncomment the sensor you are using i am using DHT22


//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Initialize DHT sensor.


DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println("DHT22 test!");
pinMode(7, OUTPUT); //SSR switching on/off pin
dht.begin(); //Begin sensor operation
}

void loop() {
delay(2000); //2 seconds delay

// Reading temperature or humidity takes about 250 milliseconds!


// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
// Read temperature as Celsius (the default)
float t = dht.readTemperature();

Serial.print("Temperature: ");
Serial.print(t); //Print temperature on serial monitor
Serial.print(" *C ");

if(t<=22){ //Temperature less than 22 *C switch off AC(Air Conditioner)


digitalWrite(7, LOW);
}

if(t>=23){ //Temperature greater than 22 *C switch on AC(Air Conditioner)


digitalWrite(7, HIGH);
}

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.
Ads by Google

About Electrical Wiring AC DC Power Supply

A Make Up Electricity Wiring

Project Folder/Code

Stepper motor Driver Driving heavy loads with China Micro Switches - How to measure Dc
Solutions - TECHNOVISION microcontrollers China Manufacturer current with arduino
Stepper Circuits
Ad servosteppermotor.com microcontroller-project.com Ad switch-china.com microcontroller-project.com

Total Ultrasonic Solution l293d motor driver Measuring Dc Current L293D Pinout and
controlling direction of with Arduino and Asc712 Working
rotation with arduino Current Sensor
Ad www.prowave.com.tw microcontroller-project.com microcontroller-project.com microcontroller-project.com
0 Comments https://www.microcontroller-project.com 
1 Login

Sort by Best
 Recommend ⤤ Share

Start the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

Be the first to comment.

ALSO ON HTTPS://WWW.MICROCONTROLLER-PROJECT.COM

RS485 Communication between Arduino Mega and Increasing Digital I/O Pins of Arduino -
Arduino Pro Mini - Microcontroller Projects Microcontroller Projects
1 comment • 22 days ago 2 comments • 21 days ago
Mahir GÜL — Thanks Usman Ali Butt — In simulation their are no resistors. But in
the project circuit diagram resistors are present.

✉ Subscribe d Add Disqus to your site 🔒 Disqus' Privacy Policy