Digital input not reading: NPN or PNP, step by step
183 Views •4-20 mA input reading wrong: check it step by step
174 Views •RS-485: how to check a bus step by step
163 Views •Relay or transistor output: which one and how to check it
141 Views •Scaling a 4-20 mA signal in the PLC: formula, constants and code
137 Views •Upload fails: 6 checks before blaming the code
60 Views •Modbus RTU timeout: 6 checks before blaming the wiring
57 Views •4G PLC not connecting: 6 checks before blaming the code
12 Views •4G PLC not connecting: 6 checks before blaming the code
Short answer: when a PLC with a mobile modem does not connect, the code may be fine. Check the SIM, the technology, the antenna, the signal, the network registration and the APN, in this order.
Download the checklist (PDF, 2 pages)
Descarga la lista de comprobación (PDF, 2 páginas)
These checks apply to any PLC or gateway with an LTE-M, NB-IoT or 2G/GPRS modem. At the end you will find the page for your PLC range.
Six checks, in this order
| Check | What to do | Good result |
|---|---|---|
| 1. SIM | Check that the SIM is active and has a data plan. Disable the PIN, or set it in the code or in the setup. | The modem reads the SIM without asking for a PIN. |
| 2. Technology | Modem, SIM and operator must share one technology: LTE-M, NB-IoT or 2G. Ask your operator which ones it offers in your area. Many operators are switching off 2G and 3G. | The modem is set to a technology your SIM and your operator support. |
| 3. Antenna | Connect an antenna for the bands your operator uses. A metal cabinet attenuates the signal: mount the antenna outside. | Antenna connected and outside the cabinet. |
| 4. Signal | Send AT+CSQ. The first value goes from 0 (-113 dBm or less) to 31 (-51 dBm or more); 99 means not known or not detectable. | A value between 0 and 31, as high as you can get. |
| 5. Registration | Send AT+CEREG? (LTE-M, NB-IoT) or AT+CREG? (2G). Status 1: registered, home network. 5: registered, roaming. 2: searching. 3: registration denied. | Status 1 or 5. With 3, ask your operator. |
| 6. APN | Registered but no data? Set the APN, user and password your operator gives you. | The PLC gets an IP address and reaches the server. |
What the readings tell you
- The modem does not answer AT commands: possible causes are a wrong port or baud rate, the modem not powered or a missing setup step for your PLC range.
- SIM error or PIN required: SIM not inserted correctly, PIN enabled, or SIM not activated by the operator.
- Signal 99: no antenna, antenna inside the cabinet, wrong bands or no coverage for the selected technology.
- Status 2 for a long time: the modem is searching. Check the technology, the bands and the coverage of your operator.
- Status 3: the network rejects the SIM: not activated, no plan for that technology, or roaming not allowed. Only the operator can solve it.
- Registered but no data: wrong APN, user or password, or a data plan without credit.
- Connects and drops: weak signal or an unstable supply. Keep the data on the PLC while the link is down and send it when it comes back.
Security
A mobile connection puts the PLC on a public network. Prefer a private APN or a VPN, do not expose services to the Internet and use authentication on every service.
On your PLC range
- ESP32 PLC: 4G with LTE-M and NB-IoT
- Raspberry PLC: 4G/LTE expansion board
- M-Duino and Ardbox: GPRS and GSM (2G)
- User guides of each PLC family
Sources
AT+CSQ, AT+CREG and AT+CEREG values: 3GPP TS 27.007. 2G and 3G switch-off: GSMA, Legacy mobile network rationalisation.
Commenting is not enabled on this course.