Cov txheej txheem:

[Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi: 18 Cov Kauj Ruam
[Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi: 18 Cov Kauj Ruam

Video: [Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi: 18 Cov Kauj Ruam

Video: [Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi: 18 Cov Kauj Ruam
Video: Docker 101 2024, Hlis ntuj nqeg
Anonim
[Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi
[Docker Pi Series] Yuav Ua Li Cas Siv IoT Node (A) Module ntawm Raspberry Pi

IoT Node (A) module yog dab tsi?

IoT Node (A) yog ib qho ntawm Docker Pi series qauv.

IOT Node (A) = GPS/BDS + GSM + Lora.

I2C tswj ncaj qha Lora, xa thiab txais cov ntaub ntawv, tswj GSM/GPS/BDS module los ntawm SC16IS752, lub hauv paus tsuas xav tau kev txhawb nqa I2C.

Txhawb Raspberry Pi thiab lwm yam khoom zoo sib xws.

Khoom siv

1x Raspberry Pi 2B/3B/3B+/4B/3A+/Xoom/Xoom W

1x Docker Pi series khoom: IoT Node (A) module

1x 16GB chav kawm 10 TF daim npav

1x 5V/2.5A fais fab mov (5V@3A rau Pi 4B)

Kauj ruam 1: Nta

Nta
Nta
Nta
Nta
Nta
Nta
  • Docker Pi Series
  • Programmable
  • Tswj ncaj qha (tsis muaj lub cajmeem)
  • Txuas ntxiv GPIO Pins
  • Kev them nyiaj yug GPS/BDS
  • Kev them nyiaj yug GSM
  • Lora Kev Txhawb Nqa
  • Muaj Peev Xwm nrog lwm pawg pawg pawg
  • Kev ywj pheej ntawm lub khoos phis tawj mainboard (xav tau kev txhawb nqa I2C)

Kauj Ruam 2: Kauj Ruam 1: Paub Txog Pawg IoT (A)

Kauj Ruam 1: Paub Txog Pawg IoT (A)
Kauj Ruam 1: Paub Txog Pawg IoT (A)
Kauj Ruam 1: Paub Txog Pawg IoT (A)
Kauj Ruam 1: Paub Txog Pawg IoT (A)
Kauj Ruam 1: Paub Txog Pawg IoT (A)
Kauj Ruam 1: Paub Txog Pawg IoT (A)

IoT Node (A) yog ib qho ntawm Docker Pi series qauv.

IOT Node (A) = GPS/BDS + GSM + Lora.

I2C tswj ncaj qha Lora, xa thiab tau txais cov ntaub ntawv, tswj GSM/GPS/BDS module los ntawm SC16IS752, lub hauv paus tsuas xav tau I2C kev txhawb nqa. Txhawb Raspberry Pi thiab lwm yam khoom lag luam zoo sib xws.

Yog li koj tuaj yeem tsim cov cuab yeej sib txuas lus nruab nrab los ntawm kev siv ob ntawm lawv.

thiab kuj koj tuaj yeem nrhiav koj lub cuab yeej qhov chaw nyob los ntawm kev siv GPS module onboard.

Ntxig daim npav SIM, Nws yuav dhau los ua chaw xa xov ntawm SMS lus.

Kauj Ruam 3: Kauj Ruam 2: Yuav Ua Li Cas Sau Nws

Kauj Ruam 2: Yuav Ua Li Cas Sau Nws
Kauj Ruam 2: Yuav Ua Li Cas Sau Nws
Kauj Ruam 2: Yuav Ua Li Cas Sau Nws
Kauj Ruam 2: Yuav Ua Li Cas Sau Nws

Nws yog qhov yooj yim heev los ua ke vim nws "HAT" tsim, koj tsuas yog muab nws tso rau ntawm koj lub raspberry pi thiab txiav txim siab nws ntawm GPIO pins, nws zoo li "lub kaus mom" ntawm raspberry pi, yog li koj tsis tas yuav ntxiv cov pawg xaim

Kauj Ruam 4: Kauj Ruam 3: Txuas Tus Kav hlau txais xov

Kauj Ruam 3: Nqa Tus Kav hlau txais xov
Kauj Ruam 3: Nqa Tus Kav hlau txais xov
Kauj Ruam 3: Nqa Tus Kav hlau txais xov
Kauj Ruam 3: Nqa Tus Kav hlau txais xov
Kauj Ruam 3: Nqa Tus Kav hlau txais xov
Kauj Ruam 3: Nqa Tus Kav hlau txais xov

Muaj 3 daim kav hlau txais xov rau IoT (A) tus qauv no, ib ntawm lawv yog rau lub loar module, nws yog SMA hom kav hlau txais xov, thiab ib qho ntawm lawv yog qhov zoo rau koj GPS, nws yog lub npov lub npov xov tooj cua uas muaj IPX chaw nres nkoj. thiab qhov kawg yog rau SIM module (A9G), Nws yog lub kav hlau txais xov me me uas muaj IPX chaw nres nkoj. txuas tus kav hlau txais xov thiab teeb lub kaus mom rau koj tus raspberry pi.

Yuav ua li cas sib sau ua ke Mount Iot Node (A) board rau Raspberry Pi

Hookup GPS antana thiab Lora antana rau IPX chaw nres nkoj.

  • E1, GPS-ANTANA-IPX
  • E3, LoRa-ANTANA-IPX

Screws GPRS antana ntawm SMA chaw nres nkoj.

Kauj Ruam 5: Kauj Ruam 4: OS Ib puag ncig thiab teeb tsa Software

Hauv theem no, koj yuav tsum ua cov haujlwm no:

1. Rub tawm cov duab tshiab los ntawm: www.raspberrypi.org/downloads

2. Unzip nws.

3. Nyem koj daim npav TF nrog cov duab tshiab dhau ntawm lwm yam cuab yeej

4. Kho cov ntaub ntawv /boot/config.txt thiab ntxiv nqe lus no.

dtoverlay = sc16is752-i2c

5. Hloov/boot/overlay/sc16is752-i2c.dtbo nrog cov ntawv no:

wiki.52pi.com/index.php/File:Sc16is752-i2c…

PS: nco ntsoov unzip nws muab tso rau ntawm koj/khau raj/overlay/nplaub tshev thiab hloov qhov qub.

6. Rov pib dua koj lub Raspberry Pi.

Kauj Ruam 6: Kauj Ruam 5: Kho I2C (Raspberry Pi)

Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Kauj Ruam 5: Kho I2C (Raspberry Pi)

Khiav sudo raspi-teeb tsa thiab ua raws cov lus qhia kom teeb tsa i2c kev txhawb nqa rau ARM core thiab linux kernel Mus rau Interfacing Options

Kauj Ruam 7: Kauj Ruam 6: Paub Txog Cov Ntaub Ntawv Teev Npe

Tshooj lus GPRS

Tsawg zog siv, tos pw tam sim no <1mA2.

Txhawb GSM/GPRS plaub zaus band, suav nrog 850, 900, 1800, 1900MHZ

GPRS Chav Kawm 10

Txhawb nqa GPRS cov ntaub ntawv pabcuam, cov ntaub ntawv siab tshaj plaws, rub tawm 85.6Kbps, upload 42.8Kbps

Txhawb tus qauv GSM07.07, 07.05 AT cov lus txib, thiab nkag mus rau qhov chaw nres nkoj txuas los ntawm I2C interface hloov dua siab tshiab

AT cov lus txib txhawb tus qauv AT thiab TCP/IP hais kom ua chaw nres nkoj

GPS ntu Kev txhawb nqa BDS/GPS sib koom ua haujlwm

Txhawb A-GPS, A-BDS

Txhawb nqa daim npav SIM

LORA ntu Kev xa mus deb: 500 Meters (RF tsis: 0x50 @ Tuam Tshoj Lub Nroog)

Txhawb FSK, GFSK, MSK, GMSK, LoRaTM thiab OOK txoj kev hloov kho

Ultra -high receiver rhiab heev li qis li -141 dBm

Txhawb kev pom ua ntej

Pob ntawv cav nrog CRC, txog 256 bytes

LORA transceiver qhia

Easy TX/RX los ntawm Docker Pi

Kauj ruam 8:

A9G Qauv

A9G module muaj ob qhov chaw nres nkoj.

Siv I2C UART choj rau kev sib txuas lus.

Serial Port Module lub npe

  • /dev/ttySC0 GSM
  • /dev/ttySC1 GPS/BDS

Sau Npe Daim Ntawv Qhia

  • Sau Npe Chaw Nyob Tus Nqi
  • 0x01 LORA_TX1 Lora TX Tsis 1 - Cov Ntaub Ntawv Siv
  • 0x02 LORA_TX2 Lora TX Buffer 2 - Cov Ntaub Ntawv Siv
  • 0x03 LORA_TX3 Lora TX Buffer 3 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x04 LORA_TX4 Lora TX Tsis 4 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x05 LORA_TX5 Lora TX Tsis 5 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x06 LORA_TX6 Lora TX Tsis 6 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x07 LORA_TX7 Lora TX Buffer 7 - Cov Ntaub Ntawv Siv
  • 0x08 LORA_TX8 Lora TX Buffer 8 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x09 LORA_TX9 Lora TX Buffer 9 - Cov Ntaub Ntawv Siv
  • 0x0a LORA_TX10 Lora TX Buffer 10 - Cov Ntaub Ntawv Siv
  • 0x0b LORA_TX11 Lora TX Buffer 11 - Cov Ntaub Ntawv Siv
  • 0x0c LORA_TX12 Lora TX Buffer 12 - Cov Ntaub Ntawv Siv
  • 0x0d LORA_TX13 Lora TX Buffer 13 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x0e LORA_TX14 Lora TX Buffer 14 - Cov Ntaub Ntawv Siv
  • 0x0f LORA_TX15 Lora TX Buffer 15 - Cov Ntaub Ntawv Siv
  • 0x10 LORA_TX16 Lora TX Buffer 16 - Cov Ntaub Ntawv Siv
  • 0x11 LORA_RX1 Lora RX Tsis 1 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x12 LORA_RX2 Lora RX Tsis 2 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x13 LORA_RX3 Lora RX Tsis 3 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x14 LORA_RX4 Lora RX Tsis 4 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x15 LORA_RX5 Lora RX Tsis 5 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x16 LORA_RX6 Lora RX Tsis 6 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x17 LORA_RX7 Lora RX Tsis 7 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x18 LORA_RX8 Lora RX Tsis 8 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x19 LORA_RX9 Lora RX Tsis 9 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1a LORA_RX10 Lora RX Tsis 10 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1b LORA_RX11 Lora RX Tsis 11 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1c LORA_RX12 Lora RX Tsis 12 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1d LORA_RX13 Lora RX Tsis 13 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1e LORA_RX14 Lora RX Tsis 14 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x1f LORA_RX15 Lora RX Tsis 15 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x20 LORA_RX16 Lora RX Tsis 16 - Cov Neeg Siv Cov Ntaub Ntawv
  • 0x01 - 0x10 Sau Xwb.
  • 0x11 - 0x20 Nyeem Xwb.

Kauj Ruam 9: Cov lus qhia:

Cov lus qhia
Cov lus qhia

L_SET (Tsuas Xeem)

  • Sau 1 kom teeb tsa tsis los ntawm 0x22 rau LORA Module.
  • Sau 0 tsis cuam tshuam

G_RESET (Tsuas Xeem)

  • Sau 1 kom rov pib dua A9G Module
  • Sau 0 tsis cuam tshuam

L_RXNE (Nyeem & Sau)

  • Sau 1 ua yuam kev
  • Sau 0 kom pom tseeb
  • Nyeem 1 txhais tau tias tau txais cov ntaub ntawv, thov tau txais cov ntaub ntawv los ntawm kev sau npe 0x11 - 0x20.
  • Nyeem 0 txhais tau tias tsis muaj cov ntaub ntawv muaj tam sim no.

L_SET (Tsuas Xeem)

  • Sau 1 kom xa cov ntaub ntawv, thov sau cov ntaub ntawv hauv npe 0x01 - 0x10 ua ntej xa.
  • Sau 0 tsis cuam tshuam

Kauj Ruam 10: Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)

Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)
Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)
Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)
Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)
Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)
Yuav Siv GPS Module Nrog Gpsd (Raspberry Pi)

Yuav siv GPS Module nrog gpsd (Raspberry Pi) li cas

Ua ntej, hloov /boot/overlays/sc16is752-i2c.dtbo thiab xyuas kom tseeb tias I2C ua haujlwm tau zoo.

  • Hloov sc16is752-i2c.dtbo
  • Kev teeb tsa I2C
  • Nruab gpsd cov cuab yeej.

Qhib lub davhlau ya nyob twg thiab ntaus cov lus txib no:

sudo apt nruab gpsd gpsd-cov neeg siv

Hloov kho/etc/default/gpsd cov ntaub ntawv thiab ntxiv cov hauv qab no:

  • DEVICES = "/dev/ttySC1"
  • GPSD_OPTIONS = "-F /var/run/gpsd.sock"

Nkag mus hais kom ua i2cset -y 1 0x16 0x23 0x40 kom rov pib dua GPRS module.

Python Tsab Ntawv Rau Qhib GPS:

ntshuam serialimport os lub sijhawm ntshuam # Rov pib ua haujlwm gpsd. os.system ("sudo systemctl restart gpsd.socket") # Qhib serial chaw nres nkoj ser = serial. Serial ('/dev/ttySC0', 115200) i = 0 yog ser.isOpen == Tsis tseeb: ser.open () sim: luam tawm ("Qhib GPS …") thaum Tseeb: ser.write (str.encode ("AT+GPS = 1 / r")) loj = ser.inWaiting () yog qhov loj! = 0: zuam = sijhawm.time () teb = ser.read (loj) gps = str (teb, encoding = "utf -8") yog (gps.find ("OK")! = -1): os.system ("sudo cgps -s") tawm () lwm yam: i = i + 1 luam ("Tos GPS Pab Tau, Yog tias lub sijhawm ntev dhau lawm, Thov kuaj sab nraud:" + str (i)) ser.flushInput () time.sleep (1) tshwj tsis yog KeyboardInterrupt: ser.flushInput () ser.close ()

