User Tools

Site Tools


sending_sms_via_gsm_modem

This is an old revision of the document!


Send SMS via USB Modem

If you need send SMS using own GSM modem you can use Custom Protocols to instruct modem send messages.

To send SMS you need send a few AT-commands to modem. Unfortunately, sometimes they are vendor-specific and we can't built in support all modems into WebHMI. So we publish custom protocol that will help you understand the idea and adopt it for your modem.

Here is the sample protocol that will send message:

function createDevices ()
    addDevice({name = "SMS",  shift = 0, base = 10, xtraFields = {1, 5}});
end
 
function readRegister (reg, device, unitId)
    return "SMS";
end
 
function writeRegister (reg, device, unitId, newValue)
    sendString("AT+CPIN=\"0000\"\r");
    sendString("AT+CMGF=1\r");
    sendString("AT+CSMP=17,167,0,0\r");
    sendString("AT+CMGS=\"+" .. reg.addr .. "\"\r");
    sendString(newValue);
    sendString(string.char(26));
    return true; 
end
sending_sms_via_gsm_modem.1543316842.txt.gz ยท Last modified: 2018/11/27 11:07 by akuzmuk

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki