User Tools

Site Tools


raspberrypi:modem3g

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
raspberrypi:modem3g [2013/05/29 19:26] – created rlunaroraspberrypi:modem3g [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Connect with a 3G modem with command line ====== ====== Connect with a 3G modem with command line ======
  
-I have a modem Huawei E1752Cu HSPA. What I want to do is the following: 1) send and receive an SMS using the modem and 2) establish a broadband connection using the modem+I have a modem Huawei E1752Cu HSPA, and I want it to connect to the internet.
  
-Because I don't have a concrete idea of what to do next, I am exploring both sides: 1) using sms to communicate with the raspberry and 2) using mobile broadband to communicate with the raspberry. The fares of having a mobile connected all the time (plain fare are about 15 euros/month) and in the case of the sms you only pay the sms you send, so in some cases is advisable using only sms. +===== Detect the vendor and the product =====
  
-===== Setup modem ===== +After connecting the modem, perform a lookup of the syslog. It will show you the vendor and the product:
- +
-Install modem-manager:+
  
 <code> <code>
-# sudo apt-get install modemmanager+Feb 28 21:18:39 raspi kernel: [ 1432.602724] usb 1-1.2: new full-speed USB device number 12 using dwc_otg 
 +Feb 28 21:18:39 raspi kernel: [ 1432.737215] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1004 
 +Feb 28 21:18:39 raspi kernel: [ 1432.737239] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 
 +Feb 28 21:18:39 raspi kernel: [ 1432.737250] usb 1-1.2: Product: HUAWEI Mobile 
 +Feb 28 21:18:39 raspi kernel: [ 1432.737259] usb 1-1.2: Manufacturer: HUAWEI Technologies
 </code> </code>
  
-it will detect the modemdo necessary loading of modules and things like that. It is advisable to use it as a service, so when plugin the modem it will be authomatically configured+Soin my case the vendor id is 12d1 and the product is 1004
  
-I reommend to run it the ''--debug'' option enabled in order to see what is happening behind the scenes: +===== Install usb_modeswitch =====
  
 <code> <code>
-root@raspberrypi:/home/pimodem-manager  --debug  +apt-get install usb-modeswitch
-modem-manager[16723]: <info>  [1359305305.945270] [main.c:167] main(): ModemManager (version 0.5.2.0) starting... +
-modem-manager[16723]: <info>  [1359305305.993128] [mm-manager.c:120] load_plugin(): Loaded plugin Option +
-modem-manager[16723]: <info>  [1359305306.002902] [mm-manager.c:120] load_plugin(): Loaded plugin ZTE +
-modem-manager[16723]: <info>  [1359305306.013057] [mm-manager.c:120] load_plugin(): Loaded plugin Huawei +
-modem-manager[16723]: <info>  [1359305306.020689] [mm-manager.c:120] load_plugin(): Loaded plugin X22X +
-modem-manager[16723]: <info>  [1359305306.028594] [mm-manager.c:120] load_plugin(): Loaded plugin Gobi +
-modem-manager[16723]: <info>  [1359305306.036247] [mm-manager.c:120] load_plugin(): Loaded plugin Nokia +
-modem-manager[16723]: <info>  [1359305306.046679] [mm-manager.c:120] load_plugin(): Loaded plugin Samsung +
-modem-manager[16723]: <info>  [1359305306.054036] [mm-manager.c:120] load_plugin(): Loaded plugin Linktop +
-modem-manager[16723]: <info>  [1359305306.064143] [mm-manager.c:120] load_plugin(): Loaded plugin Ericsson MBM +
-modem-manager[16723]: <info>  [1359305306.072771] [mm-manager.c:120] load_plugin(): Loaded plugin Wavecom +
-modem-manager[16723]: <info>  [1359305306.081609] [mm-manager.c:120] load_plugin(): Loaded plugin Novatel +
-modem-manager[16723]: <info>  [1359305306.091642] [mm-manager.c:120] load_plugin(): Loaded plugin Option High-Speed +
-modem-manager[16723]: <info>  [1359305306.101939] [mm-manager.c:120] load_plugin(): Loaded plugin Sierra +
-modem-manager[16723]: <info>  [1359305306.110765] [mm-manager.c:120] load_plugin(): Loaded plugin Generic +
-modem-manager[16723]: <info>  [1359305306.118949] [mm-manager.c:120] load_plugin(): Loaded plugin SimTech +
-modem-manager[16723]: <info>  [1359305306.127009] [mm-manager.c:120] load_plugin(): Loaded plugin MotoC +
-modem-manager[16723]: <info>  [1359305306.134973] [mm-manager.c:120] load_plugin(): Loaded plugin Longcheer +
-modem-manager[16723]: <info>  [1359305306.142911] [mm-manager.c:120] load_plugin(): Loaded plugin AnyData +
-modem-manager[16723]: <debug> [1359305306.203809] [mm-manager.c:491] try_supports_port(): (Huawei): (ttyUSB1) deferring support check+
 </code> </code>
  
