GSM monitoring (temperature, etc)

Posted on
  • Hi,
    Some time ago (before espruino 1v30) I tried to port my Nokia based GSM temperature monitoring system to espruino. Just for fun because my linux based solution worked fine.
    Unfortunately it was a failure because I was not able to implement the Nokia's FBUS protocol on 8KB STM32VLDiscovery board. I simply ran out of memory...
    The other day I bought an old Sony Ericcsson T630 which has nice serial interface based on AT commands. Here you can find similar models (they may have slightly more difficult SMS encoding scheme so be warned!). These phones are really cheap - a couple of euros.
    http://pinouts.ru/CellularPhones-P-W/eri­cs_t28_pinout.shtml
    Here you can see an example how easy you can send an SMS:

    var period=20
    var ms=""
    var phone="+48999999999"
    
    function readTemp(){
        return 20   //fake read just to show the idea
    }
    
    function sendSMS(msg){
        setTimeout(function(){Serial2.println("A­T+CMGS=\x22" + phone + "\x22")},500)
        setTimeout(function(){Serial2.println(ms­g)},1000)
        setTimeout(function(){Serial2.print("\x1­a")},1500)
    }
    
    function hMon(type){
        temp=readTemp()
        sendSMS(type+":"+temp+"C")
    }
    
    function handler(c){
        ms=ms+c
        if (c=='\n'){
            console.log(ms)
            ms=""
        }
    }
    
    Serial2.setup(9600)
    Serial2.onData(function (d) {handler(d.data)})
    setTimeout(function(){Serial2.println('A­T&F')},500)
    setTimeout(function(){Serial2.println('A­T+CMGF=1')},1000)
    
    setInterval(function(){hMon("TEMPERATURE­ IS: ")},period*1000)
    

    The code above is really rough (it's not an example of good javascript style, neither good programming). It's purpose is to show the idea of using cellphone with espruino.
    Bogdan

  • Some usefull AT commands:
    Commands:
    AT&F (Reset to factory settings)
    AT+CMGF=1 (Turn off the PDU mode)
    AT+CPMS="ME" (Save SMS messages to phone memory, not SIM)
    AT+CNMI=,1 (When SMS message received - send notification to serial)
    To send SMS: AT+CMGS="+33273022", then type your message. When done enter Ctrl-Z
    To receive SMS: when phone recieves SMS, it sends: +CMGL: [no]. no is the SMS number, e.g. +CMGL: 1
    To view SMS: AT+CMGR=[no]
    To delete SMS: AT+CMGD=[no]

    Bogdan

  • This is awesome - thanks! I've got a T68i kicking around - I wonder if that'll handle it.

    Come to think of it - it has bluetooth I think. I wonder if the bluetooth module would connect to it (as a host) and would still be able to send the commands?

  • T68i has the same DCU-11 interface as the T630 (uart interface with unfriendly connector, some people managed to solder 3 cables /rx, tx, gnd/ directly to the phone). I bought USB to DCU-11 cable and simply cut off the USB part and soldered serial cables to the plug).
    The bad news is that you need to use PDU mode (7 bit encoding scheme also used by the Nokia FBUS):
    http://twit88.com/home/utility/sms-pdu-e­ncode-decode
    Bogdan

  • It seems that bluetooth can be used for accessing GSM modem:
    http://bluehack.elhacker.net/downloads/s­pec/t68i_at_commands_dev_guidelines.pdf

    Bogdan

  • Try to use:
    AT+CMGF=?

    to see if '1' value is available. "1" means that PDU mode can be disabled. The default is usually '0'
    Bogdan

  • Hi All

    I've recently bought a second hand T68i just for this purpose. Not sure when I'll get around to it ... but I'll feedback when I do.

    Martin

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

GSM monitoring (temperature, etc)

Posted by Avatar for BogdanG @BogdanG

Actions