Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:sw:01-mervis:sending-sms-hidden [2021/07/09 08:54] avsetula |
en:sw:01-mervis:sending-sms-hidden [2021/09/02 07:52] (current) avsetula |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Sending SMS ====== | + | <html><div class="version-switch"> |
+ | <a href="/en:sw:01-mervis:sending-sms-lte-hidden"><div>Patron / Axon LTE</div></a> | ||
+ | <a href="#sending_sms"><div class="actual-version">Neuron GSM</div></a> | ||
+ | </div></html> | ||
+ | |||
+ | ====== Receiving/sending SMS ====== | ||
<WRAP group> | <WRAP group> | ||
- | <WRAP half column 81%> | + | <WRAP half column 80%> |
- | [[https://www.unipi.technology/unipi-axon-m565-lte-p305|Some of our PLCs]] are equipped with LTE modem capable of sending SMS. In this tutorial we will learn how to configure such PLC and how to use function block for sending SMS. | + | [[https://www.unipi.technology/cs/unipi-neuron-s103-g-p107|Some of our PLCs]] are equipped with a GSM module that is capable of sending and receiving SMS. In this tutorial, we will learn how to configure such PLC and how to use function blocks for sending SMS. |
</WRAP> | </WRAP> | ||
- | <WRAP half column 15%> | + | <WRAP half column 16%> |
;;# | ;;# | ||
<html><span class="dev-tag dev-neuron">Neuron S103-G</span></html> | <html><span class="dev-tag dev-neuron">Neuron S103-G</span></html> | ||
Line 11: | Line 16: | ||
</WRAP> | </WRAP> | ||
- | For sending SMS over LTE modem, you don't need to configure the modem as described in [[lte-configuration-hidden|]]. Instead, you need to configure **Alarm channel**. Double click on the **PLC** in the **Left panel**. Select a **Messaging** subpanel, right click on the blank list of channels and select **Add alarm channel** from the context menu: | + | |
+ | ===== Modem configuration ===== | ||
+ | First, you need to set up communication with the modem, for this the **Alarm channel** is used. Double-click on the **PLC** in the **Left panel**. Select the **Messaging** subpanel, right-click on the blank channel list and select **Add alarm channel** from the context menu: | ||
{{ :en:sw:01-mervis:sms-gsm1.png?direct |}} | {{ :en:sw:01-mervis:sms-gsm1.png?direct |}} | ||
- | A new alarm channel will appear. By default it is filled with preconfiguration for sending emails. Click on the **Type** (now prefilled with "Smtp") and change it to **Gsm**: | + | ---- |
+ | |||
+ | A new alarm channel will appear. By default, it is set to send e-mail messages. Click on the **Type** (now prefilled with "Smtp") and change it to **Gsm**: | ||
{{ :en:sw:01-mervis:sms-gsm2.png?direct |}} | {{ :en:sw:01-mervis:sms-gsm2.png?direct |}} | ||
- | Move over to the channel's properties and change the **Port Number** to **LTE**: | + | ---- |
- | {{ :en:sw:01-mervis:sms-gsm4.png?direct |}} | + | Move over to the channel's properties and change the **Port Number** to **COM1 (TTL)**: |
- | If the SIM card is protected with a PIN code, enter it, otherwise leave empty: | + | {{ :en:sw:01-mervis:sms-gsm3.png?direct |}} |
- | {{ :en:sw:01-mervis:sms-gsm5.png?direct |}} | + | ---- |
- | Most modems (UniPi's as well) need initialization commands. Click to three-dot icon next to **AT Commands Definition**. A window will pop up: | + | If the SIM card is protected with a PIN code, enter it in the appropriate, otherwise leave it empty: |
- | {{ :en:sw:01-mervis:sms-gsm6.png?direct |}} | + | {{ :en:sw:01-mervis:sms-gsm4.png?direct |}} |
- | In the drop down menu select the correct modem. For UniPi Axon product line it is **UniPi Axon LTE**: | + | ---- |
- | {{ :en:sw:01-mervis:sms-gsm7.png?direct |}} | + | Most modems (UniPi's as well) need initialization commands. Click to three-dot icon {{:files:dialog-open_button_2.png?nolink|}} next to **AT Commands Definition**. A window will pop up: |
- | Don't forget to apply this selection by clicking on **Apply** and closing this dialog: | + | {{ :en:sw:01-mervis:sms-gsm5.png?direct |}} |
- | {{ :en:sw:01-mervis:sms-gsm8.png?direct |}} | + | ---- |
- | The channel is configured and now the changes need to be commited. Click on the **OK** in the red bar: | + | Then select the correct modem from the drop-down menu. For Unipi Neuron controllers, this is the **Unipi Neuron GSM - G510**: |
- | {{:en:sw:01-mervis:sending-sms-08-commit.png?direct|}} | + | {{ :en:sw:01-mervis:sms-gsm6.png?direct |}} |
- | To use the modem in program, look for "**SendSMS Triggered**" function block and place it into a program: | + | ---- |
- | {{:en:sw:01-mervis:sending-sms-09-place-sendsmstrig.png?direct|}} | + | Don't forget to apply this selection by clicking on **Apply** and closing this dialog: |
- | The function block expects 4 inputs and we will create a auxiliary variables for better debugging. Starting with the variable for input **channel**. Create a **string** variable and set its initial value to the name of the created alarm channel. By default it will be **alrchannel**: | + | {{ :en:sw:01-mervis:sms-gsm7.png?direct |}} |
- | {{:en:sw:01-mervis:sending-sms-10-channel-variable.png?direct|}} | + | ---- |
- | ** | + | |
- | The same we will do for the rest of the variables:** | + | |
- | * **recipient:** string variable containing a phone number in international format such as 00420777666555) | + | The channel is configured and now the changes need to be committed. Click on the **OK** in the red bar: |
- | * **message:** string variable containing the actual SMS message | + | |
- | * **trigger:** bool variable which will execute the sending of the message on **rising edge** | + | |
- | The result should look similar: | + | {{ :en:sw:01-mervis:sms-gsm8.png?direct |}} |
- | {{:en:sw:01-mervis:sending-sms-11-all-variables.png?direct|}} | ||
- | Now deploy the solution and start the debugging mode. On each change of the variable **trigger** from **False** to **True**, the message will be send: | + | ====== ====== |
+ | /* Odeslání SMS */ | ||
+ | {{page>en:sw:01-mervis:send-sms-hidden}} | ||
- | {{:en:sw:01-mervis:sending-sms-12-debugging.png?direct|}} | ||
- | If the SMS has been send correctly, the **Result** output will be **0**. Otherwise an error code will be issued and you can consult help (F1) for the given function block to determine the cause of the error. | + | ====== ====== |
+ | /* Příjem SMS */ | ||
+ | {{page>en:sw:01-mervis:receive-sms-hidden}} | ||