Txuag nws thiab ua nws:

sej 3 GPS.py

Kauj Ruam 11: Yuav Siv GPS Module Nrog C (Raspberry Pi)

Nruab gpsd cov cuab yeej

sudo apt-tau nruab libgps-dev

Tsim qhov chaws thiab lub npe nws "gps.c"

#include #include #include

#suav nrog

#suav nrog

int lub ntsiab ()

{koj rc; teeb timeval tv; struct gps_data_t gps_data; yog ((rc = gps_open ("localhost", "2947", & gps_data)) == -1) {printf ("code: %d, vim li cas: %s / n", rc, gps_errstr (rc)); rov qab EXIT_FAILURE; } gps_stream (& gps_data, WATCH_ENABLE | WATCH_JSON, NULL);

thaum (1)

{ / * tos 2 vib nas this kom tau txais cov ntaub ntawv * / yog (gps_waiting (& gps_data, 2000000)) { / * nyeem cov ntaub ntawv * / yog ((rc = gps_read (& gps_data)) == -1) {printf ("yuam kev tshwm sim nyeem ntawv gps cov ntaub ntawv. code: %d, vim li cas: %s / n ", rc, gps_errstr (rc)); } lwm tus { /* Zaub cov ntaub ntawv los ntawm tus txais GPS. */ yog ((gps_data.status == STATUS_FIX) && (gps_data.fix.mode == MODE_2D || gps_data.fix.mode == MODE_3D) &&! isnan (gps_data.fix.latitude) &&! isnan (gps_data.fix.longitude)) { /* gettimeofday (& tv, NULL); Kho: tv.tv_sec tsis yog timestamp tiag tiag! */

printf ("latitude: %f, longitude: %f, nrawm: %f, timestamp: %lf / n", gps_data.fix.latitude, gps_data.fix.longitude, gps_data.fix.speed, gps_data.fix.time);

// Kho: Hloov tv.tv_sec nrog gps_data.fix.time} lwm {printf ("tsis muaj GPS cov ntaub ntawv muaj / n"); }}} pw tsaug zog (3); } / * Thaum koj ua tiav… * / gps_stream (& gps_data, WATCH_DISABLE, NULL); gps_close (& gps_data); rov qab EXIT_SUCCESS; }

Kauj ruam 12: Sau nws

Sau nws
Sau nws

Sau!

gcc gps.c -lm -lgps -o gps

Exec Nws!

/gps cov

Kauj Ruam 13: Yuav Siv GPS Module Nrog Python (Raspberry Pi)

Yuav Siv GPS Module Nrog Python (Raspberry Pi)
Yuav Siv GPS Module Nrog Python (Raspberry Pi)

Cov cai hauv qab no tau pom zoo kom ua tiav siv Python 3 thiab teeb tsa lub tsev qiv ntawv gpsd-py3 thiab GPS 2D/3D Kho:

ntshuam gpsd

# Txuas mus rau gpsd hauv zos

gpsd.connect ()

# Tau txais txoj haujlwm gps

pob = gpsd.get_current ()

# Saib cov kab ntawv kab hauv qab rau GpsResponse rau cov ntaub ntawv muaj

print (pob ntawv.position ())

Kauj Ruam 14: Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)

Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)
Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)
Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)
Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)
Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)
Yuav Siv GSM Module Nrog PPPd (Raspberry Pi)

