Maker Pro
Maker Pro

25 I/O and 2 x analogue gsm controller

bowlingo

Jun 29, 2011
40
Joined
Jun 29, 2011
Messages
40
Hi all,

I have build a system of which currently uses 3 of these

http://gsmalarmsystem.en.alibaba.co..._RTU_control_system_King_Pigeon_RTU_5011.html

each of these units has its own sim card so you need to know which controllers number to send the individual commands to

What I am looking for is a sms controller that contains 1 x sim card, has 25 or so 0V inputs, 25 or so relay drivable outputs and 2 x seperate analogue inputs that can measure the 2 x probes I am using in mA and the values can be sent to the phone on request.

I have tried 3 x companies and aparently there is nothing off the shelf that has this amount of inputs and outputs.

I am very happy with the 3 x units I am currently using its just a nuisance to know which no's to send the commands to.

It is for a completed system that I am going to demo in a couple of weeks time if however it takes off like im very confident it will it wont be very good having 3 different sims in it.

Another idea might be to get a phone that knows which phone numbers to send the sms commands to i.e "turn on light" and the phone or controller knows that text message goes to number phone no 12345678

Any help on this is very welcomed.

Thanks
 
Last edited:

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
hi bowlingo

ummm your link doesnt work try againg and see if some one can help you :)

cheers
Dave
 

OLIVE2222

Oct 2, 2011
690
Joined
Oct 2, 2011
Messages
690
Hi, such a amount of I/O will indeed no be available of the shelf. I don't believe you can build something from scratch in a couple of week. you can have a look on the following links

http://www.mikroe.com/eng/categories/view/19/gsm-gprs-tools/

http://www.olimex.com/dev/index.html

for both you need to write a firmware. As the use common microcontroler you can expand it as you want.

If you start from componant level you can have a look on Telit and Siemens (TC65i, TC75i) module. I have used both of them, the siemens can be programmed in Java.

Olivier
 

bowlingo

Jun 29, 2011
40
Joined
Jun 29, 2011
Messages
40
Hi all,



I have contacted someone and they are saying 2 of these with the Telit GM862 GSM/GPRS module will do exactly what I am after..



http://www.mikroe.com/eng/products/view/419/picplc16-v6-plc-system/



For them to code it it will cost a lot of money but for the 2 boards and gsm module it will be around £300



I am wondering how hard it will be for me to code this...bearing in mind over never coded anything before?



Thanks
 

OLIVE2222

Oct 2, 2011
690
Joined
Oct 2, 2011
Messages
690
Well if you choice the basic language compiler and knowing that they have good documentation it's should be affordable. You can try before buy by downloading they compiler evaluation version.


Here under the GSM example provided on they web site to have an idea.


' *
' * Project name:
' GSM_Test
' * Copyright:
' (c) MikroElektronika, 2010.
' * Revision History:
' 20100210:
' - initial release
' * Description:
' This is a simple project which demonstrates the use of Telit GSM/GPRS module with PICPLC16v6.
' The example receives the SMS message in specific format and toggles the relay specified in the message.
' The example reads received SMS from location 1 in message inbox, parse recived message, toggles
' requested relay and deletes message from inbox.
' * Test configuration:
' MCU: PIC18F4520
' http://ww1.microchip.com/downloads/en/DeviceDoc/39631E.pdf
' Dev.Board: PICPLC16 v6
' http://www.mikroe.com/en/tools/picplc16-v6/
' Oscillator: HS, 8.0000 MHz
' Ext. Modules: Telit GM862-QUAD GSM module
' SW: mikroBasic PRO for PIC
' http://www.mikroe.com/en/compilers/mikroc/pro/pic/
' * NOTES:
' - Turn on GSM switches SW11.3, SW11.4, SW11.5, SW11.6, SW11.7 and SW11.8.
' - Turn on Relays on PORTB and PORTD, switches SW7 and SW8
' - SMS inbox on your SIM card should be initialy empty
' - Due different mobile operators some adjustments may be required, please consult Telit AT commands
' reference guide at http://www.telit.com/module/infopool/download.php?id=542
' - The SMS message that module receives should be in format: "RelayXX" (it is case sensitive and without quotes)
' where XX is relay number from 01 to 16.
' For example "Relay03" message toggles relay 3 which is on RB2 pin of PORTB port. "Relay12" togles
' relay 12 on RD3 pin of PORTD, and so on...
'
' *

program GSM_Test

' set of AT commands
const atc0 = "AT" ' every GSM comand starts with "AT"
const atc1 = "ATE0" ' disable echo

' sms AT commands
const atm1 = "AT+CMGF=1" ' Command for setting SMS text mode
const atm2 = "AT+CMGR=1" ' Command for reading message from location 1 from inbox
const atm3 = "AT+CMGD=1,4" ' Erasing all messages from inbox


' responses to parse
const GSM_OK = 0
const RELAY_OK = 1

dim parse_type as byte ' Determins parsing type, OK response or SMS message
dim relay_no as byte[3] ' Message that contains relay number
dim relay as byte ' Relay number

dim gsm_state as byte
dim response_rcvd as byte
dim responseID, response as short

' uart rx interrupt handler
sub procedure interrupt()
dim tmp as byte

if (PIR1.RCIF = 1) then ' do we have uart rx interrupt request?
tmp = UART1_Read() ' get received byte

if(parse_type<>RELAY_OK) then ' If we are parsing OK message
' process reception through state machine
' we are parsing only "OK" response
select case gsm_state

case 0
response = -1 ' clear response
if (tmp = "O") then ' we have "O", it could be "OK"
gsm_state = 1 ' expecting "K"
end if

case 1
if (tmp = "K") then ' we have "K" ->
response = GSM_OK ' we have "OK" response
gsm_state = 2 ' expecting CR+LF
else
gsm_state = 0 ' reset state machine
end if

case 2
if (tmp = 13) then ' we have 13, it could be CR+LF
gsm_state = 3 ' expecting LF
else
gsm_state = 0 ' reset state machine
end if

case 3
if (tmp = 10) then ' we have LF, response is complete
response_rcvd = 1 ' set reception flag
responseID = response ' set response ID
end if
gsm_state = 0 ' reset state machine
case else
gsm_state = 0 ' unwanted character
' reset state machine
end select
end if


if(parse_type=RELAY_OK)then ' Parsing received message
select case gsm_state
case 0
response = -1 ' clear response
if (tmp = "R") then ' we have "R"
gsm_state = 10 ' expecting "e"
end if
case 10
if (tmp = "e") then ' we have "e"
gsm_state = 11 ' expecting "l"
else
gsm_state = 0 ' reset state machine
end if
case 11
if (tmp = "l") then ' we have "l"
gsm_state = 12 ' expecting "a"
else
gsm_state = 0 ' reset state machine
end if
case 12
if (tmp = "a") then ' we have "a"
gsm_state = 13 ' expecting "y"
else
gsm_state = 0 ' reset state machine
end if
case 13
if (tmp = "y") then ' we have "y"
gsm_state = 14 ' expecting first digit
else
gsm_state = 0 ' reset state machine
end if
case 14
relay_no[0] = tmp ' setting first digit into array
gsm_state = 15 ' expecting second digit
case 15
relay_no[1] = tmp ' setting first digit into array
relay_no[2] = 0 ' setting null
response = RELAY_OK ' we have relay response
response_rcvd = 1 ' set reception flag
responseID = response ' set response ID
gsm_state = 0 ' reset state machine
case else ' unwanted character
gsm_state = 0 ' reset state machine
end select
end if
end if
end sub


' send ATC command
sub procedure send_atc(dim const s as ^char)
while(s^ <> 0)
UART1_Write(s^)
inc(s)
wend
UART1_Write(0x0D)
end sub

' get GSM response, if there is any
sub function get_response() as short
if (response_rcvd <> 0) then
response_rcvd = 0
result = responseID
else
result = -1
end if
end sub

' wait for GSM response
sub procedure wait_response(dim const rspns as byte)
while (get_response() <> rspns)
wend
end sub

' pause
sub procedure wait()
Delay_ms(3000)
end sub

' Converting relay number text into byte
sub function Get_Relay_Number() as byte
dim rn as byte
if(relay_no[0] = 48)then ' If first number is 0
rn = relay_no[1]-48
result = rn
exit
end if
if(relay_no[0] = 49)then ' If first number is 1
rn = relay_no[1]-38
result = rn
end if
end sub

main:
parse_type = GSM_OK

ADCON1 = 0x0F ' All AN pins as digitall
CMCON = 0x07 ' Turn off comparators

' set RTS pin to zero, we will use only RX i TX
TRISE = 0
LATE = 0

TRISB = 0
TRISC = 0
TRISD = 0
LATB = 0
LATC = 0
LATD = 0

' enable uart rx interrupt
RCIE_bit = 1
PEIE_bit = 1
GIE_bit = 1

' turn on module
LATC2_bit = 1
delay_ms(2000)
LATC2_bit = 0

UART1_init(19200) ' initialize USART module

Wait() ' wait for the GSM module to initialize it self

' negotiate baud rate
while TRUE
send_atc(@atc0) ' send "AT" string until gsm sets up its baud rade
Delay_ms(100) ' and gets it correctly
if (get_response() = GSM_OK) then ' if gsm says "OK" on our baud rate we got it
break
end if
wend

' disable command echo
send_atc(@atc1)
wait_response(GSM_OK)

' set text mode
send_atc(@atm1)
wait_response(GSM_OK)

while TRUE
parse_type = RELAY_OK
send_atc(@atm2) ' Read SMS message on location 1
if (get_response() = RELAY_OK) then ' If we have OK response
relay = Get_Relay_Number() ' Get relay number

if(relay <= 8) then ' If relay number is less or equal 8
LATB = PORTB xor (1 << (relay-1)) ' Toggle relay on PORTB
else
LATD = PORTD xor (1 << (relay - 9)) ' Toggle relay on PORTD
end if

while TRUE ' Make sure that we deleted messages
parse_type = GSM_OK
send_atc(@atm3) ' Delete all messages
if (get_response() = GSM_OK) then ' If messages are deleted
break ' break from while
end if
wait()
wend

end if
wait()
wend
end.
 
Top