-Many lines will evidence where is the modem located: +===== Configure the product and the vendor =====
  
-<code> +Then open the modem definition file, which in my case is ''/usb/share/usb_modeswitch/configPack.tar.gz'' 
- +and then copy one existing similar to ours. In my case, I've found the 12d1:1003, so I've  
-modem-manager[16723]: <debug> [1359305306.394255] [mm-at-serial-port.c:333] debug_log(): (ttyUSB0): --> 'AT+GCAP<CR>' +copied it to create my own configuration of modeswitch: 
-modem-manager[16723]: <debug> [1359305307.099166] [mm-at-serial-port.c:333] debug_log(): (ttyUSB0): <-- 'AT+GCAP+
-modem-manager[16723]: <debug> [1359305307.102651] [mm-at-serial-port.c:333] debug_log(): (ttyUSB0): <-- '<CR><CR><LF>+CME ERROR: SIM PIN required<CR><LF>' +
- +
-</code> +
- +
-In my case is /dev/ttyUSB0.  +
- +
- +
-===== Send and receive SMS ===== +
- +
-My next step is to send and receive a test sms. First, I will install minicom to do the test directly typing the AT commands to the modem. +
  
 <code> <code>
-# sudo apt-get install minicom+cp 12d1:1003 /etc/usb-modeswitch.d/12d1:1004
 </code> </code>
  
-<code> +So, after that we will see that the modem is recognized.
-# minicom --device /dev/ttyUSB0 +
-</code>+
  
  
-It is advisable to check out these pages in order to know the basic AT commands to do the task:+===== Install wvdial and ppp =====
  
-  * [[http://www.shapeshifter.se/2008/04/30/list-of-at-commands/]] - Interesting to make a connection to the internet +The configuration for me resulted as
-  * [[http://www.developershome.com/sms/atCommandsIntro.asp]] +
- +
-==== Enter the pin, check pin status, etc ==== +
- +
-See pin status+
  
 <code> <code>
-AT+CPIN? +[Dialer Defaults] 
-+CPIN: SIM PIN   # it needs pin of the SIM +Modem Type = USB Modem 
- +Phone = *99# 
-OK+ISDN = 0 
 +Username = "pepephone" 
 +Password = "pepephone" 
 +Stupid Mode = 1 
 +New PPPD = yes 
 +Modem = /dev/ttyUSB0 
 +Baud = 460800 
 +Init1 = ATZ 
 +Init2 = AT+CPIN="YOUR-PIN-CODE-HERE" 
 +Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 
 +Init4 = AT+CGDCONT=1,"IP","gprs.pepephone.com" 
 +Auto DNS = 1 
 +Dial Command = ATDT 
 +Carrier Check = yes 
 +Stupid Mode = 1
 </code> </code>
  
-Enter pin: 
  
-<code> +This was the most difficult part, because It requested me to guess what the configuration  
-AT+CPIN=9999 # put your pin here +optimum for the modem. 
-OK +
-</code>+
  
-==== Network registration ====+In "Modem", you have to select the device of the modem, after it is connected. 
  
-Check out network registration and register into network if neccesary:+The date "Phone", "Username", "Password", and Init*. The Init* sequence cost me because you have to  
 +guess the at commands that suits your modem.
  
-<code> 
-AT+CREG? 
-+CREG: 0,5   # 5 means connected 
-</code> 
  
-Description of the values: 
  
-<n> +===== Send an sms =====
- +
-  * Disable unsolicited status callback. +
-  * Enable unsolicited status callback, +CREG: <stat> +
-  * Enable unsolicited status callback, +CREG: <stat>,[,<lac>,<ci>[,<AcT>]] +
- +
-<stat> +
- +
-  * Not registered, not searching +
-  * Registered to home network +
-  * Not registered, searching for network +
-  * Registration denied +
-  * Registered, roaming +
- +
-You can change the status with the following command:  +
- +
-<code> +
-AT+CREG=+
-</code> +
- +
-==== Send an sms ====+
  
 There are many ways to send an sms. You can send it directly, write first the message into the memory of the modem, etc... There are many ways to send an sms. You can send it directly, write first the message into the memory of the modem, etc...
Line 165: Line 116:
  
  
-==== Lista de operadores moviles ====  
- 
-<code> 
-AT+CGDCONT? 
-</code> 
- 
-Y usamos uno:  
- 
-<code> 
- 
-AT+CGDCONT=1 
-</code> 
- 
- 
- 
-===== Connect to internet ===== 
- 
-INSTALAMOS PPP Y WDIAL:  
- 
-<code> 
-# sudo apt-get install wvdial ppp 
-</code> 
- 
-~~DISQUS~~ 
  
raspberrypi/modem3g.1369848379.txt.gz · Last modified: 2022/12/02 22:02 (external edit)