A) Ua ntej, hloov /boot/overlays/sc16is752-i2c.dtbo thiab xyuas kom tseeb tias I2C ua haujlwm tau zoo.

  • Hloov sc16is752-i2c.dtbo
  • Kev teeb tsa I2C

B) Nkag mus hais kom ua i2cset -y 1 0x16 0x23 0x40 kom rov pib dua GPRS module.

Tom qab khiav cov lus txib, koj yuav tsum tau tos me ntsis, txog 10 vib nas this

Koj kuj tseem tuaj yeem siv cov hauv qab no los pib dua.

C) Nkag mus hais kom ua

sudo apt nruab ppp

rau nruab ppp cov cuab yeej.

D) Luam/lwm yam/ppp/phooj ywg/tus muab kev pabcuam rau/etc/ppp/peers/gprs

E) Hloov kho/etc/ppp/peers/gprs

  • Kab 10: Thov sab laj nrog koj tus muab kev pabcuam rau tus neeg siv (Piv txwv: cmnet).
  • Kab 15: Thov nrog koj tus neeg muab kev pabcuam rau apn (Piv txwv: cmnet).
  • Kab 18 - Kab 24: Pom zoo teeb tsa

F) Hloov kho/etc/chatscripts/gprs (Hloov Kab 34 rau Kab 35, Dialout Number Yuav TSIS YOG *99#)

G) Nkag mus hais kom ua sudo pppd hu gprs kom hu xov tooj.

H) Txheeb xyuas koj li ppp teeb tsa los ntawm koj tus ISP.

Kuv) Nkag mus hais kom ua ping -I ppp0 8.8.8.8 kuaj koj lub network (Yog tias muaj Is Taws Nem thiab muaj cov lus qhia yog raug)

J) Thov khaws GSM teeb liab kom zoo, txwv tsis pub cov hauv qab no yuav tshwm sim.

Kauj Ruam 15: Yuav Ua Li Cas Txheeb Kuv Li GSM Module (Raspberry Pi)

Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)
Yuav Ntsuam Xyuas Kuv Li GSM Module (Raspberry Pi)

Cov cai hauv qab no tau pom zoo kom ua tiav siv Python 3 thiab teeb tsa lub tsev qiv ntawv smbus:

ntshuam lub sijhawm tseem ceeb ntshuam smbus ntshuam tus neeg teb xov tooj ntshuam os

print ("Tos rau initializing …")

npav = smbus. SMBus (1)

bus.write_byte_data (0x16, 0x23, 0x40)

ser = serial. Serial ('/dev/ttySC0', 115200)

yog ser.isOpen == Cuav:

ser.open () sim: print ('-'*60) print ("Initializing A9G GPRS module.") print ("GSM connecting …") time.sleep (3) i = 0 while True: ser.write (str.encode ("AT+CCID / r")) size = ser.inWaiting () yog qhov loj! = 0: zuam = time.time () teb = ser.read (loj) ccid = str (teb, encoding = "utf -8 ") print (ccid) else: i = i + 1 ser.flushInput () time.sleep (1) tsuas yog KeyboardInterrupt: ser.close ()

Exec Test Script, raws li cov txiaj ntsig ntawm kev siv, peb tuaj yeem kuaj mob GSM module. Piv txwv li, rov qab los tom qab no, CME ERROR 53 yuam kev qhia rau peb lub zog tsis zoo. CME Code = GSM Cov khoom siv cuam tshuam txog qhov ua yuam kev

Tau kawg, tsab ntawv kuj tseem muaj qhov rov ua haujlwm. Yog tias koj tuaj yeem tso saib CCID kom raug, rov pib dua yog ua tiav.

Kauj Ruam 16: Yuav Siv Lora TX & RX Nrog C (Raspberry Pi)

Cov cai hauv qab no tau pom zoo kom ua tiav siv Python 3 thiab teeb tsa lub tsev qiv ntawv smbus.

Nws yuav tsum tau hloov pauv ntawm ob qhov IOT Node (A). Cov ntsiab lus xa los ntawm nws tus kheej tsis tuaj yeem txais los ntawm nws tus kheej. Thov khaws nws ua cov ntawv py rau kev ua tiav.

Yuav Xa Li Cas: Tom qab sau cov ntaub ntawv rau npe 0x01 - 0x10, teeb tsa L_TX ntsis kom pib xa cov ntaub ntawv.

ntshuam sij hawm ntshuam smbus ntshuam os ntshuam sys

npav = smbus. SMBus (1)

sim:

data_list = [170, 85, 165, 90] # sau cov ntaub ntawv rau npe thiab tom qab ntawd cov ntaub ntawv yuav raug xa tawm. rau qhov ntsuas hauv ntau (1, len (data_list) + 1): bus.write_byte_data (0x16, index, data_list [index - 1]) print ("LORA xa cov ntaub ntawv rau %d sau npe %d cov ntaub ntawv" %(index, data_list [index - 1])) bus.write_byte_data (0x16, 0x23, 0x01) tshwj tsis yog KeyboardInterrupt: sys.exit ()

Yuav Txais Txais Li Cas: Txheeb L_RXNE me ntsis, Yog tias teeb tsa, cov ntaub ntawv tshiab tuaj txog, tus chij no yuav tsum ua kom pom tseeb

ntshuam sij hawm ntshuam smbus ntshuam os ntshuam sys

npav = smbus. SMBus (1)

cov_data =

sim:

if bus.read_byte_data (0x16, 0x23) & 0x02: # manually clear L_RXNE bus.write_byte_data (0x16, 0x23, 0x00) register_list = [0x11, 0x12, 0x13, 0x14] # nyeem tawm cov ntaub ntawv rau qhov ntsuas hauv ntau (0x11, len (register_list) + 0x11): recv_data.append (bus.read_byte_data (0x16, register_list [index - 0x11]))

print ("Tau txais cov ntaub ntawv:")

print (recv_data) lwm yam: luam tawm ("Tsis tau txais cov ntaub ntawv tseem tsis tau ~") tshwj tsis yog KeyboardInterrupt: sys.exit ()

Kauj Ruam 17: Cov Lus Qhia Tshwj Xeeb ntawm I2C Bandwidth

Qhov txwv ntawm I2C nrawm yog 400kHz, vim yog I2C raws tu qauv, yog li cov cuab yeej siv tau zoo bandwidth qis dua 320kbps, ntau lub cuab yeej siv tau zoo bandwidth qis dua 160kbps. Kev txwv ntawm I2C UART Choj nrawm yog 115200bps. Thaum GPS thiab GSM ua haujlwm tib lub sijhawm, I2C bandwidth tsis txaus, vim tias 115.2kbps * 2 = 230.4kbps, yog li qee cov ntaub ntawv yuav dhau mus. Ru txo tus nqi baud ntawm GPS thiab GSM kev sib txuas lus tuaj yeem txhim kho kev sib txuas lus tsis txaus. Packing lwm DockerPi modules yuav siv ntxiv I2C bandwidth. At feem ntau, cov ntaub ntawv network nrawm yog qeeb, yog li GSM bandwidth tsis puv, yog li tsis muaj teeb meem hla dhau.

Kauj Ruam 18: Tiav lawm

Vam tias koj nyiam thiab ua nws.

koj tuaj yeem pom nws ntawm no:

Amazon

Hmo ntuj tsaus ntuj: https://www.amazon.com/GeeekPi-Night-Light-WS2812-Raspberry/dp/B07LCG2S5S 4channel Relay board: https://www.amazon.co.uk/dp/B07MV1TJGR?ref=myi_title_dp Power Board : Https: //www.amazon.co.uk/dp/B07TD595VS? Ref = myi_title_dp IoT Node () : https://www.amazon.co.uk/dp/B07TY15M1C Sensor HUB : https:// www. amazon.co.uk/dp/B07TZD8B61 ntauwd dej khov :

Pom zoo: