Cov txheej txheem:

Thermostat Raws Arduino: 6 Kauj Ruam
Thermostat Raws Arduino: 6 Kauj Ruam

Video: Thermostat Raws Arduino: 6 Kauj Ruam

Video: Thermostat Raws Arduino: 6 Kauj Ruam
Video: When The Quiet Kid Does Your Homework 💀 #electronics #arduino #engineering 2024, Kaum ib hlis
Anonim
Thermostat Raws Arduino
Thermostat Raws Arduino
Thermostat Raws Arduino
Thermostat Raws Arduino
Thermostat Raws Arduino
Thermostat Raws Arduino

Lub sijhawm no peb tab tom tsim Lub ntsuas cua sov raws li Arduino, ntsuas qhov ntsuas kub thiab tso tawm. Koj tuaj yeem pom ntawm github

Kauj ruam 1: Kev teeb tsa

Kev teeb tsa
Kev teeb tsa

Kev teeb tsa tag nrho raug khaws cia hauv Config.h. Koj tuaj yeem hloov tus lej PIN tswj kev xa xov, ntsuas kub, qhov pib lossis sijhawm.

Kauj ruam 2: Configuring Relays

Cia peb xav tias peb xav kom muaj 3 qhov txuas:

  • ID: 0, PIN: 1, Qhov ntsuas kub: 20
  • ID: 1, PIN: 10, Kev ntsuas kub: 30
  • ID: 2, PIN: 11, Kev ntsuas kub: 40

Ua ntej koj yuav tsum paub tseeb tias tus lej PIN uas koj xaiv tsis tau siv lawm. Txhua tus pins tuaj yeem nrhiav tau hauv Config.h, lawv tau txhais los ntawm kev hloov pauv pib nrog DIG_PIN.

Koj yuav tsum hloov kho Config.h thiab teeb tsa tus lej PIN, qhov pib thiab tus nqi ntawm kev xa tawm. Pom tseeb qee cov khoom muaj nyob lawm, yog li koj yuav tsum tau kho lawv xwb.

const zoo li qub uint8_t DIG_PIN_RELAY_0 = 1; const zoo li qub uint8_t DIG_PIN_RELAY_1 = 10; const zoo li qub uint8_t DIG_PIN_RELAY_2 = 11;

const zoo li qub uint8_t RELAYS_AMOUNT = 3;

const zoo li qub int16_t RELAY_TEMP_SET_POINT_0 = 20;

const zoo li qub int16_t RELAY_TEMP_SET_POINT_1 = 30; const zoo li qub int16_t RELAY_TEMP_SET_POINT_2 = 40;

Tam sim no peb yuav tsum teeb tsa kev xa tawm thiab tus tswj hwm, qhov no tshwm sim hauv RelayDriver.cpp

initRelayHysteresisController (0, DIG_PIN_RELAY_0, RELAY_TEMP_SET_POINT_0); initRelayHysteresisController (1, DIG_PIN_RELAY_1, RELAY_TEMP_SET_POINT_1); initRelayHysteresisController (2, DIG_PIN_RELAY_2, RELAY_TEMP_SET_POINT_2);

xxx

Kauj Ruam 3: Hysteresis Controller

Nws yog qhov xaiv hauv qhov piv txwv saum toj no, nws muaj ob peb qhov kev teeb tsa ntxiv:

const zoo li qub uint32_t RELAY_DELAY_AFTER_SWITCH_MS = 300000; // 5 minutesconst static uint32_t RHC_RELAY_MIN_SWITCH_MS = 3600000;

RELAY_DELAY_AFTER_SWITCH_MS muab sijhawm tos rau kev hloov pauv tom ntej Xav txog qhov teeb tsa los ntawm peb tus piv txwv yuav pib ua haujlwm hauv 40 degrees ib puag ncig. Qhov no yuav ua rau muaj peev xwm ua tau ntawm peb qhov kev xa tawm tib lub sijhawm. Qhov no tuaj yeem ua rau siv hluav taws xob siab - nyob ntawm seb koj tab tom tswj hwm, lub cav hluav taws xob piv txwv li siv lub zog ntau dua thaum pib. Hauv peb qhov xwm txheej hloov pauv tau muaj cov dej hauv qab no: thawj kis mus, tos 5 feeb, thib ob mus, tos 5 feeb, thib peb mus.

RHC_RELAY_MIN_SWITCH_MS txhais hysteresis, nws yog qhov tsawg kawg nkaus rau qhov tshwj xeeb xa mus hloov nws lub xeev. Thaum nws qhib, nws yuav nyob rau qhov tsawg kawg rau lub sijhawm no, tsis quav ntsej qhov hloov pauv kub. Qhov no nyob ntsiag to muaj txiaj ntsig nws koj tab tom tswj cov tshuab hluav taws xob, txij li txhua qhov hloov pauv muaj qhov tsis zoo rau lub sijhawm nyob.

Kauj ruam 4: PID Controller

PID maub los
PID maub los
PID tswj
PID tswj

Nov yog cov ncauj lus siab. Siv qhov kev tswj hwm no yog txoj haujlwm yooj yim, nrhiav qhov chaw teeb tsa kom raug yog ib zaj dab neeg sib txawv.

Txhawm rau siv PID maub los koj yuav tsum hloov initRelayHysteresisController (…..) rau initRelayPiDController (….) Thiab koj yuav tsum nrhiav qhov chaw raug rau nws. Raws li ib txwm koj yuav pom lawv hauv Config.h

Kuv tau siv qhov kev sim yooj yim hauv Java, yog li nws tuaj yeem pom qhov tshwm sim. Nws tuaj yeem pom nyob hauv daim nplaub tshev: pidsimulator. Below koj tuaj yeem pom simulation rau ob tus tswj PID a P. PID tsis ruaj khov vim kuv tsis tau siv ib qho txheej txheem ntse los nrhiav qhov raug.

Ntawm ob daim phiaj xav tau kub tau teev tseg rau 30 (xiav). Qhov ntsuas kub tam sim no qhia kab ntawv nyeem. Relay muaj ob lub xeev ON thiab OFF. Thaum nws tau ua kom sov poob los ntawm 1.5, thaum nws xiam oob qhab nws nce los ntawm 0.5.

Kauj Ruam 5: Xov Tsheb

Xov Tsheb
Xov Tsheb
Xov Tsheb
Xov Tsheb
Xov Tsheb
Xov Tsheb
Xov Tsheb
Xov Tsheb

Cov software sib txawv sib txawv yuav tsum sib tham nrog ib leeg, vam tias tsis yog ob txoj hauv kev;)

Piv txwv li:

  • cov lej txheeb cais yuav tsum paub thaum tshwj xeeb txuas mus thiab tawm,
  • nias lub pob yuav tsum hloov pauv cov ntsiab lus pom thiab nws tseem yuav tsum ncua kev pabcuam uas yuav haus ntau CPU mus, piv txwv li ntsuas kub los ntawm lub ntsuas cua,
  • tom qab qee lub sijhawm ntsuas kub yuav tsum tau rov ua dua tshiab,
  • thiab ntxiv rau….

Txhua tus qauv txuas nrog Xov Xwm Bus thiab tuaj yeem sau npe rau cov xwm txheej tshwj xeeb, thiab tuaj yeem tsim cov xwm txheej (thawj daim duab).

Ntawm daim duab thib ob peb tuaj yeem pom cov xwm txheej ntws los ntawm nias lub pob.

Qee lub Cheebtsam muaj qee yam haujlwm uas yuav tsum tau ua ua ntu zus. Peb tuaj yeem hu lawv txoj hauv kev sib xws los ntawm lub ntsiab lus, vim peb muaj Xov Xwm Bus nws tsuas yog tsim nyog los nthuav tawm qhov xwm txheej raug (daim duab thib peb)

Kauj Ruam 6: Liab

  • https://github.com/maciejmiklas/Thermostat
  • https://github.com/milesburton/Arduino-Temperature…
  • https://github.com/maciejmiklas/ArdLog.git

Pom zoo: