Cov txheej txheem:

Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Scraps ntawm Nodemcu - Ntu 2 - Software: 5 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Scraps ntawm Nodemcu - Ntu 2 - Software: 5 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Scraps ntawm Nodemcu - Ntu 2 - Software: 5 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Scraps ntawm Nodemcu - Ntu 2 - Software: 5 Cov Kauj Ruam (nrog Duab)
Video: yuav tau tsim kho tus kheej lub neej thiaj yuav vam meej tau 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Ntawv Pov Thawj ntawm Nodemcu - Ntu 2 - Software
Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Ntawv Pov Thawj ntawm Nodemcu - Ntu 2 - Software
Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Ntawv Pov Thawj ntawm Nodemcu - Ntu 2 - Software
Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Ntawv Pov Thawj ntawm Nodemcu - Ntu 2 - Software

Taw qhia

Nov yog qhov txuas ntxiv rau thawj kab lus "Yuav Ua Li Cas Tsim Koj Tus Kheej Anemometer Siv Reed Switches, Hall Effect Sensor thiab Qee Cov Ntawv Pov Tseg ntawm Nodemcu - Ntu 1 - Kho vajtse" - qhov twg kuv qhia yuav ua li cas kom sib dhos cua nrawm thiab ntsuas cov cuab yeej ntsuas. Ntawm no peb yuav siv kev ntsuas ntsuas software tsim rau siv hauv Nodemcu siv Arduino IDE.

Nqe lus piav qhia

Hauv kab ntawv dhau los, cov cuab yeej siv riam phom thiab txuas nrog Nodemcu tuaj yeem ntsuas qhov nrawm thiab kev qhia ntawm cua. Kev tswj software tau tsim los nyeem kev sib hloov ntawm lub ntsuas cua hauv lub sijhawm rau ib lub sijhawm, suav qhov nrawm nrawm, nyeem cov lus qhia uas lub vane yog, qhia cov txiaj ntsig hauv OLED, tshaj tawm cov txiaj ntsig hauv ThingSpeak thiab pw li 15 feeb kom txog thaum. kev ntsuas tom ntej

Kev tsis lees paub: Lub ntsuas cua sov no yuav tsum tsis txhob siv rau lub hom phiaj tshaj lij. Nws tsuas yog siv rau kev kawm lossis siv hauv tsev.

Nco tseg: Lus Askiv tsis yog kuv hom lus ib txwm muaj. Yog tias koj pom cov ntawv sau yuam kev uas ua rau koj tsis nkag siab txog txoj haujlwm, thov qhia rau kuv paub kho lawv. Ua tsaug ntau

Kauj Ruam 1: Txhim Kho Arduino IDE, ESP8266 Boards thiab Libraries thiab Koj Cov LusSpeak Account

Txhim kho Arduino IDE, ESP8266 Boards thiab Libraries thiab Koj Cov LusSpeak Account
Txhim kho Arduino IDE, ESP8266 Boards thiab Libraries thiab Koj Cov LusSpeak Account
Txhim kho Arduino IDE, ESP8266 Boards thiab Libraries thiab Koj Cov LusSpeak Account
Txhim kho Arduino IDE, ESP8266 Boards thiab Libraries thiab Koj Cov LusSpeak Account

Txhim kho Arduino IDE thiab Nodemcu

Yog tias koj tsis tau teeb tsa IDE Arduino thov nyeem cov ntawv qhia hauv qhov txuas - Yuav ua li cas rau nruab Arduino IDE - qhov twg koj tuaj yeem pom cov lus qhia ua tiav.

Cov kauj ruam tom ntej, txhawm rau teeb tsa Nodemcu pawg thawj coj siv cov lus qhia no los ntawm Magesh Jayakumar Cov Lus Qhia uas ua tiav heev. Yuav ua li cas rau nruab Nodemcu tsis muaj Arduino IDE

Txhim Kho Tsev Qiv Ntawv

Cov kauj ruam tom ntej koj yuav tsum teeb tsa cov tsev qiv ntawv uas kos duab siv. Lawv muaj ntau thiab koj tuaj yeem ua raws cov theem hauv qab no.

ThingSpeak Library -

ESP8266 Lub Tsev Qiv Ntawv -

Tsim Ib Tus Neeg Siv Nyiaj Txiag

Txhawm rau siv ThingSpeak (https://thingspeak.com/) koj yuav tsum tsim ib tus as khauj (nws tseem dawb rau qee qhov kev sib cuam tshuam) uas koj tuaj yeem txuag cov ntaub ntawv ntsuas hauv koj lub ntsuas cua thiab saib xyuas cua cua hauv koj lub tsev, txawm tias ntawm xov tooj ntawm tes. Los ntawm kev siv ThingSpeak, koj tuaj yeem muab cov pej xeem nkag mus rau koj cov ntaub ntawv khaws tseg rau leej twg uas txaus siab. Qhov ntawd yog qhov txiaj ntsig zoo ntawm ThingSpeak. Nkag mus rau qhov homepage thiab ua raws cov kauj ruam los tsim koj tus account.

Thaum tus as khauj raug tsim, nkag mus rau qhov kev qhia no - ThingSpeak Pib Pib - los tsim koj cov channel. Nws zoo nkauj piav qhia. Hauv kev xaus, koj yuav tsum tsim cov channel uas cov ntaub ntawv yuav raug khaws cia. Cov channel no muaj tus lej ID thiab Key API uas yuav tsum tau hais hauv daim duab qhia txhua lub sijhawm koj xav sau cov ntaub ntawv. ThingSpeak yuav khaws tag nrho cov ntaub ntawv hauv txhab nyiaj thiab yuav qhia lawv txhua lub sijhawm koj nkag mus rau koj tus as khauj, raws li koj tau teeb tsa.

Kauj ruam 2: Tshawb nrhiav Sketch

Tshawb nrhiav Sketch
Tshawb nrhiav Sketch
Tshawb nrhiav Sketch
Tshawb nrhiav Sketch

Daim phiaj

Hauv daim duab, koj tuaj yeem nkag siab cov duab kos fluxogram. Thaum koj sawv (txuas) Nodemcu, nws yuav txuas rau koj li Wi-nkaus network, nws qhov ntsuas koj tau teeb tsa thiab pib suav 1 feeb ntawm lub sijhawm los ntsuas qhov ntsuas. Ua ntej, nws yuav suav qhov ntsuas qhov ntsuas qhov ntsuas cua nyob rau 25 vib nas this, suav linear velocity thiab nyeem cov lus qhia ntawm cua. Cov txiaj ntsig tau qhia ntawm OLED. Ua tib cov kauj ruam ntxiv thiab rau qhov nyeem ntawv thib ob no, nws yuav xa mus rau ThingSpeak.

Tom qab ntawd Nodemcu tsaug zog 15 feeb kom txuag lub roj teeb. Raws li kuv tab tom siv lub hnub ci vaj huam sib luag me me nws yog ib qho tseem ceeb uas kuv yuav tsum ua. Yog tias koj siv 5V qhov chaw koj tuaj yeem hloov kho qhov program kom nws tsis tsaug zog thiab ntsuas ntsuas cov ntaub ntawv.

Cov qauv ntawm cov haujlwm

Hauv daim duab, koj tuaj yeem pom tus qauv ntawm daim duab.

Anemometer_Instructables

Nws yog qhov haujlwm tseem ceeb uas thauj cov tsev qiv ntawv, pib hloov pauv, tswj kev cuam tshuam cuam tshuam, hu tag nrho cov haujlwm, suav nrog cua nrawm, txiav txim siab nws cov lus qhia thiab tso nws tsaug zog.

kev sib txuas lus

Txuas lub WiFi thiab xa cov ntaub ntawv mus rau ThingSpeak.

daim ntawv pov thawj.h

Cov yuam sij ntawm koj lub network WiFi thiab tus cim ntawm koj tus lej hauv ThingSpeak. Nov yog qhov uas koj yuav hloov koj tus lej ID thiab APIs.

txhais.h

Nws suav nrog txhua qhov kev hloov pauv ntawm txoj haujlwm. Nov yog qhov uas koj tuaj yeem hloov sijhawm nyeem ntawv lossis ntev npaum li cas nodemcu yuav tsum tau pw.

kev ua haujlwm

Nws muaj cov haujlwm ua ke los ntsuas qhov ntsuas thiab nyeem cov lej sib txuam nrog rau kev ua haujlwm los nyeem cov kev sib hloov ntawm lub ntsuas cua.

oledDisplay

Qhia tawm ntawm qhov ntsuas ntawm cua nrawm thiab kev taw qhia.

Kauj Ruam 3: Cov Lus Qhia Txog…

Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…
Cov Lus Qhia Txog…

Txuas cuam tshuam

Kev sib hloov ntawm lub ntsuas cua ntsuas yog ntsuas los ntawm kev ua haujlwm txuas cuam tshuam () (thiab tshem tawm cuam tshuam ()) hauv GPIO 12 (tus pin D6) ntawm Nodemcu (Nws muaj kev cuam tshuam cuam tshuam ntawm nws D0-D8 pins).

Kev cuam tshuam yog cov xwm txheej lossis cov xwm txheej uas ua rau lub microcontroller nres qhov kev ua tiav ntawm txoj haujlwm uas nws tau ua, ua haujlwm lwm txoj haujlwm ib ntus thiab rov qab los rau thawj txoj haujlwm.

Koj tuaj yeem nyeem cov ncauj lus kom ntxaws ntawm txoj haujlwm hauv qhov txuas rau kev qhia ntawm Arduino. Saib attachInterrupt ().

Syntax: attachInterrupt (tus pin, hu rov qab, cuam tshuam hom/hom);

pin = D6

kev ua haujlwm rov qab = rpm_anemometer - suav txhua qhov mem tes ntawm qhov sib txawv.

cuam tshuam hom/hom = RISING - cuam tshuam thaum tus pin nce ntawm qis mus rau siab.

Ntawm txhua qhov mem tes tsim los ntawm cov hlau nplaum hauv Hall sensor, tus pin nce ntawm qis mus rau siab thiab suav ua haujlwm tau qhib thiab suav cov mem tes hauv qhov sib txawv, thaum 25 vib nas this tsim. Thaum lub sijhawm tau tas sijhawm, lub txee raug txiav tawm (tshem tawm cuam tshuam ()) thiab niaj hnub suav qhov nrawm thaum txiav tawm.

Xam Cov Cua Ceev

Thaum nws tau txiav txim siab ntau npaum li cas kev hloov pauv lub ntsuas cua ntsuas hauv 25 vib nas this, peb suav qhov nrawm.

  • RADIO yog ntsuas los ntawm qhov chaw nruab nrab ntawm lub ntsuas cua sov mus rau qhov kawg ntawm pob ping pong. Koj yuav tsum tau ntsuas koj li zoo heev - (saib hauv daim duab uas hais tias 10 cm).
  • RPS (tig ib pliag) = tig / 25 vib nas this
  • RPM (tig ib feeb) = RPS * 60
  • OMEGA (nrawm nrawm - radians ib ob) = 2 * PI * RPS
  • Tawm_Velocity (meters ib ob) = OMEGA * RADIO
  • Tawm_Velocity_kmh (Km ib teev) = 3.6 * Linear_Velocity thiab qhov no yog qhov yuav xa mus rau ThingSpeak.

Nyeem cua txoj kev taw qhia

Txhawm rau nyeem txoj haujlwm ntawm lub cua vane txhawm rau txiav txim siab cov lus qhia ntawm cua qhov kev zov me nyuam xa cov cim qis thiab siab mus rau tus lej sib txuam nrog txhua qhov sib txuas ua ke ntawm qhov ntsuas A, B, C (muxABC matrix) thiab tos kom tau txais ntawm tus pin A0 qhov tshwm sim uas tuaj yeem yog qhov hluav taws xob nruab nrab ntawm 0 thiab 3.3V. Kev sib txuas ua ke tau qhia hauv daim duab.

Piv txwv li, thaum C = 0 (qis), B = 0 (qis), A = 0 (qis) tus lej sib npaug muab nws cov ntaub ntawv ntawm tus pin 0 thiab xa cov teeb liab mus rau A0 uas tau nyeem los ntawm Nodemcu; yog C = 0 (qis), B = 0 (qis), A = 1 (siab) tus lej sib npaug yuav xa koj cov ntaub ntawv ntawm tus pin 1 thiab ntxiv rau, kom txog thaum nyeem ntawm 8 raws tiav.

Raws li lub teeb liab yog analog, qhov program hloov pauv mus rau digital (0 lossis 1), yog tias qhov hluav taws xob tsawg dua lossis sib npaug rau 1.3V lub teeb liab yog 0; yog tias nws ntau dua 1.3V lub teeb liab yog 1. Tus nqi 1.3V yog kev xav thiab rau kuv, nws ua haujlwm tau zoo heev. Muaj ib txwm me me ntawm qhov tam sim no thiab qhov no tiv thaiv tias tsis muaj qhov tsis raug qhov tseeb.

Cov ntaub ntawv no tau muab khaws cia rau hauv tus lej vector [8] uas yuav muab piv nrog qhov chaw nyob raws li lub koob. Saib cov lej hauv daim duab. Piv txwv li, yog tias qhov vector tau txais yog [0, 0, 1, 0, 0, 0, 0, 0, 0, 0] nws qhia hauv matrix cov lus qhia E thiab sib haum rau lub kaum sab xis ntawm 90 degrees; yog [0, 0, 0, 0, 0, 0, 1, 1] qhia hauv matrix WNW qhov chaw nyob thiab sib haum rau lub kaum sab xis ntawm 292.5 degrees. N sib haum rau [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] thiab lub kaum sab xis 0 degrees.

Dab tsi yuav xa mus rau ThingSpeak yog nyob ntawm lub kaum sab xis vim nws tsuas lees txais tus lej.

Kauj ruam 4: Kev sib txuas lus

Kev sib txuas lus
Kev sib txuas lus
Kev sib txuas lus
Kev sib txuas lus

Yuav xa cov ntaub ntawv mus rau ThingSpeak li cas

Muaj nuj nqi yam khoom siv hais lus () yog lub luag haujlwm xa cov ntaub ntawv.

ThingSpeak.setField (1, ntab (linear_velocity_kmh)) - Xa cov ntaub ntawv tshaj tawm mus rau teb 1 ntawm kuv cov channel

ThingSpeak.setField (2, ntab (cua_Direction_Angle)) - Xa cov ntaub ntawv chaw nyob mus rau teb 2 ntawm kuv cov channel

ThingSpeak.writeFields (myChannelNumber, myWriteAPIKey) - Xa rau kuv channel myChannelNumber, nrog sau myWriteAPIKey API qhia los ntawm TS. Cov ntaub ntawv no tau tsim los ntawm TS thaum tsim koj tus account thiab channel.

Hauv cov duab saum toj no koj tuaj yeem pom li cas ThingSpeak qhia cov ntaub ntawv tau txais.

Hauv qhov txuas no koj tuaj yeem nkag mus rau cov ntaub ntawv ntawm kuv qhov haujlwm hauv pej xeem channel ntawm ThingSpeak.

Kauj ruam 5: Main Variables

cua vane tsis

  • MUX_A D5 - mux pi A rau Nodemcu tus pin D5
  • MUX_B D4 - mux pin B rau Nodemcu tus pin D4
  • MUX_C D3 - mux pin C rau Nodemcu tus pin D3
  • READPIN 0 - Analog input ntawm NodeMcu = A0
  • NO_PINS 8 - tus naj npawb ntawm mux pins
  • val [NO_PINS] - chaw nres nkoj 0 txog 7 ntawm mux
  • cua_Direction_Angle - Lub kaum sab xis ntawm cua qhia
  • String windRose [16] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"} - cardenals, collaterals thiab sub -collaterals
  • windAng [16] = {0, 22.5, 45, 67.5, 90, 112.5, 135, 157.5, 180, 202.5, 225, 225, 247.5, 270, 292.5, 315, 337.5} - kaum ntawm txhua qhov kev coj
  • Tus lej [16] [NO_PINS] - Cov lus qhia Matrix
  • muxABC [8] [3] - ABC mux ua ke

anemometer tsis

  • rpmcount - suav pes tsawg qhov kev hloov pauv tau ua tus ntsuas qhov ntsuas hauv lub sijhawm faib
  • timemeasure = 25.00 - ntsuas lub sijhawm nyob hauv vib nas this
  • timetoSleep = 1 - Nodemcu tsaug zog lub sijhawm hauv feeb
  • sleepTime = 15 - lub sijhawm kom tsaug zog hauv feeb
  • rpm, rps - kev hloov pauv ntau zaus (tig ib feeb, tig ib pliag)
  • vojvoog - meters - ntsuas ntawm qhov ntev ntawm lub tshuab ntsuas cua
  • linear_velocity - kab tawm nrawm hauv m/seg
  • linear_velocity_kmh - kab tawm nrawm hauv km/h
  • omega - radial tshaj tawm hauv rad/seg

Hauv qab no koj tuaj yeem pom daim duab tiav. Tsim daim nplaub tshev tshiab ntawm Arduino nplaub tshev ntawm koj lub khoos phis tawj nrog tib lub npe ua haujlwm tseem ceeb (Anemometer_Instructables) thiab muab lawv tso ua ke.

Nkag mus rau cov ntaub ntawv ntawm koj lub network wifi thiab ThingSpeak ID thiab API Tus Sau Tus Kheej hauv ntu Credentials.h thiab khaws tseg. Upload rau Nodemcu thiab qhov ntawd yog txhua yam.

Txhawm rau sim ua haujlwm ntawm lub kaw lus kuv pom zoo kom kiv cua tig tau zoo.

Txhawm rau nkag mus rau cov ntaub ntawv los ntawm lub xov tooj ntawm tes, rub tawm daim ntawv thov rau IOS lossis Android hu ua ThingView, uas, hmoov zoo, tseem tsis tau pub dawb.

Kho koj tus lej chaw thiab koj yuav npaj pom koj cov cua hauv tsev tsis hais koj nyob qhov twg.

Yog tias koj muaj kev txaus siab, nkag mus rau Kuv Lub NpeSpeak Channel ID channel: 438851, uas yog pej xeem thiab nyob ntawd koj yuav pom cua thiab ntsuas kev ntsuas hauv kuv lub tsev.

Kuv yeej vam tias koj muaj kev lom zem.

Yog tias koj muaj lus nug tsis txhob yig tau hu rau kuv.

Hais txog

Pom zoo: