Home / Expert Answers / Computer Science / design-a-controller-for-a-temperature-control-lab-arduino-model-the-input-must-be-voltage-and-the-o-pa746

(Solved): Design a controller for a temperature control lab arduino model, the input must be voltage and the o ...



Design a controller for a temperature control lab arduino model, the input must be voltage and the output temperature, the set room is 23°C and the Temperature that must reach is 40°C, must raise quickly without overshoot and considers constants such as the gain of the transistor and it’s emissivity in reference to this model script in Matlab: close all; clear all; clc % include tclab.m for initialization tclab; disp('Test Heater 1') disp('LED Indicates Temperature') figure(1) t1s = []; t2s = []; h1s = []; h2s = []; % initial heater values ht1 = 0; ht2 = 0; h1(ht1); h2(ht2); for i = 1:399 tic; if i==5 disp('Turn on heater 1 to 60%') ht1 = 60; h1(ht1); end if i==105 disp('Turn off heater 1') ht1 = 0; h1(ht1); end if i==150 disp('Turn on heater 2 to 80%') ht2 = 80; h2(ht2); end if i==205 disp('Turn off heaters') ht1 = 0; ht2 = 0; h1(ht1); h2(ht2); end % read temperatures t1 = T1C(); t2 = T2C(); % LED brightness brightness1 = (t1 - 30)/50.0; % <30degC off, >100degC full brightness brightness2 = (t2 - 30)/50.0; % <30degC off, >100degC full brightness brightness = max(brightness1,brightness2); brightness = max(0,min(1,brightness)); % limit 0-1 led(brightness); % plot heater and temperature data h1s = [h1s,ht1]; h2s = [h2s,ht2]; t1s = [t1s,t1]; t2s = [t2s,t2]; n = length(t1s); time = linspace(0,n+1,n); clf subplot(2,1,1) plot(time,t1s,'r.','MarkerSize',10); hold on plot(time,t2s,'b.','MarkerSize',10); ylabel('Temperature (degC)') legend('Temperature 1','Temperature 2','Location','NorthWest') and also this matlab script: function dTdt = arduino_ode(time,T,heater) % mass m = 0.001; % kg (2 gm) % heat transfer coefficient h = 200; % W/m^2-K % surface area A = 2 / 100^2; % m^2 % heater input alpha = 0.022; % W/(heater input) % heat capacity Cp = 4900.0; % J/kg-K % approximate time constant %tau = m*Cp/(h*A); %disp(['Time constant: ' num2str(tau)]) % ambient temperature Ta = 23 + 273.15; % K heater = 100; dTdt = (h*A * (Ta - T) + alpha * heater) / (m*Cp); end subplot(2,1,2) plot(time,h1s,'r-','LineWidth',2); hold on plot(time,h2s,'b--','LineWidth',2); ylabel('Heater (0-5.5 V)') xlabel('Time (sec)') legend('Heater 1','Heater 2','Location','NorthWest') drawnow; t = toc; pause(max(0.01,1.0-t)) end disp('Turn off heaters') h1(0); h2(0); disp('Heater Test Complete')



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe