Vous êtes sur la page 1sur 8

Republic of Iraq

Ministry of Higher Education


and Scientific Research
University of Technology
Control and Systems
Engineering Department

ON-OFF pulse proportional speed control of a DC motor

using Temperature Sensor

.Automation LAB ‫اسم املادة‬

‫ وسن شاكر محمود‬:‫اسم الطالب‬

‫ ميكاترونكس‬: ‫الفرع‬

‫ الرابعة‬:‫املرحلة‬

)‫ ( صباحية‬:‫نوع الدراسة‬

1
Objective:
To practice controlling the speed of a DC motor using PWM technique based on
Arduino UNO. The experiment goal is to implement a double control action. The first
control action is the ON-OFF control of the DC motor. The second control action is
how to control the speed of the DC Motor proportionally according to the
temperature measurement changes.

Introduction:
Temperature controller is the prime requirement of any processing or manufacturing
or chemical or textile industry. They require temperature controller for their different
processes. In any industrial temperature controller system there is temperature sensor,
temperature setting device, display device, temperature controlling device (like
heater,cooler, compressor etc) and the main controlling device like micro controller.

Producer :

float t,te,ismon;
int MA1=4,MA2=5,ledPin =8;
void setup() {
2
pinMode(MA1, OUTPUT);
pinMode(MA2, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
float tempc = (voltage - 0.5)*100;
int pwm=(tempc/125)*255;
analogWrite(10, pwm);

Serial.print("V=");
Serial.print(voltage);
Serial.print("");
Serial.print("T=");
Serial.print(tempc);
Serial.print("");
Serial.print("PWM=");
Serial.println(pwm);
if(tempc>=25){
digitalWrite(MA1, LOW);
digitalWrite(MA2, HIGH);
digitalWrite(ledPin, HIGH);
Serial.print("fan=on");

else {
digitalWrite(MA1, LOW);
digitalWrite(MA2, LOW);
digitalWrite(ledPin, LOW);
Serial.print("fan=off");
}

Temperature Sensor DC Motor PWM DC Motor


TM36 sensors Output Situation Speed
C Voltage(volt) (ON-OFF) (rpm)

3
-10c 0.41 OFF 0 0
0c 0.51 OFF 0 0
15c 0.65 OFF 0 0
26c 0.76 ON 55 2140
50c 1.01 ON 102 3800
75c 1.25 ON 153 5780
95c 1.45 ON 194 7194
110c 1.61 ON 226 8266
120c 1.71 ON 247 9177
(124.8c) 1.75 ON 255 9397

Discussion:
1-

float t,te,ismon;
int MA1=4,MA2=5,ledPin =8;
void setup() {
pinMode(MA1, OUTPUT);
4
pinMode(MA2, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
float tempc = (voltage - 0.5)*100;
int pwm=(tempc/125)*255;
analogWrite(10, pwm);

Serial.print("V=");
Serial.print(voltage);
Serial.print("");
Serial.print("T=");
Serial.print(tempc);
Serial.print("");
Serial.print("PWM=");
Serial.println(pwm);
if(tempc>=25){
digitalWrite(MA1,HIGH);
digitalWrite(MA2, LOW);
digitalWrite(ledPin, HIGH);
Serial.print("fan=on");

else {
digitalWrite(MA1, LOW);
digitalWrite(MA2, LOW);
digitalWrite(ledPin, LOW);
Serial.print("fan=off");
}

Temperatur Sensor DC Motor PWM1 DC PWM2 DC


e Output Situation Motor2 Motor2
TM36 Voltage(volt) (ON-OFF) Speed Speed
sensors (rpm) (rpm)
C
5
-10c 0.41 OFF -20 0 -20 0
0c 0.51 OFF 0 0 0 0
15c 0.65 OFF 30 0 30 0
26c 0.76 ON 55 2140 55 2140
50c 1.01 ON 102 3800 102 3800
75c 1.25 ON 153 5780 153 5780
95c 1.45 ON 194 7194 194 7194
110c 1.61 ON 226 8266 226 8266
120c 1.71 ON 247 9177 247 9177
(124.8c) 1.75 ON 255 9397 255 9397

2-

int MA1=4,MA2=5,ledPin1=8;
int MB1=6,MB2=7,ledPin2=3;
void setup() {
6
pinMode(MA1, OUTPUT);
pinMode(MA2, OUTPUT);
pinMode(ledPin1 ,OUTPUT);
pinMode(MB1, OUTPUT);
pinMode(MB2, OUTPUT);
pinMode(ledPin2,OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
float tempc = (voltage - 0.5)*100;
int pwm=(tempc/125)*255;
analogWrite(10, pwm);
analogWrite(9, pwm);
Serial.print("V=");
Serial.print(voltage);
Serial.print("__");
Serial.print("T=");
Serial.print(tempc);
Serial.print("__");
Serial.print("PWM=");
Serial.println(pwm);
if(tempc>=25&&tempc<75){
digitalWrite(MA1, LOW);
digitalWrite(MA2, HIGH);
digitalWrite(ledPin1, HIGH);
digitalWrite(MB1, LOW);
digitalWrite(MB2, LOW);
digitalWrite(ledPin2, LOW);
}
else if(tempc>=75){
digitalWrite(MA1, LOW);
digitalWrite(MA2, HIGH);
digitalWrite(ledPin1, HIGH);
digitalWrite(MB1, LOW);
digitalWrite(MB2, HIGH);
digitalWrite(ledPin2, HIGH);
}

else {
digitalWrite(MA1, LOW);
7
digitalWrite(MA2, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(MB1, LOW);
digitalWrite(MB2, LOW);
digitalWrite(ledPin2, LOW);
}}

Temperatur Sensor DC DC PWM1 DC PWM2 DC


e Output Motor1 Motor2 Motor2 Motor2
TM36 Voltage(volt Situation Situation Speed Speed
sensors ) (ON-OFF) (ON- (rpm) (rpm)
C OFF)
-10c 0.41 OFF OFF -20 0 -20 0
0c 0.51 OFF OFF 0 0 0 0
15c 0.65 OFF OFF 30 0 30 0
26c 0.76 ON OFF 55 2140 55 0
50c 1.01 ON OFF 102 3800 102 0
75c 1.25 ON ON 153 5780 153 5780
95c 1.45 ON ON 194 7194 194 7194
110c 1.61 ON ON 226 8266 226 8266
120c 1.71 ON ON 247 9177 247 9177
(124.8c) 1.75 ON ON 255 9397 255 9397

Vous aimerez peut-être aussi