Saturday, February 2, 2013

Nokia CS 12 GSM Modem Quick Notes

To test the Raspberry Pi as a text (SMS) message device for home monitoring I bought a used Nokia CS-12 USB GSM modem and a gophone SIM card via Amazon.

I set up the SIM card account using AT&T's web pages, setting up an account and buying a 1000 SMS message package for $10.

Windows 7

To use it in Windows 7 I ran the install program on the USB modem. It appeared as a serial device (com21) when plugged in, and communication could be had via putty. Some stuff id different from the Option Icon modem, mainly there is no way I could find to get the ICCID number from the SIM card using 'AT' commands.

Ubuntu

On Ubuntu the modem did not get handled by usb_modeswitch so no /dev/tty* entries were created for use in communicating with it. After some hours of frustration I downloaded the new version (1.2.5) of the program and did a make install, which failed because usb.h was missing. So I did an 'sudo apt-get install libusb-dev' to get a new library and that fixed the install. After the install, plugging in the modem resulted in devices /dev/ttyACM0 and /dev/ttyACM1.

A quick test using 'screen' ('screen /dev/ttyACM0') to connect to the modem as a serial device was successful (a few 'AT' commands worked as expected.)

Raspberry Pi


Download program:

$ sudo apt-get install usb-modeswitch

Add lines to usb rules file: /lib/udev/rules.d/40-usb_modeswitch.rules:

# Nokia CS-12  zouck 2/1/2013
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0618", RUN+="usb_modeswitch '%b/%k'"


Add file named 0421:0618 to /usr/share/usb_modeswitch. This can be a copy of the file 0421:0610 with 0610 changed to 0618. The same mode change string seems to work fine:


File 0421:0618:


# Nokia CS-12

DefaultVendor=  0x0421
DefaultProduct= 0x0618

TargetVendor=  0x0421
# Changed this from 0618 due to debug output indicating resulting target product
# is 0619.
TargetProduct= 0x0619

MessageContent="5553424312345678000000000000061b000000020000000000000000000000"



Turn on debugging by setting config file line in /etc/usb_modeswitch.conf:

...

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=1
...

Log will be in file:

/var/log/usb_modeswitch_1-1.3.3:1.0

The log says the modeswitch may have failed, but it seemed to create the right /dev/ttyACM0 and 1 files and they seemed to work.

I used minicom from the command line on the Raspberry Pi to communicate AT commands to the modem:

$ minicom /dev/ttyACM0

Welcome to minicom 2.6.1

OPTIONS: I18n 
Compiled on Apr 28 2012, 19:24:31.
Port /dev/ttyACM0

Press CTRL-A Z for help on special keys

at
OK






No comments:

Post a Comment