0

I need to extract the following data from a 3G modem:

  • The mobile network code
  • The mobile location area code
  • The connected mobile cell tower ID
  • The SIM security status (Unlocked, PIN or PUK)
  • The SIM serial number

My technique of getting data from the USB 3G modem is using AT commands over a serial interface. Does anyone know how I can gather this information? I cannot seem to find relevant AT commands to use.

Cornel Verster
  • 1,664
  • 3
  • 27
  • 55

1 Answers1

1

You need the standard 3GPP AT command specification.

Mobile network code example section 7.3: Get network name:

at+cops?

+COPS: 0,0,"Vodafone.de",2

OK

Set +COPS to return network code and get code:

at+cops=0,2
OK
at+cops?
+COPS: 0,2,"26202",6

LAC and Cell Id, section 7.2: Example using +CREG:

at+creg=2
OK
at+creg?
+CREG: 2,1, 2A9, EBA7011

OK

SIM security status, Section 8.3 eg:

AT+CPIN?
+CPIN: SIM PIN

SIM id number: You can read the IMSI with + CIMI, Section 5.5

user1725145
  • 3,993
  • 2
  • 37
  • 58
  • When I use AT+CREG?, I get the response +CREG=0,0 or +CREG=2,0 if I have written AT+CREG=2? How do I get the LAC code? Must it be connected? – Cornel Verster May 13 '14 at 09:04
  • It has to be registered on a Network and speaking to a base station, yes. You have to be a bit careful with words here. "SIM activated" means you have a valid account with an Operator. "Registered on the Network" means your device+SIM has found the network. "Connected" means that you have an open voice or data Connection. – user1725145 May 13 '14 at 13:37
  • Ok, but it replies even with +CREG=0,0 when it is "registered" (lights on modem blinking)? When it is "connected" (solid light) I can no longer access the ttyUSB0 interface, so I cannot just send it commands.. – Cornel Verster May 14 '14 at 08:35
  • That sounds wrong. The modem may expose several interfaces, are you sure you are connecting on the correct one? What do you get when you type ATI ? (you should get the modem details). – user1725145 May 14 '14 at 11:12
  • When I use ATI it does return modem information, but +CREG still only returns 0,0. I'm using a Huawei E3131B – Cornel Verster May 15 '14 at 07:44
  • Is the SIM unlocked, and does AT+COPS give you the network code while +CREG is giving 0,0? – user1725145 May 15 '14 at 09:32
  • I'm not sure if the SIM is unlocked, but I did figure out the modem is not registering even though its flashing blue (meaning it should be registered?" AT+COPS gives my network name, but AT+CREG? give 0,0 – Cornel Verster May 22 '14 at 08:32
  • Unlock the SIM using AT+CPIN="your pin number", and then check the status. AT+CPIN? should get "OK" when it's unlocked, or "SIM PIN" when it's locked. – user1725145 May 22 '14 at 11:09
  • AT+CPIN? responds with READY. CPIN="my pin" responds with an error. – Cornel Verster May 22 '14 at 11:57
  • 1
    Sorry. READY means unlocked. If the SIM is unlocked, and you've got a valid account, I don't understand why you are getting this response from AT+CREG. Can you try connecting another device, like a mobile phone for example, and try the same AT commands, maybe with the same SIM and another SIM, to convince yourself that it really does work, and try to narrow it down. – user1725145 May 22 '14 at 20:32
  • I will do that, we are getting some new SIM cards today or soon. Thanks so much for your help anyhow!! – Cornel Verster May 23 '14 at 06:55