Using the Unit NB-IoT2 (SIM7028) ・ 使用 Unit NB-IoT2 (SIM7028)
M5StackのUnit NB-IoT2 (SIM7028)をコントローラーに接続する最小構成。配線とBOMつき。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| AtomS3 Lite | Controller | grove_i2c, gpio, usb_c | official page — $7.5 |
| Unit NB-IoT2 (SIM7028) | unit | grove_uart, antenna_sma | official page — $6.5 |
M5Stack AtomS3 LiteとUnit NB-IoT2 (SIM7028)で作る、NB-IoT通信のテスト用セットアップです。AtomS3 LiteからUART経由でSIM7028にATコマンドを送り、ネットワークに接続してデータを送受信できます。
# M5Stack AtomS3 Lite + Unit NB-IoT2 (SIM7028)
# Wiring: Unit NB-IoT2 (UART) -> AtomS3 Lite Grove Port.C (UART)
# AtomS3 Lite Grove Port.C: TX=GPIO1, RX=GPIO2
import time
from machine import Pin, UART
# Initialize UART on Port.C (TX=1, RX=2, baudrate=115200)
uart = UART(1, baudrate=115200, tx=1, rx=2)
# Initialize built-in RGB LED (GPIO35 on AtomS3 Lite)
from neopixel import NeoPixel
led = NeoPixel(Pin(35), 1)
def send_at(cmd, timeout=2000):
uart.write(cmd + '\r\n')
time.sleep_ms(100)
response = b''
start = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), start) < timeout:
if uart.any():
response += uart.read()
time.sleep_ms(10)
return response.decode(errors='ignore')
# Set LED to blue during initialization
led[0] = (0, 0, 50)
led.write()
# Basic AT test
print("Testing AT...")
resp = send_at('AT')
print(resp)
# Check SIM status
print("Checking SIM...")
resp = send_at('AT+CPIN?')
print(resp)
# Check network registration
print("Checking network...")
resp = send_at('AT+CREG?')
print(resp)
# If registered, set LED to green
if '+CREG: 0,1' in resp or '+CREG: 0,5' in resp:
led[0] = (0, 50, 0)
led.write()
print("Network registered!")
else:
print("Not registered yet.")
# Main loop: send AT every 10 seconds
while True:
resp = send_at('AT+CSQ') # signal quality
print('Signal:', resp)
time.sleep(10)
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。