Cov txheej txheem:

ESP32 Capacitive Touch Input Siv "Metallic Hole Plugs" rau Khawm: 5 Cov Kauj Ruam (nrog Duab)
ESP32 Capacitive Touch Input Siv "Metallic Hole Plugs" rau Khawm: 5 Cov Kauj Ruam (nrog Duab)
Anonim
Image
Image
Kho vajtse
Kho vajtse

Raws li kuv tab tom txiav txim siab tsim qauv rau qhov yuav los tom ntej ESP32 WiFi Kit 32 raws txoj haujlwm xav tau peb lub pob nkag, ib qho teeb meem pom tau yog tias WiFi Cov Khoom 32 tsis muaj ib lub tshuab thawb khawm, tseem nyob ib leeg peb lub tshuab khawm, rau kev nkag mus. Txawm li cas los xij, Cov Khoom Siv WiFi 32 muaj ntau lub peev xwm kov tau zoo, yog li kuv tau siv qee lub sijhawm los kho cov cuab yeej, sau software thiab ntsuas peb lub khawm tsim qauv siv ESP32 lub peev xwm kov lub ntsej muag thiab peb 3/8 "" nws yog xim hlau qhov ntsaws "rau khawm.

Raws li ib tus neeg twg uas tau sim nrog ESP32 lub peev xwm kov tau cov tswv yim tau pom, qhov kev nkag mus kov yeej muaj suab nrov txaus kom xav tau kev lim dej kom ntseeg tau tias muaj kev nkag tau zoo. Txhawm rau txo qhov suav tag nrho rau qhov phiaj xwm yuav los tom ntej, Kuv txiav txim siab tias ib qho yooj yim cuam tshuam uas tau tsav cov lim (ntau qhov "debounce" ntau dua li lub lim, tab sis kuv digress), tsis zoo li ntxiv cov lim sab nraud, tuaj yeem ntsiag to cov suab nrov nrov. Thiab tom qab kev sim, nws tau pom tseeb tias ESP32 lub peev xwm nkag tau, peb 3/8 "lub qhov hlau qhov ntsaws, thiab qee qhov digital" filtering "software, tiag tiag yuav muab peb lub khawm nkag tau rau kev tsim qauv.

Yog li yog tias koj txaus siab los sim ntsuas cov peev txheej nrog cov lim dej ntawm ESP32, Kuv tau suav nrog qhov chaws "Buttons.ino" hauv Arduino ib puag ncig hom ntawv nrog rau kev sib dhos thiab kev qhia ua haujlwm, ntxiv rau kev piav qhia luv luv ntawm qhov chaws, rau qhov kuv pom los ua qhov ntseeg tau zoo peb khawm nkag.

Thiab raws li ib txwm, Kuv zaum tsis nco cov ntaub ntawv lossis ob lossis leej twg paub dab tsi ntxiv, yog li yog tias koj muaj lus nug, thov tsis txhob ua siab deb nug ib yam li kuv ua yuam kev ntau.

Thiab ib daim ntawv kawg, Kuv tsis tau txais nyiaj them rau txhua daim ntawv, suav nrog tab sis tsis txwv rau kev kuaj dawb, rau ib qho ntawm cov khoom siv hauv qhov tsim no

Kauj ruam 1: Kho vajtse

Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse

Kev tsim qauv siv cov cuab yeej hauv qab no:

  • Ib, WiFi Kit 32.
  • Peb, 3/8 "nws yog xim hlau qhov ntsaws.
  • Peb, 4 "qhov ntev ntawm 28awg xaim.

Txhawm rau sib dhos cov cuab yeej, Kuv tau ua cov theem hauv qab no:

  • Tshem tawm thiab kaw qhov kawg ntawm txhua 4 "xaim ntev raws li qhia.
  • Soldered thawj xaim rau tus pin 13 ntawm ESP32 (TOUCH4, lossis "T4", cov tswv yim).
  • Soldered tus xov tooj thib ob rau tus pin 12 ntawm ESP32 (TOUCH5, lossis "T5", cov tswv yim).
  • Soldered tus xov tooj thib peb rau tus pin 14 ntawm ESP32 (TOUCH6, lossis "T6" cov tswv yim).
  • Soldered ib ntawm txhua ntawm peb 3/8 "qhov hlau qhov ntsaws rau qhov xaus dawb ntawm peb txoj kab ntev.

Kauj ruam 2: Software

Software
Software

Cov ntaub ntawv "Buttons.ino" yog Arduino ib puag ncig cov ntaub ntawv uas muaj software rau tsim. Ntxiv rau cov ntawv no, koj yuav xav tau "U8g2lib" lub tsev qiv ntawv duab rau WiFi Kit32 OLED zaub (saib https://github.com/olikraus/u8g2/wiki rau cov ntaub ntawv ntxiv ntawm lub tsev qiv ntawv no).

Nrog U8g2lib cov tsev qiv ntawv duab teeb tsa hauv koj phau ntawv teev npe Arduino, thiab "Buttons.ino" ntsaws rau hauv Arduino ib puag ncig, suav sau thiab rub tawm lub software rau hauv ESP32.

Thaum rub tawm thiab ua haujlwm, kab saum toj kawg nkaus ntawm cov zaub yuav tsum nyeem "Nyees khawm" nrog kab thib ob ntawm cov zaub nyeem "1 2 3" raws li lub cim ntsuas. Hauv qab ntawm txhua qhov ntawm 1, 2, 3 cov cim ntsuas yog qhov tsis tau txheeb xyuas qhov nyeem tau qhov tseem ceeb, thiab hauv qab txhua qhov ntawm no yog lub khawm nias ntsuas ("1" rau nias, "0" rau tsis nias). Raws li tuaj yeem pom hauv daim vis dis aus (thiab ntev li tau kuaj pom tseeb), lub lim dej software muab lub pob khawm nkag tau kom ntseeg tau pom uas tsis muaj qhov ua tsis raug.

Kauj ruam 3: Txog Software

Lub software muaj peb ntu ntu ntu tseem ceeb; Arduino xav tau "teeb tsa ()" thiab "voj ()" ntu, thiab ntu "cuam tshuam". Kev teeb tsa () ntu muaj cov cai tsim nyog los pib OLED thiab cuam tshuam cov kev pabcuam. OLED teeb tsa kev ua haujlwm tau piav qhia hauv qhov txuas saum toj no. Kev cuam tshuam teeb tsa cov kev pabcuam teeb tsa muaj raws li hauv qab no:

  • "timerLoopSemaphore = xSemaphoreCreateBinary ()" tsim semaphore rau "InterruptService ()" (cuam tshuam kev pabcuam niaj hnub) los qhia lub voj () thaum nws txog sijhawm los ua lub voj hla.
  • "timerInterruptService = timerBegin (0, 80, muaj tseeb)" tsim lub sijhawm siv cov khoom siv kho vajtse timer 0 nrog lub sijhawm ua ntej ntawm 80.
  • "timerAttachInterrupt (timerInterruptService, & InterruptService, muaj tseeb)" txuas InterruptService () rau lub timer.
  • "timerAlarmWrite (timerInterruptService, 1000, qhov tseeb)" teeb tsa qhov kev pabcuam cuam tshuam rau 1000hz.
  • "timerAlarmEnable (timerInterruptService)" pib lub tswb timer, thiab yog li cuam tshuam kev pabcuam.

Nrog teeb tsa ua tiav, lub voj () tau nkag mus thiab nres tam sim ntawm kab:

yog (xSemaphoreTake (timerLoopSemaphore, portMAX_DELAY) == pdTRUE), lub ntsiab lus voj () yuav tos ntawm qhov no kom txog thaum semaphore los ntawm InterruptService () tuaj txog. Thaum lub semaphore tuaj txog, lub voj () code ua tiav, hloov kho OLED zaub nrog cov ntaub ntawv khawm, tom qab ntawd rov qab mus rau sab saum toj kom rov tos ib semaphore tom ntej. Nrog InterruptService () khiav ntawm 1000hz thiab LOOP_DELAY tus nqi ntawm 30, lub voj () ua txhua txhua 30ms, lossis ntawm qhov ntsuas hloov tshiab ntawm 33.333hz. Thaum qhov no yog qhov rov ua dua tshiab ntau dua li qhov xav tau rau feem ntau ESP32 daim ntawv thov, Kuv siv qhov teeb tsa no los qhia txog kev ua haujlwm ntawm lub lim. Kuv tau sim thiab txiav txim siab lub sijhawm xav tau los ua ib lub voj () dhau los ua 20ms.

Kev cuam tshuam kev pabcuam () raug hu los ntawm lub sijhawm uas tau tsim hauv kev teeb tsa () ntawm tus nqi ntawm 1000hz. Thaum raug hu, nws hloov kho ob qho kev suav, nLoopDelay thiab nButtonDelay. Thaum nLoopDelay raug suav suav mus rau xoom, nws xa cov semaphore tso cai rau lub voj () kom ua tiav ib qho dhau los ces rov pib dua nLoopDelay. Thaum nButtonDelay tau suav nrog suav mus rau xoom, nws ib yam nkaus yog rov pib dua ces khawm "lim" ua haujlwm.

Txhua lub pob lim muaj lub cim lim tshwj xeeb (piv txwv li nButton1Count, nButton2Count thiab nButton3Count). Tsuav yog qhov kov cov txiaj ntsig tau muab rau lub khawm ntau dua lossis sib npaug rau tus nqi pib txhais (BUTTON_THRESHHOLD), lub lim lim tau muab rau lub pob thiab lub pob tseem nyob xoom. Yog tias qhov kov cov txiaj ntsig tau muab rau lub khawm tsawg dua qhov tau teev tseg, lub lim lim tau muab rau lub khawm tau nce ntxiv los ntawm ib qho txhua 20ms. Thaum lub lim lim tau tshaj lub pob lim tus nqi (BUTTON_FILTER), lub pob tau txiav txim siab "nias". Cov txiaj ntsig ntawm txoj hauv kev no yog los tsim lub lim uas xav tau 80ms (20ms nButtonDelay * 4ms nButtonCountN qhov twg N yog tus lej khawm) ntawm qhov txuas tas mus li nkag qhov tseem ceeb hauv qab qhov kev txiav txim siab los txiav txim siab khawm tau nias tiag. Txhua lub sijhawm tsawg dua 80ms yog suav tias yog "qhov tsis sib xws" thiab raug tsis lees paub los ntawm lub lim.

Muab cov lus piav qhia luv luv no, yog tias koj muaj lus nug, thov hu rau kuv thiab kuv yuav ua qhov zoo tshaj los teb lawv.

Vam tias koj nyiam nws!

Kauj Ruam 4: "Qhov project yuav los tom ntej"

Cov
Cov

Txoj haujlwm yuav los tom ntej no, "Intelligrill® Pro", yog qhov ntsuas kub ntsuas ob lub ntsuas pa luam yeeb suav nrog:

  • Steinhart-Hart ntsuas qhov ntsuas kub (tsis zoo li "saib" cov ntxhuav) kom nce qhov tseeb.
  • Lub sijhawm kwv yees kom ua tiav ntawm kev sojntsuam 1 suav nrog qhov tseeb nce los ntawm Steinhart-Hart kev suav.
  • Ib qho kev sojntsuam thib ob, sojntsuam 2, txhawm rau saib xyuas cov pa luam yeeb kub (txwv rau 32 txog 399 degrees).
  • Capacitive kov cov tswv yim tswj hwm (zoo li hauv Cov Lus Qhia no).
  • WIFI raws kev saib xyuas tej thaj chaw deb (nrog tus IP chaw nyob ruaj khov, ua rau saib xyuas cov neeg haus luam yeeb tau zoo los ntawm txhua qhov chaw muaj internet txuas).
  • Kev ntsuas kub ntau ntxiv (ntxiv 32 txog 399 degrees).
  • Kev hnov suab tiav ceeb toom ob qho tib si nyob rau hauv Intelligrill® tus xa xov thiab ntawm feem ntau WiFi muaj peev xwm saib xyuas cov cuab yeej.
  • Kev ntsuas kub hauv ob qho F lossis degrees C.
  • Sijhawm hom nyob hauv HH: MM: SS lossis HH: MM.
  • Cov roj teeb tso tawm hauv ob qho volts lossis % them.
  • Thiab los sai sai, PID tso tawm rau auger raws li cov neeg haus luam yeeb.

"Intelligrill® Pro" tab tom sim los ua qhov raug tshaj plaws, muaj cov ntim thiab txhim khu kev qha HTML raws li Intelligrill® Kuv tau tsim.

Nws tseem tab tom sim, tab sis nrog cov pluas noj nws tau pab npaj thaum sim, Kuv tau nce ntau dua li ob peb phaus.

Ib zaug ntxiv, Kuv vam tias koj txaus siab rau nws!

Kauj Ruam 5: Tom ntej Tom ntej: ESP32 NTP Kev Ntsuas Kub Kev Ntsuas Analog Nrog Steinhart-Hart Kho

Npaj kom plua av tawm ntawm koj phau ntawv algebra rau qhov no.

Pom zoo: