neiltechspec
Senior Member
Found a Neoway M590 GSM SMS Text Module on fleabay for £7.90.
Came setup for 9600baud, uses TTL simple AT commands for comms & runs off 3.3v
It's really easy to use, but suggest the datasheets are studied as well.
Neil
Came setup for 9600baud, uses TTL simple AT commands for comms & runs off 3.3v
It's really easy to use, but suggest the datasheets are studied as well.
Code:
#rem
M590 GSM Texter 9600baud
V1.0 Sept 2016
On Power Up module sends :-
MODEM:STARTUP then
+PBREADY when ready for AT commands
Send AT+CMGF=1 for plain text mode
Send AT+CSCS="GSM" for GSM default alphabet
Delete all stored messages
AT+CMGD=0,4
OK
Send Network Check
AT+CREG?
response if registered
+CREG: 0,1
To send SMS Text
AT+CMGS="07702XXXXXX"<CR>(0x0D) to send,
when the indicating symbol ‘>’
appears, input SMS content
"Test Message"
CTRL+Z(0x1A) to send.
Data to M590 = C.2
Data from M590 = C.3
Ring from M590 = C.4
Input1 on B.1
Input2 on B.2
Input3 on B.3
Input4 on B.4
LED on B.5
#endrem
#picaxe 14M2
#no_data
#terminal 19200
init:
setfreq m16
low B.5
pause 4000
sertxd("Waiting for Modem Init",13,10)
serin C.3,T9600_16,("+PBREADY")
sertxd("Modem Initialised",13,10)
pause 4000
serout C.2,T9600_16,("AT+CMGF=1",13)
pause 4000
serout C.2,T9600_16,("AT+CSCS=",34,"GSM",34,13)
pause 4000
serout C.2,T9600_16,("AT+CMGD=0,4",13)
gosub check
main:
if pinB.1 = 0 then gosub alarm1
if pinB.2 = 0 then gosub alarm2
if pinB.3 = 0 then gosub alarm3
if pinB.4 = 0 then gosub alarm4
pause 1000
gosub check
alarm1:
serout C.2,T9600_16,("AT+CMGS=",34,"07702XXXXXX",34,13)
pause 4000
serout C.2,T9600_16,(34,"Doorbell",34)
pause 4000
serout C.2,T9600_16,(26)
sertxd("SMS 1 sent",13,10)
pause 40000
do until pinB.1=1 loop
return
alarm2:
serout C.2,T9600_16,("AT+CMGS=",34,"07702XXXXXX",34,13)
pause 4000
serout C.2,T9600_16,(34,"House Alarm",34)
pause 4000
serout C.2,T9600_16,(26)
sertxd("SMS 2 sent",13,10)
pause 40000
do until pinB.2=1 loop
return
alarm3:
serout C.2,T9600_16,("AT+CMGS=",34,"07702XXXXXX",34,13)
pause 4000
serout C.2,T9600_16,(34,"Alarm 3",34)
pause 4000
serout C.2,T9600_16,(26)
sertxd("SMS 3 sent",13,10)
pause 40000
do until pinB.3=1 loop
return
alarm4:
serout C.2,T9600_16,("AT+CMGS=",34,"07702XXXXXX",34,13)
pause 4000
serout C.2,T9600_16,(34,"Alarm 4",34)
pause 4000
serout C.2,T9600_16,(26)
sertxd("SMS 4 sent",13,10)
pause 40000
do until pinB.4=1 loop
return
check:
pause 4000
serout C.2,T9600_16,("AT+CREG?",13)
serin [4000],C.3,T9600_16,("+CREG: "),b1,b2,b3
if b1 = 48 and b3 = 48 then
sertxd("Not Searching",13,10)
low B.5
goto check
endif
if b1 = 48 and b3 = 49 then
sertxd("Network ok",13,10)
high B.5
goto main
endif
if b1 = 48 and b3 = 50 then
sertxd("Refused",13,10)
low B.5
goto check
endiF
if b1 = 48 and b3 = 51 then
sertxd("Searching",13,10)
low B.5
goto check
endif
sertxd("Network Invalid response",13,10)
goto check
Last edited: