Cov txheej txheem:
- Kauj Ruam 1: Cov Cuab Yeej thiab Cov Khoom
- Kauj Ruam 2: Pub dawb UART hauv Raspbian Stretch lossis Buster
- Kauj Ruam 3: DIP Hloov Chaw rau RS485 HAT
- Kauj Ruam 4: Pib Node-RED
- Kauj Ruam 5: Kev Sib Txuas RS485 yooj yim
- Kauj Ruam 6: MODBUS - Kev teeb tsa 1
- Kauj Ruam 7: Modbus Configuration 2
- Kauj ruam 8: Modbus Test
Video: Node-RED: RS485 Raspberry Pi Tutorial: 8 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Cov dej ntws raws qhov pom kev siv cuab yeej Node-RED dhau los ua neeg nyiam ntau dua rau Raspberry Pi cov tsim tawm. Cov lus qhia no yuav qhia koj yuav siv peb li cas cais cais RS422 / RS485 Serial HAT hauv Node-Red kom yooj yim RS485 kev sib txuas lus thiab rau MODBUS daim ntawv thov ib yam nkaus.
Kauj Ruam 1: Cov Cuab Yeej thiab Cov Khoom
Cov ntaub ntawv:
- Raspberry Pi A+, B+, 2B, 3B lossis 4B
- RS422/RS485 lub kaus mom
- Daim npav SD
Software:
-
Raspbian Stretch lossis Buster (nrog lub desktop thiab
pom zoo software)
Kauj Ruam 2: Pub dawb UART hauv Raspbian Stretch lossis Buster
Txoj hauv kev yooj yim tshaj plaws yog siv cov cuab yeej raspi-config hloov UART mus rau GPIO14/15 tus pin. coj cov duab Raspbian tshiab
- sudo raspi-teeb tsa
- tau txais '5 Kev Xaiv Ua Haujlwm'
- tau txais 'P6 Serial'
- 'Koj puas xav kom lub plhaub nkag mus kom nkag mus tau ntau dua?' TSIS YOG
- 'Koj puas xav kom lub khoos phis tawj serial chaw nres nkoj kom qhib?' YOG
- Ua tiav raspi-config
- reboot Raspberry Pi
Tam sim no koj tuaj yeem nkag mus rau UART ntawm /dev /serial0
Kauj Ruam 3: DIP Hloov Chaw rau RS485 HAT
Peb RS422/RS485 HAT los nrog 3 DIP hloov tsev txhab nyiaj. Koj yuav tsum teeb cov DIP hloov no rau RS485 raws li qhia hauv daim duab saum toj no.
- Hloov 1: 1-OFF 2-ON 3-ON 4-OFF
- Hloov 2: 1-OFF 2-OFF 3-ON 4-ON
- Hloov 3: 1-OFF lossis ON* 2-OFF 3-OFF 4-OFF
*Nyob ntawm txoj haujlwm ntawm RS422/RS485 HAT hauv kab Modbus koj yuav tsum hloov qhov kev txiav tawm qhov kev tawm tsam ON lossis OFF. Thov hloov tus tiv thaiv mus rau ON txoj haujlwm tsuas yog HAT nyob ntawm ib kawg ntawm txoj kab npav. Hauv txhua qhov xwm txheej hloov pauv qhov kev tawm tsam tawm OFF
Kauj Ruam 4: Pib Node-RED
Pib Node-RED:
Node-RED yog ib feem ntawm Raspbian Stretch thiab Buster (nrog lub desktop thiab pom zoo software). Koj tuaj yeem siv lub node-liab hais kom ua Node-RED hauv lub davhlau ya nyob twg lossis ntawm lub desktop ntawm 'Programming' menu.
Qhib tus editor:
Thaum Node-RED tau ua haujlwm koj tuaj yeem nkag mus rau tus khoos phis tawj hauv browser. Yog tias koj siv browser ntawm Pi desktop, koj tuaj yeem qhib qhov chaw nyob: https:// localhost: 1880.
Kauj Ruam 5: Kev Sib Txuas RS485 yooj yim
Hauv qhov piv txwv no ntws Raspberry Pi yuav xa cov ntawv 'Nyob Zoo Ntiaj Teb' ntawm RS485 tom qab nias lub pob txhaj tshuaj. Cov dej ntws yuav tau txais cov hlua nkag (txiav tawm los ntawm / d) thiab qhia txoj hlua hauv qhov rais debugging ntawm sab xis.
Kev sib txuas lus yuav ua tiav los ntawm kev siv cov lej hauv thiab tawm ntawm cov node, uas tau teeb tsa ua ntej. Nws yog ib qho tseem ceeb heev los teeb tsa cov khoom ntawm Serial Port rau /dev /serial0 raws li hauv daim duab saum toj no.
Koj tuaj yeem ntsuas qhov ntws nrog lub PC txuas nrog (ntawm USB rau RS485 adapter) thiab cov phiaj xwm yooj yim.
Kauj Ruam 6: MODBUS - Kev teeb tsa 1
Hauv cov theem hauv qab no kuv xav qhia koj yuav ua li cas siv qhov yooj yim Modbus RTU kev sib txuas lus hauv Node-RED.
Ua ntej peb yuav tsum teeb tsa Modbus ntxiv node-red-contrib-modbus ntawm tus thawj tswj hwm palette lossis ntawm bash los ntawm kev nkag mus:
npm nruab node-red-contrib-modbus
Tam sim no koj tuaj yeem import qhov ntws.
Kauj Ruam 7: Modbus Configuration 2
Tom qab ntshuam cov dej ntws peb tuaj yeem saib hauv kev teeb tsa ntawm 'Modebus sau' thiab 'Modbus nyeem' nodes. Nws yog qhov tsis tseem ceeb los teeb tsa 'Server' cov cuab yeej rau dev/serial0 thiab teeb tsa nws raws li qhia hauv cov duab saum toj no.
Kauj ruam 8: Modbus Test
Rau qhov kev sim kuv tau txuas nrog Arduino nrog RS485 Shield li Modbus qhev (koj tuaj yeem tshawb xyuas qhov qhia no kom paub ntau ntxiv).
Modbus Nyeem ntawv yuav pov npav Chav 1 tag nrho 2s thiab nyeem 8 cov npe ntawm tus qhev. Koj tuaj yeem pom qhov tshwm sim hauv qhov xwm txheej ntawm Modbus Cov Lus Teb. Ntawm 2 lub tshuab txhaj tshuaj koj tuaj yeem teeb tus lej 6 ntawm tus qhev rau 0 lossis 255.
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
RS485 Ntawm Arduino thiab Raspberry Pi: 7 Kauj Ruam
RS485 Ntawm Arduino thiab Raspberry Pi: Rau tsev kawm ntawv kuv yuav tsum tau ua ib qhov haujlwm. Kuv xaiv los ua tus tswj tsev cog khoom ntse tswj tau los ntawm raspberry pi. Cov ntsuas yuav raug siv los ntawm arduino uno. Thaum lub hlis uas ua raws kuv yuav tshaj tawm qhov kev ua tiav ntawm txoj haujlwm no los ntawm
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
Arduino RS485 Din Rail Mount: 7 Kauj Ruam
Arduino RS485 Din Rail Mount: Cov lus qhia me me no yuav qhia koj yuav ua li cas txhawm rau txhim kho Arduino ua ke nrog daim thaiv RS485 hauv lub txee rau ntawm txoj kev tsheb nqaj hlau. Koj yuav tau txais lub cuab yeej zoo thiab cog lus kom paub MODBUS qhev, DMX cov cuab yeej, chav nkag qhov rooj thiab lwm yam. Cov lus qhia no tseem yuav pab tau
Mus txog 3 RS485 Busses ntawm Ib Arduino: 5 Kauj Ruam
Txog 3 RS485 Busses ntawm Ib Arduino: Hauv cov lus qhia no kuv yuav qhia yuav ua li cas txuas mus txog 3 kev ywj pheej RS485 tsheb npav mus rau ib qho Arduino. Qhov no tuaj yeem muaj txiaj ntsig yog tias koj xav tsim lub rooj vag ntawm cov npav no lossis yog tias koj xav tswj cov cuab yeej hauv cov npav no (tsis tas yuav txuas lub npav