Cov txheej txheem:

Taw qhia rau Programming Raspberry Pi Tsis Siv Coding: 3 Kauj Ruam
Taw qhia rau Programming Raspberry Pi Tsis Siv Coding: 3 Kauj Ruam

Video: Taw qhia rau Programming Raspberry Pi Tsis Siv Coding: 3 Kauj Ruam

Video: Taw qhia rau Programming Raspberry Pi Tsis Siv Coding: 3 Kauj Ruam
Video: Начало → Изучайте английский → Освойте ВСЕ ОСНОВЫ АНГЛИЙСКОГО ЯЗЫКА, которые вам НУЖНО знать! 2024, Hlis ntuj nqeg
Anonim
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding
Taw qhia rau Programming Raspberry Pi Tsis Muaj Coding

Nyob zoo, cov lus qhia no yuav qhia koj yuav ua li cas tig koj lub Raspberry Pi mus rau hauv lub cuab yeej siv lub tshuab ua haujlwm tau zoo tshaj nrog cov lus qhia ua lub ntsej muag rau PLCs hu ua Function Block Diagram (ib feem ntawm IEC 61131-3 tus qauv). Qhov no tuaj yeem ua tiav los ntawm kev teeb tsa REXYGEN. REXYGEN cov cuab yeej software tau siv dav hauv ntau yam kev siv tshuab, kev tswj cov txheej txheem thiab cov neeg hlau.

Lub hom phiaj ntawm qhov kev taw qhia no yog los pab Raspberry Pi cov neeg siv kom kov yeej kev hloov pauv ntawm tes coding (nab nab,…) mus rau cov phiaj xwm duab siv lub npe hu ua block thiab ua kom pib siv REXYGEN software cuab yeej.

Kev qhia yuav qhia koj txog REXYGEN kev teeb tsa (ob qho cuab yeej txhim kho thiab lub sijhawm ua haujlwm tseem ceeb rau Raspberry Pi) thiab piv txwv yooj yim heev ntawm kev koom ua ke DS18B20 ua qhov ntsuas cua sov yooj yim yam tsis muaj txhais tes.

Khoom siv

  • Raspberry Pi (B+/2/3/3B+/Zero W)
  • SD daim npav nrog Raspbian kawg raws li koj xaiv (https://www.raspberrypi.org/downloads/raspbian/)

Kauj ruam 1: REXYGEN Installation

Kev Txhim Kho Cov Cuab Yeej Txhim Kho ntawm Windows 7/8/10:

  1. Rub tus installer los ntawm:
  2. Khiav cov ntawv.exe thiab ua raws li phau ntawv qhia kev teeb tsa. Qhov kev xaiv nruab tag nrho tau pom zoo.

Runtime Installation ntawm Raspberry Pi:

Koj Raspberry Pi tab tom khiav tshiab & tshiab Raspbian raws li koj xaiv - yog tias tsis pom https://www.raspberrypi.org/downloads/raspbian/ rau duab rub tawm thiab Raspbian Installation qhia.

Ntawm koj tus Raspberry Pi, hloov kho APT kev teeb tsa pob ntim cia:

sudo apt hloov tshiab

Tom qab ntawd teeb tsa GIT:

sudo apt nruab git

Mus rau koj phau ntawv teev npe hauv tsev:

ua cd

Rub tawm qhov hloov kho tshiab kawg ntawm kev teeb tsa kab ntawv:

git clone https://github.com/rexcontrols/rex-install-rpi.git --branch v2.50

Hloov cov npe ua haujlwm:

cd rex-install-rpi

Khiav cov ntawv teeb tsa rau Raspberry Pi:

sudo bash nruab-rex.sh

Zoo kawg! REXYGEN twb tau ua haujlwm ntawm koj li Raspberry Pi. Tias koj tsis pom nws? Tsis txhob txhawj!

Txoj cai tom qab kev teeb tsa RexCore runtime module tau pib txiav hauv keeb kwm yav dhau los raws li daemon. RexCore kuj tseem pib ua haujlwm thaum pib (rov) pib.

DEMO dawb version txwv rau 2 teev runtime. Tom qab txhua qhov rov pib dua, koj muaj sijhawm ntxiv 2 teev rau koj qhov kev sim. Koj tuaj yeem yuav daim ntawv tso cai tas mus li pib ntawm 45 € rau ib lub cuab yeej.

Kauj Ruam 2: Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim

Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim
Thawj Qhov Haujlwm - Raspberry Pi Raws Li Qhov Kub Kub Yooj Yim

Cia peb tsim lub ntsuas sov

Hauv qhov piv txwv no Raspberry Pi tau teeb tsa los ua qhov ntsuas sov yooj yim. Qhov ntsuas kub yog ntsuas los ntawm 1-Wire DS18B20 lub ntsuas pa thiab GPIO tus pin 17 hloov tus xa tawm thiab tawm nrog hysteresis ntawm 0.5 ° C.

Nco ntsoov txuas DS18B20 qhov ntsuas kub thiab 5V xa tawm raws li daim duab kab thaiv. Tsis txhob hnov qab siv 4k7 resistor ntawm DATA thiab VCC pins ntawm DS18B20.

Thaum cov hlua tau npaj tiav khiav REXYGEN Studio program. Xaiv Pib los ntawm Qhov Piv Txwv Qhov project thiab xaiv 0120-22 piv txwv Thermostat Yooj Yim. Xaiv ib daim nplaub tshev los khaws cov phiaj xwm phiaj xwm hauv (piv txwv li D: / FirstProject).

Txhua txoj haujlwm thaiv tuaj yeem teeb tsa los ntawm ob-nias rau nws. Tsis paub dab tsi tshwj xeeb muaj nuj nqi thaiv ua? Xaiv nws thiab ntaus F1 rau cov ntaub ntawv tam sim.

Tsuas muaj ib yam uas yuav tsum tau teeb tsa - DS18B20 64 -ntsis ROM ID txhawm rau txhawm rau nyeem qhov ntsuas kub.

Sau cov khoom kuaj pom 1-Hlau los ntawm cov lus txib owdir. Cov zis yuav tsum zoo li no:

/28.551DDF30000

/bus.1 /bus.0 /uncached /settings /system /statistics /structure /simultaneous /alarm

Thawj kab yog DS18B20 tus lej ntaus cim - luam nws.

Muaj nuj nqi thaiv OWS yog teeb tsa thiab sijhawm ntawm 1-Hlau kev sib txuas lus. Ob npaug nias rau qhov ua haujlwm thaiv OWS thiab nyem rau ntawm Configure khawm.

1-Wire Driver configuration dialog yuav tshwm sim. Nrhiav thiab hloov DS18B20 tus lej ID nrog ib qho ntawm koj li DS18B20. Kaw cov lus sib tham los ntawm OK khawm.

Tsis teb los tau: Koj kuj tseem tuaj yeem hloov pauv qhov ntsuas kub los ntawm kev kho CNR_temperature_sp ua haujlwm thaiv qhov twg koj tuaj yeem qhia qhov ntsuas kub xav tau. Los yog hloov hysteresis los ntawm kev kho qhov ntsuas ntawm CMP_THERMOSTAT muaj nuj nqi thaiv.

Txoj haujlwm tau npaj tam sim no. Wb Sau nws thiab rub mus rau Raspberry Pi. Xaiv Project -> Sau thiab rub tawm (lossis ntaus F6) thiab lees paub kev txuag ua ntej muab tso ua ke.

Thaum txoj haujlwm tau muab tso ua ke rub tawm cov lus sib tham yuav tshwm sim. Nco ntsoov qhia tus IP chaw nyob ntawm koj tus Raspberry Pi hauv kab phiaj thiab ntaus khawm. Thawj thawj zaug koj yuav raug thov daim ntawv tso cai rau koj li Raspberry Pi. Yog tias koj xav sim 2 teev DEMO tsuas yog xaiv Thov DEMO LICENSE dawb. Txwv tsis pub koj tuaj yeem yuav daim ntawv tso cai ruaj khov ntawm

Sai li qhov rub tawm tiav nws tuaj yeem hloov REXYGEN Studio mus rau qhov hu ua Saib hom thiab saib cov txheej txheem kev tswj hwm hauv lub sijhawm tiag tiag-nyem Saib.

Hauv Saib hom, keeb kwm yav dhau ntawm txhua cov ntaub ntawv mus rau grey thiab koj tsis tuaj yeem txav lossis tshem tawm ib qho thaiv lossis txuas. Txoj cai-nias rau ntawm OWS_temperature chij thiab xaiv Saib xaiv hauv cov ntawv qhia zaub mov kom saib cov khoom online. Koj yuav tsum pom qhov ntsuas kub tam sim no ntawm DS18B20.

Xav paub ntau ntxiv txog qhov kub thiab txias? Tsis muaj teeb meem! Tsuas yog ob npaug nias ib qho ntawm TRND_* ua haujlwm thaiv thaum tseem nyob hauv Saib hom thiab pom cov ntaub ntawv keeb kwm ntawm lub sijhawm.

Kauj Ruam 3: Xaus

Xaus
Xaus
Xaus
Xaus
Xaus
Xaus

Piv txwv Thermostat tsuas yog qhov pib rau REXYGEN lub peev xwm. Kuv yuav hais txog ob peb yam uas kuv xav tias yog qhov tseem ceeb:

  • ua hauv HMI - ib hom tsis siv neeg tsim tawm (WebWatch), ib hom Yooj Yim Yooj Yim thiab Qhia Tawm (WebBuDi) thiab hloov kho kawg nrog REXYGEN HMI Designer
  • REST API - txhua qhov haujlwm tsis tu ncua, hloov pauv thiab cov cim tuaj yeem nyeem/sau siv REST API
  • muaj ntau yam kev sib txuas lus muaj - 1 -Wire, GPIO, Modbus TCP/RTU, MQTT, Database, Siemens S7,…
  • piv txwv dav dav database
  • cov ntaub ntawv muaj-saib

Tsis paub yuav pib qhov twg? Lub taub hau mus rau lub tsev qiv ntawv piv txwv thiab saib ib puag ncig lossis tsuas yog sim ua qhov piv txwv no ntawm koj tus kheej los ntawm kos:)

Pom zoo: