Sending data from device not working outside of Serial Monitor
-
Hi!
Currently I am trying to send a message from my NB-IoT test unit.
I managed to work my way through the Starterkit Manual, and get it to work. I can set up the connection to the T-Mobile platform using AT-commands in the Arduino serial monitor and set up a connection to a separate online webhook reciever-site using Postman. Then I can send a message through an AT-command. To achieve this I use the following AT-commands:
Serial MonitorHowever, when I try to pass the same commands through from within the Arduino application, the messages do not come through. I use the following .ino code (in the previous case I use the same without all the AT-commands):
Arduino AppStrange thing is, when I enter the AT-command for sending a message to the web-hook in the Serial Monitor after running the Arduino code, it works. So it seems that the code does successfully set up the connection, yet fails to send the message.
The delays are admittedly a poor way of handling the status of each command, but I expected it to work nevertheless.
I hope that anyone has a clue about what is going wrong here.
Best regards.
-
As indicated, you should wait until CSQ replies with something else than 99.99, e.g. 12.99. But you should also wait until CGATT replies with a ‘1’ instead of a ‘0’, indicating that the modem is connected to the network. This often takes more than 10 seconds…
-
You could try this in your arduino code:
MODEM_STREAM.print(“AT+CFUN=1”);
delay(4000);
MODEM_STREAM.print(“AT+CGDCONT=1,“IP”,“oceanconnect.t-mobile.nl””);
delay(4000);
MODEM_STREAM.print("AT+COPS=1,2,“20416"”);This stopped working for me, no clue why:
AT+CGDCONT=1,“IP”,“oceanconnect.t-mobile.nl”
AT+CFUN=1 //radio on
AT+COPS=1,2,“20416”(you don’t need to select band 8 everytime you connect, it will save the setting in NV memory even through powercycles)
Let me know if it works