Category Archives: IoT

Internet of Things

How to Send E-Mail with MOBITEK Q25

DESCRIPTION AT COMMAND

Configure Parameters of a TCP/IP Context

AT+QICSGP=<contextID>,<context_type>,<APN>,<username>,<password>, <authentication>

AT+QICSGP=1,1,”yoodo”,””,””,0
OK

Activate a PDP Context

AT+QIACT=<contextID>

AT+QIACT=1
OK

AT+QIACT?
+QIACT: 1,1,1,”10.32.47.42″

OK

Configure Parameters for SMTP Server

//Set the PDP context ID.

AT+QSMTPCFG=”contextid”,<contextID>

//Set the SSL type for SMTP.

AT+QSMTPCFG=”ssltype”,<ssltype>

//Set the IP address or domain name and port of SMTP server.

AT+QSMTPCFG=”smtpserver”,<srvaddr>,<srvport>

//Set username and password.

AT+QSMTPCFG=”account”,<username>,<password>

//Set sender name and sender address.

AT+QSMTPCFG=”sender”,<sender_name>,<sender_email>

AT+QSMTPCFG=”contextid”,1
OK

AT+QSMTPCFG=”ssltype”,0
OK

AT+QSMTPCFG=”smtpserver”,”mail.mobitek.my”,587
OK

AT+QSMTPCFG=”account”,”*username*”,”$password$”
OK

AT+QSMTPCFG=”sender”,”MOBITEK”,”add-new-post@feed.mobitek.my”
OK

Add or Delete Recipients

AT+QSMTPDST=<mode>,<type>,<emailaddr>

Parameter:

  • <mode> – Integer type. Add or delete recipients:
    • 0 – Delete
    • 1 – Add
  • <type> – Integer type. The type of recipients:
    • 1 – All recipients
    • 2 – CC recipients
    • 3 – BCC recipients
  • <emailaddr> – String type. The email address of recipients. The maximum size of the parameter is 50 bytes.
AT+QSMTPDST=1,1,”sales@abc.my”
OK

AT+QSMTPDST=1,2,”marketing-director@abc.com”
OK

AT+QSMTPDST?
+QSMTPDST: 1,”sales@abc.my”
+QSMTPDST: 2,”marketing-director@abc.com”

OK

Edit the Subject of an Email

AT+QSMTPSUB=<charset>,<subject>

Parameter:

  • <charset> – Integer type. The character set of the subject.
  • <subject> – String type. The subject of the email. If <charset> is 0, this string will be the subject of the email. Otherwise, it is formatted as a hex string.
AT+QSMTPSUB=0,”TEST SMTP USING Q25″
OK

AT+QSMTPSUB?
+QSMTPSUB: 0,”TEST SMTP USING Q25″

OK

Edit the Body of an Email

AT+QSMTPBODY=<charset>,<body_length>,<input_time>

Parameter:

  • <charset> – Integer type. The character set of the body:
    • 0 – ASCII
    • 1 – UTF-8
    • 2 – GB2312
    • 3 – BIG5
  • <body_length> – Integer type. The specific length of body. If the length of inputted data is less than the specific value <body_length>, customers can exit from data mode by “+++”. The actual length of the body is the inputted data length. The range is 1-10240. Unit: byte.
  • <input_time> – Integer type. The maximum time to upload email body from COM port. The range is 1-65535, and the default value is 90. Unit: second.
 

AT+QSMTPBODY=0,50,60
CONNECT

+QSMTPBODY: 37

OK

Send an Email

AT+QSMTPPUT=<timeout>

Parameter:

  • <timeout> – Integer type. The maximum time to send an email. The range is 60-65535. Unit:
    second.
AT+QSMTPPUT=300
OK

+QSMTPPUT: 0,0

Clear the Content of an Email

AT+QSMTPCLR

AT+QSMTPCLR
OK
 

Deactivate a PDP Context

AT+QIACT=<contextID>

AT+QIDEACT=1
OK

 

How to Set-Up Mosquitto MQTT Server

SETTING of MOSQUITTO MQTT SERVER VERSION 2.0.14 SCREEN SHOT
In “C:\Program Files\mosquitto”, open “mosquitto.conf” and add:

  • find “Listeners” and add
    listener 1883 0.0.0.0
  • find “Security” and add
    allow_anonymous true

Stop “Mosquitto Broker” in “Services”
Open command prompt as administrator and enter:

  • cd “C:\Program Files\mosquitto”
  • mosquitto -v -c mosquitto.conf
 

 

SETTING of TP-LINK Wireless Router Archer C1200 SCREEN SHOT REMARK
Open admin panel (192.168.1.1). Go to “Advanced” -> “NAT Forwarding” -> “Virtual Servers”, add:

  • Service Type = TCP
  • External Port = 1883
  • Internal IP = 192.168.1.102
  • Internal Port = 1883
  • Protocol = All
 

Connect MQTT Explorer or Q25 using the router’s Public IP:

or using DNS

How to Use MQTT with MOBITEK Q25 4G Modem

MOBITEK Q25 SETTINGS — MOSQUITTO MQTT SERVER

  1. Q25’s Setting:-
    • Remote Host: 175.*.*.* / *.dyndns.*
    • Remote Port: 1883
    • User Name: ***
    • User Password: ***
    • Subscribe Topic: Test
    • Publish Topic: Test
  2. Mosquitto version 2.0.14‘s Settings:-
    • In “C:\Program Files\mosquitto\mosquitto.conf”:
      • find “Listeners” and add
        listener 1883 0.0.0.0
      • find “Security” and add
        allow_anonymous true
    • Stop “Mosquitto Broker” in “Services”
    • Open command prompt as administrator and enter:
      • cd “C:\Program Files\mosquitto”
      • mosquitto -v -c mosquitto.conf
    • Add port forwarding in router:
      • Service Type = TCP
      • External Port = 1883
      • Internal IP = (Public IP of router)
      • Internal Port = 1883
      • Protocol = ALL

 

AT COMMANDS — MOSQUITTO MQTT SERVER

DESCRIPTION AT COMMAND

Configure Parameters of a TCP/IP Context

AT+QICSGP=<contextID>,<context_type>,<APN>,<username>,<password>, <authentication>

AT+QICSGP=1,1,”yoodo”,””,””,1
OK

Activate a PDP Context

AT+QIACT=<contextID>

AT+QIACT=1
OK

AT+QIACT?
+QIACT: 1,1,1,”10.*.*.*”

Configure receiving mode when data is received from server

AT+QMTCFG=“recv/mode”,<client_idx>,<msg_recv_mode>, <msg_len_enable>

AT+QMTCFG=”recv/mode”,0
+QMTCFG: “recv/mode”,0,0
OK

Open a network for MQTT client

AT+QMTOPEN=<client_idx>,“<host_name>”,<port>

AT+QMTOPEN=0,”175.*.*.*”,1883
OK
+QMTOPEN: 0,0

AT+QMTOPEN?

+QMTOPEN: 0,”175.*.*.*”,1883
OK

Connect a client to MQTT Server

AT+QMTCONN=<client_idx>,“<clientID>”,“<username>”,“<password>”

AT+QMTCONN=0,”Q25″,””,””
OK
+QMTCONN: 0,0,0

AT+QMTCONN?

+QMTCONN: 0,3
OK

Publish messages

AT+QMTPUBEX=<client_idx>,<msgID>,<qos>,<retain>,“<topic>”,<msg_length>

AT+QMTPUBEX=0,0,0,0, “Test”,30
> Q25 publish from Hyper Terminal
OK
+QMTPUBEX: 0,0,0

Subscribe to Topics

AT+QMTSUB=<client_idx>,<msgID>,“<topic1>”,<qos1>[,“<topic2>”,<qos2>…]

AT+QMTSUB=0,1, “Test”,0
OK
+QMTSUB: 0,1,0,0
+QMTRECV: 0,0, “Test”, “Publish from MQTT Explorer in HPC-8300”

Disconnect a client to MQTT Server

AT+QMTDISC=<client_idx>

AT+QMTDISC=0
OK

Close a network for MQTT client

AT+QMTCLOSE=<client_idx>

AT+QMTCLOSE=0
OK

Deactivate a PDP Context

AT+QIDEACT=<contextID>

AT+QIDEACT=1
OK

 

MOBITEK Q25 SETTINGS — FAVORIOT

  • Remote Host: mqtt.favoriot.com
  • Remote Port: 1883
  • User Name: ***
  • User Password: ***
  • Subscribe Topic: XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams/status
  • Publish Topic: XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams

 

AT COMMANDS — FAVORIOT

DESCRIPTION AT COMMAND

Configure Parameters of a TCP/IP Context

AT+QICSGP=<contextID>,<context_type>,<APN>,<username>,<password>, <authentication>

Parameter:

  • <contextID> – Integer type. The context ID. The range is 1-16.
  • <context_type> – Integer type. The protocol type:
    • 1 – IPV4
    • 2 – IPV4V6
  • <APN> – String type. The access point name.
  • <username> – String type. The username.
  • <password> – String type. The password.
  • <authentication> – Integer type. The authentication methods:
    • 0 – NONE
    • 1 – PAP
    • 2 – CHAP
    • 3 – PAP or CHAP
AT+QICSGP=1,1,”yoodo”,””,””,1
OK

Activate a PDP Context

AT+QIACT=<contextID>

AT+QIACT=1

AT+QIACT?
+QIACT: 1,1,1,”10.*.*.*”

Configure receiving mode when data is received from server

AT+QMTCFG=“recv/mode”,<client_idx>,<msg_recv_mode>, <msg_len_enable>

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
  • <msg_recv_mode> – Integer type. Configure the MQTT message receiving mode:
    • 0 – MQTT message received from server will be contained in URC.
    • 1 – MQTT message received from server will not be contained in URC.
  • <msg_len_enable>
    • 0 – Length of MQTT message received from server will not be contained in URC.
    • 1 – Length of MQTT message received from server will be contained in URC.
AT+QMTCFG=“recv/mode”,0,0,1

+QMTCFG: “recv/mode”,0,1

OK

Open a network for MQTT client

AT+QMTOPEN=<client_idx>,“<host_name>”,<port>

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
  • <host_name> – String type. The address of the server. It could be an IP address or a domain name. The maximum size is 100 bytes.
  • <port> – Integer type. The port of the server. The range is 1-65535.
AT+QMTOPEN=0,”mqtt.favoriot.com”,1883
OK
+QMTOPEN: 0,0

AT+QMTOPEN?

+QMTOPEN: 0,”mqtt.favoriot.com”,1883
OK

Connect a client to MQTT Server

AT+QMTCONN=<client_idx>,“<clientID>”,“<username>”,“<password>”

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
  • <clientID> – String type. The client identifier string.
  • <username> – String type. User name of the client. It can be used for authentication.
  • <password> – String type. Password corresponding to the user name of the client. It can be used for authentication.
AT+QMTCONN=0,”Q25″, “***”, “***”
OK
+QMTCONN: 0,0,0

Publish messages

AT+QMTPUBEX=<client_idx>,<msgID>,<qos>,<retain>,“<topic>”,<msg_length>

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
  • <msgID> – Integer type. Message identifier of packet. The range is 0-65535. It will be 0 only
    when <qos>=0.
  • <qos> – Integer type. The QoS level at which the client wants to publish the messages.
    • 0 – At most once
    • 1 – At least once
    • 2 – Exactly once
  • <retain> – Integer type. Whether or not the server will retain the message after it has been
    delivered to the current subscribers.

    • 0 – The server will not retain the message after it has been delivered to the
      current subscribers
    • 1 – The server will retain the message after it has been delivered to the current
      subscribers
  • <topic> – String type. Topic that needs to be published.
  • <msg_length> – Integer type. Length of message to be published.
AT+QMTPUBEX=0,0,0,0, “XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams”,30
> Q25 send from Hyper Terminal
OK
+QMTPUBEX: 0,0,0

Subscribe to Topics

AT+QMTSUB=<client_idx>,<msgID>,“<topic1>”,<qos1>[,“<topic2>”,<qos2>…]

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
  • <msgID> – Integer type. Message identifier of packet. The range is 1-65535.
  • <topic> – String type. Topic that the client wants to subscribe to or unsubscribe from.
  • <qos> – Integer type. The QoS level at which the client wants to publish the messages:
    • 0 – At most once
    • 1 – At least once
    • 2 – Exactly once
AT+QMTSUB=0,0, “XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams”,0
OK
+QMTSUB: 0,0,0,0
+QMTRECV: 0,0, “XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams”,38, “Publish from MQTT Explorer in HPC-8300″

+QMTRECV: 0,0,”XYoUfrDZ8mzvHNKJAtkLIvVBOw23dGnb/v2/streams”,46, “Publish from MQTT Explorer in Taufiq’s desktop”

Close a network for MQTT client

AT+QMTCLOSE=<client_idx>

Parameter:

  • <client_idx> – Integer type. MQTT client identifier. The range is 0-5.
AT+QMTCLOSE=0

OK

 

How to Change the Baud Rate of MOBITEK Q25 4G Modem

  1. By default, the baud rate for MOBITEK Q25 is “115200”.
  2. To change the baud rate of MOBITEK Q25 to another value and save it as default, MOBITEK Q25 needs to be connected to the PC using serial cable.
  3. Open Hyper Terminal, connect MOBITEK Q25 using “COM1” and set the baud rate to “115200”.
  4. Type “AT” in Hyper Terminal. If the response is “OK” then MOBITEK Q25 is successfully connected. If nothing can be entered in Hyper Terminal , then unplug and replug the serial cable to the serial port of the PC until “OK” is shown.
  5. In this example, the baud rate will be changed to “9600”. To do this, type “AT+IPR=9600;&W” in Hyper Terminal.

  6. At this point, nothing can be typed in Hyper Terminal because the baud rate setting has been changed from “115200” to “9600”.
  7. Disconnect MOBITEK Q25 from Hyper Terminal.
  8. Go to “File” -> “Properties”. In “Properties”, click on “Configure”. In “Port Settings”, change the baud rate to “9600”.
  9. Connect the MOBITEK Q25 to Hyper Terminal again. Enter “AT” and query the baud rate command. The baud rate should be changed to “9600”.

How to Upgrade or Downgrade the Firmware of MOBITEK Q25 4G Modem

Steps

  1. Run “QFlash v5.1”.
  2. Select the COM port number of “Quectel USB DM Port” (must use the USB port because serial port does not have “Quectel USB DM Port”).

  3. Set Baud Rate to 460800.
  4. Load Firmware Files.

  5. Upgrade firmware.

  6. Unplug the USB cable and plug it back. Use “AT+CMGR” or “ATI” to check the firmware version.

 

Download QFlash version 5.1

 

QFlash version 5.1 User’s Guide

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

How to Reset or Reboot MOBITEK S80 Modem on an Interval

  1. The reset command “AT+WRST” can be issued in either hyper terminal or QCOM.
  2. When MOBITEK S80 modem is reset/reboot:-
    • the state of QCOM as follows:-
      • “Close Port” button turn to “Open Port”
      • “Send Command” and “Run” buttons are greyed out
      • No command can be send out
    • the state of Red LED status as follows:-
      • stop blinking
      • turn off
      • turn on
      • blinking
      • all the above completed in less than 10 seconds
    • SMS Engine — Enterprise Edition is able to re-initialize the modem

 

TEST RESULT

TEST OBJECTIVE TESTING METHODOLOGY TEST RESULT
Can MOBITEK S80 support schedule reboot? E.g. reboot on 1 p.m. every day? Not applicable
Can MOBITEK S80 reboot every 3 minutes? AT+WRST?

+WRST: 0

OK
AT+WRST=1,”000:03″

OK
AT+WRST?

+WRST: 1,”000:03″,”000:03″

OK

The reset is set to start at “15:46”. By right the port will disconnect at:

  • 15:49
  • 15:52
  • 15:55

The state of QCOM when the modem disconnect:

  • “Close Port” button turn to “Open Port”
  • “Send Command” and “Run” buttons are greyed out
  • No command can be send out

At “15:49” the port closed (below s.c. is taken around 1 minute late).

Open the port again at “15:51”. At “15:52” the port closed (below s.c. is taken around 1 minute late).

Can SMS Engine — Ent. Ed. re-initialise MOBITEK S80 Modem after modem is reset?
  1. Stop the service/engine
  2. Use hyper terminal instead of QCOM ( because during remote support, you will use hyper terminal)
  3. Set the modem to reset every 3 or 5 minutes (AT+WRST=1,”000:03″)
  4. Start the service/enigne
  5. Check the log file, it should show that “GSM modem not connected” every 3 minutes then follow by “Modem ID 1 initialized”.

Not sure how frequent the engine will check for the modem’s connection. The reset duration happen in less than 10 seconds. Probably it missed the checking:

  • between 17:10 – 17:19
    • status missing at 17:13
    • status missing at 17:16
  • between 17:19 – 17:28
    • status missing at 17:22
    • status missing at 17:25

The last 3 “initialized” status show the disconnect interval are 3 minutes.

When modem is reset, what is the status of LED?
  1. Open Hyper Terminal, enter AT+WRST=1,”000:03″ command
  2. Start the engine
  3. Monitor LED status
Red LED status when the modem reset (less than 10 seconds):

  • stop blinking
  • turn off
  • turn on
  • blinking

 

AT+WRST

AT+WRST only has the <MODE>,<DELAY>,<REMAINTIME>:

Issued: AT+WRST=1,"000:03"

Response: +WRST: 1,"000:03","000:03"

  • 1 = enable reset
  • “000:03” = reset every 3 minutes interval
  • “000:03” = countdown for the next reset (3 minutes). this countdown is still active even the port is disconnected.

Means:

  • AT+WRST is not able to do schedule reboot as we can’t specify the schedule time for the reset
  • AT+WRST is able to reset at any interval, i.e.: every 3 minutes
  • need to connect to the port again after every reset
  • the reset setting is always saved in the module even after every reconnection unless “AT+WRST=0” is issued