Connect SIM7000E to the Internet

Hi.

I want to connect my SIM7000E to the internet.

When i send the following form a python file i get an "OK" responce from the modem.

send_at('AT+CGDCONT=1,\"IP\",\"'+APN+'\",\"0.0.0.0\",0,0','OK',1)

But when i send the following from a function node in Node-red i get an error from the SIM7000E modem.

var at_cmd = "AT + CGDCONT = ";
msg.payload = at_cmd + "1" + "," + '"IP"' +"," + '"internet"' + "," + '"0.0.0.0"' + "," + "0" + "," + "0" + "\r";
return msg;

When i send the above mention from a function node I get the following reply from the modem: AT + CGDCONT = 1,"IP","internet","0.0.0.0",0,0 followed by an error.

Kindly assist.

How have you created your node?
Can you publish it so other people can try it out and see if it works for them?

The following is the nodes. Basically a function node with a serial in and a serial out.

[
    {
        "id": "631f73ea1fff92a3",
        "type": "serial out",
        "z": "8f721a97cf856861",
        "name": "Serial-Out",
        "serial": "f4ec6284837b4b4c",
        "x": 1160,
        "y": 120,
        "wires": []
    },
    {
        "id": "36261b28659f2087",
        "type": "serial in",
        "z": "8f721a97cf856861",
        "name": "Serial-In",
        "serial": "f4ec6284837b4b4c",
        "x": 140,
        "y": 420,
        "wires": [
            [
                "7ebbcb39cd8a2533"
            ]
        ]
    },
    {
        "id": "75d63ecf7375cc1b",
        "type": "inject",
        "z": "8f721a97cf856861",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 200,
        "wires": [
            [
                "afeb1dae1c42364d"
            ]
        ]
    },
    {
        "id": "7ebbcb39cd8a2533",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 10",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 440,
        "y": 440,
        "wires": []
    },
    {
        "id": "afeb1dae1c42364d",
        "type": "function",
        "z": "8f721a97cf856861",
        "name": "AT+CPSI?",
        "func": "var at_cmd = \"AT+CPSI?\";\nmsg.payload = at_cmd + \"\\r\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 200,
        "wires": [
            [
                "631f73ea1fff92a3",
                "c5b679ad85becc56"
            ]
        ]
    },
    {
        "id": "c5b679ad85becc56",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 160,
        "wires": []
    },
    {
        "id": "e894131fc75ea9fc",
        "type": "function",
        "z": "8f721a97cf856861",
        "name": "Define pdp context",
        "func": "var at_cmd = \"AT + CGDCONT = \";\n\nmsg.payload = at_cmd + \"1\" + \",\" + '\"IP\"' +\",\" + '\"internet\"' + \",\" + '\"0.0.0.0\"' + \",\" + \"0\" + \",\"  + \"0\" + \"\\r\";\n// msg.payload = 'AT + CGDCONT = 1, \"IP\", \"internet\", \"0.0.0.0\", 0, 0';\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 280,
        "wires": [
            [
                "631f73ea1fff92a3",
                "dcad3515115d6b57"
            ]
        ]
    },
    {
        "id": "7db0b828a23f1ec3",
        "type": "inject",
        "z": "8f721a97cf856861",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 280,
        "wires": [
            [
                "e894131fc75ea9fc"
            ]
        ]
    },
    {
        "id": "dcad3515115d6b57",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 12",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 700,
        "y": 220,
        "wires": []
    },
    {
        "id": "075412faf0940fc5",
        "type": "inject",
        "z": "8f721a97cf856861",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 60,
        "wires": [
            [
                "9f9edb4574b71834"
            ]
        ]
    },
    {
        "id": "9f9edb4574b71834",
        "type": "function",
        "z": "8f721a97cf856861",
        "name": "Get signal strenght",
        "func": "var at_cmd = \"AT+CSQ\";\nmsg.payload = at_cmd + \"\\r\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 60,
        "wires": [
            [
                "de6e8d0b283786bc",
                "631f73ea1fff92a3"
            ]
        ]
    },
    {
        "id": "de6e8d0b283786bc",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 13",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 40,
        "wires": []
    },
    {
        "id": "f62215e4e9f3ae6c",
        "type": "inject",
        "z": "8f721a97cf856861",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 340,
        "wires": [
            [
                "fedaf03bcd2ab44c"
            ]
        ]
    },
    {
        "id": "fedaf03bcd2ab44c",
        "type": "function",
        "z": "8f721a97cf856861",
        "name": "AT+CSOCKSETPN=1",
        "func": "var at_cmd = \"AT+CSOCKSETPN=1\";\nmsg.payload = at_cmd + \"\\r\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 440,
        "y": 340,
        "wires": [
            [
                "bc12585bf1a47de0",
                "631f73ea1fff92a3"
            ]
        ]
    },
    {
        "id": "bc12585bf1a47de0",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 15",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 340,
        "wires": []
    },
    {
        "id": "00dbc58b6af33db0",
        "type": "inject",
        "z": "8f721a97cf856861",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 120,
        "wires": [
            [
                "132579eed25c2ca4"
            ]
        ]
    },
    {
        "id": "132579eed25c2ca4",
        "type": "function",
        "z": "8f721a97cf856861",
        "name": "AT CREG",
        "func": "var at_cmd = \"AT+CREG?\";\nmsg.payload = at_cmd + \"\\r\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 120,
        "wires": [
            [
                "a79e049054f6af48",
                "631f73ea1fff92a3"
            ]
        ]
    },
    {
        "id": "a79e049054f6af48",
        "type": "debug",
        "z": "8f721a97cf856861",
        "name": "debug 17",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 100,
        "wires": []
    },
    {
        "id": "f4ec6284837b4b4c",
        "type": "serial-port",
        "serialport": "/dev/ttyS0",
        "serialbaud": "115200",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "dtr": "none",
        "rts": "none",
        "cts": "none",
        "dsr": "none",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": "",
        "responsetimeout": "10000"
    }
]

[Edited by Moderator]

@SplitSecComp

Any reason you don't code like this?

msg.payload = at_cmd + '1,"IP","internet","0.0.0.0",0,0\r';

What does send_at() do?

send_at('AT+CGDCONT=1,"IP","'+APN+'","0.0.0.0",0,0','OK',1)

returns an ok if i send it in a python file....it works

I have tried this way as well...still get an error. First is what the debug returns from the function node that i send the last two is what the "Serial in" returns
image

This is what the python file returns

I am baffled :grinning:

There is the obvious difference that you have several spaces in the string shown in the debug. Try taking those out.

Many thanks i have removed the spaces. Its now working :+1: