It became necessary to measure the radio wave strength of the place where the radio wave reaches the limit with LTE SIM communication, and first I measured the radio wave strength of SIM using Raspberry Pi at home with a good radio wave environment, so I will summarize the results It was.
The SIM prepared this time is SORACOM's plan-D that covers the DoCoMo area. The equipment was tested with the following configuration. ・ Raspberry Pi3 + LTE communication module (4GPI) ・ Raspberry Pi4 + USB modem (MS2372-607) The OS is Raspbian, but for Raspberry Pi 3, I used 4gpi-buster-lite-20200612.zip for 4GPI and updated it to the latest state.
The example of using 4GPI is omitted, and an example of building a general USB modem environment is briefly explained. Plug in the USB modem and run the command lsusb to verify that Device 004 recognizes the modem.
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The USB modem (MS2372-607) is recognized by / dev / ttyUSB0. For reference, in the case of 4GPI, it will be / dev / tty4GPI.
$ ls -al /dev/ttyUSB*
crw-rw-rw- 1 root dialout 188, 0 Sep 22 00:19 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Sep 22 00:11 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 Sep 22 00:11 /dev/ttyUSB2
SORACOM Air will be available at:
$ curl -O https://soracom-files.s3.amazonaws.com/setup_air.sh
$ sudo bash setup_air.sh
You can check the connection of network interface wwan0 as follows.
$ ifconfig wwan0
wwan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.62.145 netmask 255.255.0.0 broadcast 169.254.255.255
ether 00:1e:10:1f:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 49 bytes 14994 (14.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In order to measure the signal strength of SIM, it is necessary to send the corresponding AT command by serial communication with the modem or communication module and receive the result. The AT command that can acquire the signal strength is ** AT + CSQ **, and the signal strength is determined based on this output result.
The signal strength is the AT command ** AT + CSQ **, but the result is expressed as ** + CSQ: 19,99 **. ** 19 ** in the above result example is RSSI (Received Signal Strength Indicator), which is 0 to 31 or 99. (99 is unknown or undetectable.) In the above result example, ** 99 ** is BER (Bit Error Rate), and 99 seems to mean that a bit error occurred or was unknown or could not be detected. To convert this to a dBm value that represents the signal strength, calculate using the formula **-113 + (RSSI value * 2) **. The RSSI value, dBmc value, and signal strength are summarized in the table below, but if you want to know the rough signal strength, the RSSI value is sufficient.
RSSI | dBm | Connection status |
---|---|---|
0 | -113 or less | - |
1 | -111 | - |
2~9 | -109~-95 | Marginal |
10~14 | -93~-85 | OK |
15~19 | -83~-75 | Good |
20~30 | -73~-53 | Excellent |
31 | -51 or greater | - |
99 | - | Not known or not detectable |
This time, I created a program to measure the signal strength with Python 2.7. Python serial communication requires pyserial.
$ pip install pyserial
I created the following program by referring to the information on the Web. ** / dev / ttyUSB0 ** is for a USB modem (MS2372-607) and ** / dev / tty4GPI ** for 4GPI.
LteSimLevel.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import serial
modem = serial.Serial("/dev/ttyUSB0",baudrate=115200,timeout=1)
def sendAt(cmd):
modem.write('AT+'+cmd+'\r')
time.sleep(0.1)
return modem.read(32798)
def calcDbm(csq):
csq = csq.replace('OK','')
csq = csq.replace('+CSQ: ','')
csq = csq.replace('\n','')
csq = csq.replace('\r','')
dec = csq.split(',')
if unicode(dec[0]).isdecimal():
dbm = -113 + (int(dec[0]) * 2)
return dbm
else:
return -113
def connStatus(dbm):
if dbm >= -73:
return "Excellent"
elif dbm >= -83:
return "Good"
elif dbm >= -93:
return "OK"
elif dbm < -93:
return "Alert:Marginal"
try:
if modem.inWaiting()>0: modem1.flushInput()
csq = sendAt('CSQ')
print("AT command response")
print(csq)
print("SIM signal strength")
dbm = calcDbm(csq)
print(connStatus(dbm) + " (" + str(dbm) + "dbm)" )
finally:
modem.close()
In the case of the USB modem (MS2372-607), it was as follows.
$ python LteSimLevel.py
AT command response
+CSQ: 19,99
OK
SIM signal strength
Good (-75dbm)
In the case of 4GPI, it was as follows.
$ python LteSimLevel.py
AT command response
+CSQ: 27,99
OK
SIM signal strength
Excellent (-59dbm)
In the case of a USB modem (MS2372-607), the antenna is built into the USB dongle and the antenna gain is low, and it is estimated that 4GPI, which has a solid antenna on a dedicated board, has that much antenna gain. It is a convincing result. Now that we have confirmed the difference in radio field strength, it seems that we can measure the radio field strength in the place where the radio wave reaches the limit by LTE SIM communication.
__ Using SORACOM Air on various devices __ https://dev.soracom.io/jp/start/device_setting/ __Read AT command data with pySerial __ https://stackoverrun.com/ja/q/6675281 __Reference information necessary for determining the installation location when using 3G / LTE __ https://armadillo.atmark-techno.com/howto/armadillo_3g-lte_installation-location AT Command AT+CSQ https://m2msupport.net/m2msupport/atcsq-signal-quality/ __ AT commands learned using SORACOM --3 Practical edition (AT + CSQ commands) __ https://bearmini.hatenablog.com/entry/at-command3 AT Commands https://wiki.teltonika-networks.com/view/AT_Commands MS2372-607 https://blog.soracom.com/ja-jp/2018/08/17/ms2372/ 4GPI https://mechatrax.com/products/4gpi/
Recommended Posts