ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Temperature controller
? ??? ?????
¨C ??????????????????????????????????????
¨C ??????????????????????????????? AC relay
DS18b20 (~150oC)
Thermocouple (~750oC)
Relay module
? ????? ETT-OPTO RELAY4 ?????????? AC ????? 4 ????
http://www.ett.co.th/download2.html
ETT OPTO-RELAY4
? ??? relay ???????????????
????? normally open
DS18B20 sensor
? ???????????? 1-wire ?????????????????
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
? ?????? Arduino ??????????????? DS18B20
http://playground.arduino.cc/Learning/OneWire
http://www.pjrc.com/teensy/td_libs_OneWire.html
Thermocouple shield
? ??????????????????????????? Seebeck ????????????????
?????????????????????? ? (???? mV)
¨C ?????????????????????????? (offset) ????????????? (amplify)
? ??? thermocouple shield ??????????????
https://oceancontrols.com.au/KTA-259.html
Procedure
? ???????? Arduino ???????????????????????
¨C ????????????????????????????????????? serial monitor
¨C ???????????????/????? ?????????????????? 1 ??????
¨C ???????????????? ????????????????????????????????? (Smax)
¨C ??????????????????? (Tmax)
? ???????? Arduino ?????????????????????????????????????
¨C ???????????????????? ?T = Tmax / 100
¨C ???????????????????? = 0.1 * ?T/Smax
(??????????? 1 ?????? ?????????? 1 ??????)
¨C ???????????/??????? pulse-width modulation
#define STEP (X)
const int onPeriod = Y;
const int offPeriod = Z;
void setup() {
initTempSensor();
initRelayBoard();
Serial.begin(9600);
}
void loop() {
float temp = readTempSensor();
Serial.print("Temp: "); Serial.println(temp);
delay(X*Y);
onRelay();
delay(X*Z);
offRelay();
}
?????????????????????????????
???????????? ????? msec
?????? burst firing
? ???????????? PWM ????????????? AC ????????????? triac
????????????? zero-crossing ??????????????????
¨C ????????? burst firing ??????? AC
power ?????????????????????????
¨C ??? cycle time ????????????????????
???? ?????????????????????????????????
const int relayPin = X;
const int onPeriod[] = {0,1,1,2,2,3,6,7,8,9,10};
const int offPeriod[] = {5,9,5,4,5,3,4,3,2,1,0};
void heaterOn(int duty_cycle) {
if (duty_cycle > 0) {
idx = duty_cycle/10; // lookup table step 10%
if (onPeriod[idx] > 0) {
digitalWrite(relayPin, HIGH);
delay(onPeriod[idx]*1000);
}
if (offPeriod[idx] > 0) {
digitalWrite(relayPin, LOW);
delay(offPeriod[idx]*1000);
}
} else {
delay(10000);
}
}
PID controller
? ????????????? = ????????????????????????????
error = setpoint - feedback
? setpoint ?????????? potentiometer
? Feedback ???????????????????
#define MAX_TEMP (X.Y)
const float Kp = 1.0;
const float Ki = 0.0;
const float Kd = 0.0;
float sumErr = 0.0;
float lastTemp = 0.0;
setpoint = (analogRead(0)/5.0) * 100;
temp = readTempSensor()/MAX_TEMP * 100;
float pidCtrl(float setpoint, float temp) {
float error, ctrl, tempChange;
error = setpoint ¨C temp;
sumErr += error;
tempChange = speed ¨C lastTemp;
ctrl = Kp*error + Ki*sumErr + Kd*tempChange;
lastTemp = temp;
return ctrl;
}
??????????????????????????? PID
????????????
??? pot ????? A0
const int PERIOD (X);
int ratioPWM(float ctrl) {
int onPeriod = (PERIOD*STEP) * (ctrl/100);
if (onPeriod > 0) {
onRelay();
delay(onPeriod);
offRelay();
delay(PERIOD*STEP - onPeriod);
} else {
offRelay();
delay(PERIOD*STEP);
}
}
??????????????????????????? PID
????????
Results
? ????????????? (?????? 3-4 ???? ?????????????)
¨C ??????????????????????????????????????????????????
¨C ???????????????????????????????????????????? PWM ?????????? ???
???????????????????????? ON/OFF ????????
¨C ?????????????????????????????? PID ????????? PERIOD = 10,
15, 20, 25
¨C ????????????????????????????????????????????? potentiometer
? ?????????????????????????????????????????????
¨C ??????????????????????? ?????????????? 220Vrms ??????????? ?????

More Related Content

What's hot (20)

PPTX
Atom molecules and nuceli
sangitaholkar
?
PPTX
I-Beam Robot From inex.co.th
Innovative Experiment Co.,Ltd.
?
PPTX
floating point multiplier
Bipin Likhar
?
PDF
????????????????????????
Jeejii Believe
?
PDF
SPI Protocol in LPC2148
Dnyanesh P. Joshi
?
PDF
?????????????????????????
Khemjira_P
?
DOCX
Embedded real time clock based industrial devices control system
Logic Mind Technologies
?
PDF
???????????? 1 ?????????????
??????? ??????????
?
PPT
????????????
Saranyu Srisrontong
?
PDF
????????????3 ????
sakass74
?
PPTX
Arduino ÈëéT
mitunaga
?
PDF
??????????????????? ????????? ????? ???????????
National Science and Technology Development Agency (NSTDA) - Thailand
?
PPTX
MICROCONTROLLER 8051- Architecture & Pin Configuration
AKHIL MADANKAR
?
PDF
???????
kroojaja
?
PPTX
8051 microcontroller features
Tech_MX
?
PPTX
Interrupts in pic
v Kalairajan
?
DOC
????
naparat2513
?
PPTX
???????????????????????????? IPST-SE
Innovative Experiment Co.,Ltd.
?
PDF
????? 1 ??????????????????
sawed kodnara
?
PPTX
Clock divider by 3
Ashok Reddy
?
Atom molecules and nuceli
sangitaholkar
?
I-Beam Robot From inex.co.th
Innovative Experiment Co.,Ltd.
?
floating point multiplier
Bipin Likhar
?
????????????????????????
Jeejii Believe
?
SPI Protocol in LPC2148
Dnyanesh P. Joshi
?
?????????????????????????
Khemjira_P
?
Embedded real time clock based industrial devices control system
Logic Mind Technologies
?
???????????? 1 ?????????????
??????? ??????????
?
????????????
Saranyu Srisrontong
?
????????????3 ????
sakass74
?
Arduino ÈëéT
mitunaga
?
??????????????????? ????????? ????? ???????????
National Science and Technology Development Agency (NSTDA) - Thailand
?
MICROCONTROLLER 8051- Architecture & Pin Configuration
AKHIL MADANKAR
?
???????
kroojaja
?
8051 microcontroller features
Tech_MX
?
Interrupts in pic
v Kalairajan
?
???????????????????????????? IPST-SE
Innovative Experiment Co.,Ltd.
?
????? 1 ??????????????????
sawed kodnara
?
Clock divider by 3
Ashok Reddy
?

Viewers also liked (6)

PPTX
????????????????????????????????
Supachai Vorapojpisut
?
PPTX
???????? optokinetic drum ???? Arduino
Supachai Vorapojpisut
?
PDF
?????????????????? One (language) for All (platforms)
Supachai Vorapojpisut
?
PDF
?????????????????? 3 ??????
Supachai Vorapojpisut
?
PDF
ARM 7 LPC 2148 lecture
anishgoel
?
PPTX
LPC 2148 ARM MICROCONTROLLER
sravannunna24
?
????????????????????????????????
Supachai Vorapojpisut
?
???????? optokinetic drum ???? Arduino
Supachai Vorapojpisut
?
?????????????????? One (language) for All (platforms)
Supachai Vorapojpisut
?
?????????????????? 3 ??????
Supachai Vorapojpisut
?
ARM 7 LPC 2148 lecture
anishgoel
?
LPC 2148 ARM MICROCONTROLLER
sravannunna24
?
Ad

?????????????????

  • 1. Temperature controller ? ??? ????? ¨C ?????????????????????????????????????? ¨C ??????????????????????????????? AC relay DS18b20 (~150oC) Thermocouple (~750oC)
  • 2. Relay module ? ????? ETT-OPTO RELAY4 ?????????? AC ????? 4 ???? http://www.ett.co.th/download2.html
  • 3. ETT OPTO-RELAY4 ? ??? relay ??????????????? ????? normally open
  • 4. DS18B20 sensor ? ???????????? 1-wire ????????????????? http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf ? ?????? Arduino ??????????????? DS18B20 http://playground.arduino.cc/Learning/OneWire http://www.pjrc.com/teensy/td_libs_OneWire.html
  • 5. Thermocouple shield ? ??????????????????????????? Seebeck ???????????????? ?????????????????????? ? (???? mV) ¨C ?????????????????????????? (offset) ????????????? (amplify) ? ??? thermocouple shield ?????????????? https://oceancontrols.com.au/KTA-259.html
  • 6. Procedure ? ???????? Arduino ??????????????????????? ¨C ????????????????????????????????????? serial monitor ¨C ???????????????/????? ?????????????????? 1 ?????? ¨C ???????????????? ????????????????????????????????? (Smax) ¨C ??????????????????? (Tmax) ? ???????? Arduino ????????????????????????????????????? ¨C ???????????????????? ?T = Tmax / 100 ¨C ???????????????????? = 0.1 * ?T/Smax (??????????? 1 ?????? ?????????? 1 ??????) ¨C ???????????/??????? pulse-width modulation
  • 7. #define STEP (X) const int onPeriod = Y; const int offPeriod = Z; void setup() { initTempSensor(); initRelayBoard(); Serial.begin(9600); } void loop() { float temp = readTempSensor(); Serial.print("Temp: "); Serial.println(temp); delay(X*Y); onRelay(); delay(X*Z); offRelay(); } ????????????????????????????? ???????????? ????? msec
  • 8. ?????? burst firing ? ???????????? PWM ????????????? AC ????????????? triac ????????????? zero-crossing ?????????????????? ¨C ????????? burst firing ??????? AC power ????????????????????????? ¨C ??? cycle time ???????????????????? ???? ?????????????????????????????????
  • 9. const int relayPin = X; const int onPeriod[] = {0,1,1,2,2,3,6,7,8,9,10}; const int offPeriod[] = {5,9,5,4,5,3,4,3,2,1,0}; void heaterOn(int duty_cycle) { if (duty_cycle > 0) { idx = duty_cycle/10; // lookup table step 10% if (onPeriod[idx] > 0) { digitalWrite(relayPin, HIGH); delay(onPeriod[idx]*1000); } if (offPeriod[idx] > 0) { digitalWrite(relayPin, LOW); delay(offPeriod[idx]*1000); } } else { delay(10000); } }
  • 10. PID controller ? ????????????? = ???????????????????????????? error = setpoint - feedback ? setpoint ?????????? potentiometer ? Feedback ???????????????????
  • 11. #define MAX_TEMP (X.Y) const float Kp = 1.0; const float Ki = 0.0; const float Kd = 0.0; float sumErr = 0.0; float lastTemp = 0.0; setpoint = (analogRead(0)/5.0) * 100; temp = readTempSensor()/MAX_TEMP * 100; float pidCtrl(float setpoint, float temp) { float error, ctrl, tempChange; error = setpoint ¨C temp; sumErr += error; tempChange = speed ¨C lastTemp; ctrl = Kp*error + Ki*sumErr + Kd*tempChange; lastTemp = temp; return ctrl; } ??????????????????????????? PID ???????????? ??? pot ????? A0
  • 12. const int PERIOD (X); int ratioPWM(float ctrl) { int onPeriod = (PERIOD*STEP) * (ctrl/100); if (onPeriod > 0) { onRelay(); delay(onPeriod); offRelay(); delay(PERIOD*STEP - onPeriod); } else { offRelay(); delay(PERIOD*STEP); } } ??????????????????????????? PID ????????
  • 13. Results ? ????????????? (?????? 3-4 ???? ?????????????) ¨C ?????????????????????????????????????????????????? ¨C ???????????????????????????????????????????? PWM ?????????? ??? ???????????????????????? ON/OFF ???????? ¨C ?????????????????????????????? PID ????????? PERIOD = 10, 15, 20, 25 ¨C ????????????????????????????????????????????? potentiometer ? ????????????????????????????????????????????? ¨C ??????????????????????? ?????????????? 220Vrms ??????????? ?????