Author Topic: GSM modem with PLC interfacing  (Read 34224 times)

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
GSM modem with PLC interfacing
« on: May 10, 2011, 06:31:13 AM »
Hello i was looking to interface the GSM Modem with the FMD-8810 PLC.The basic idea is to monitor a range of sensors with the FMD88-10 and put on the digital output if any of the sensors cross a particular threshold value.Now i was wondering how do i send this as an alarm message(saying that the light level is low for example) to a GSM mobile.Do i need a gsm modem with many inputs, where each input of the gsm modem is connected to each digital output of the plc? Can this modem which i have attached serve this purpose.how do i go about this? thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #1 on: May 10, 2011, 08:50:26 AM »
The sensors should be connected to the PLC's digital or analog inputs.

Your GSM modem should be something that supports a RS232 port in order to interface to the FMD88-10 PLC. The PLC can then control the GSM modem to send SMS messages or dial up land line modem etc. See the following discussion:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=301

If your purpose is to allow the PLC to connect to the network or Internet a better choice today would be to use a 3G router which lets you connect the PLC to the Internet via 3G network. See the following document:

http://www.tri-plc.com/documents/ConnectingTo3G.pdf
« Last Edit: May 12, 2011, 08:39:23 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #2 on: May 13, 2011, 08:05:29 AM »
I have not understood much from that post.
Yes i connect the modem VIA RS 232 to the plc, now the question is do i have to write the AT+CMGS command for sending a text in a function in the ladder diagram? For eg if digital output =1 then send "alert message" to the GSM Modem can be done by this?Kindly let me know if you have any better examples.Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #3 on: May 13, 2011, 11:43:23 AM »
Your GSM modem can receive AT command via its RS232 port.

The PLC can send AT command to the GSM modem via its RS232 port using the PRINT #1 command.

So what you need to do is to format the correct AT command that the modem understands, and let the PLC program send it out.

The PLC can be programmed to send the string to the Modem anytime based on the logic condition.

In your example if digital output =1 you want to send something to the GST modem then create a ladder diagram:
      Output1                   sendSMS
|-------| |------------------{dCusF}

In the function "sendSMS" you will run the PRINT #1 statements to send out the AT command to make it send SMS.
« Last Edit: May 13, 2011, 11:44:06 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #4 on: May 24, 2011, 06:42:02 AM »
OK i used the following commands to send SMS(hello) from hyperterminal of pc
at+cmgf=1
AT+CMGS="+31638740161" <ENTER on the keyboard>
Hello  and then <CTRL-Z on the keyboard>

The same can commands can be saved as the send sms function as this

PRINT #1 "AT+CMGF="+"1"
PRINT #1 "AT+CMGS="+CHR$(34)+"+447584133750"+CHR$(34)
PRINT #1 "HELLO"

But my problem is how do i represent the <CTRL-Z> in the function

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #5 on: May 24, 2011, 07:36:46 AM »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #6 on: May 24, 2011, 09:22:13 AM »
PRINT #1 "AT+CMGF="+"1"
PRINT #1 "AT+CMGS="+CHR$(34)+"00447584133453"+CHR$(34)
PRINT #1 "HELLO"+CHR$(60)+CHR$(26)+CHR$(62)
 This is what i send to COM1 but dont get a response on my phone,however when i send the same commands using hyper terminal i can send the message.Once i transfer the program i simulate it(continue run).What might be the problem?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #7 on: May 24, 2011, 11:10:45 AM »
What are "CHR$(60)+CHR$(26)+CHR$(62)"?

Ctrl-Z is CHR$(26)

So if you want to send a single Ctrl-Z character, send it using just the CHR$(26)
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #8 on: May 25, 2011, 05:28:35 AM »
Oh yes ,have rectified that.But not getting the SMS sent to the mobile.Is it a problem with the RS232 cable?I have a rs 232 with db9 male ends at boths sides.In your manual you say that to connect COMM1 to another DCE device (e.g., a modem), you need to make a special cable
which swaps the transmit and receive signals.Do i need to do this?

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #9 on: May 25, 2011, 07:54:31 AM »
Also the function(send SMS) is given as below
PRINT #1 "AT+CMGF="+"1"
PRINT #1 "AT+CMGS="+CHR$(34)+"+447584133758"+CHR$(34)
PRINT #1 "HELLO"+CHR$(26)
      Clock 1min                  sendSMS
|-------| |------------------{dCusF}

Is this code alright? It does not seem to be sending a message to my phone.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #10 on: May 25, 2011, 08:27:48 AM »
Yes if the RS232 on your modem is female DB9, and since the RS232 on the FMD88-10 is also female DB9, you need a DB9 male to DB9 male cable that is connected as null modem:

 2-3
 3-2
 4-6
 6-4
 5-5
 
You probably can buy a null modem cable off-the shelf. Otherwise you will need to make a cable that swap the signal for you.

Please refer to the following thread on some discussion regarding sending SMS via GSM modem:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=301

Email: support@triplc.com
Tel: 1-877-TRI-PLCS

sid80555

  • Newbie
  • Posts: 36
  • I'm a llama!
    • View Profile
Re:GSM modem with PLC interfacing
« Reply #11 on: May 25, 2011, 10:36:53 AM »
Hello i have created the ladder logic as shown in the attached diagram.
The function ds    is PRINT #1 "AT+CMGF="+"1"
The function sd is PRINT #1 "AT+CMGS="+CHR$(34)+"+447584133758"+CHR$(34)
The function vb is PRINT #1 "HELLO"+CHR$(26)

The problem is that i get a text message as
at+cmgf=1
at+cmgs="+447584133758"
hello

How do i get rid of the first 2 lines and just get hello as the message on the Mobile.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:GSM modem with PLC interfacing
« Reply #12 on: May 25, 2011, 09:43:11 PM »
That you will have to consult your GSM modem manual to understand why it is relaying the first two statements (which I assume are some configuration) to the text message. It has nothing to do with the PLC. You have programmed the PLC to send out the text and that's all it does.

Maybe other users who have experience with GSM modem can comment on this.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS