linux:modem3g
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
linux:modem3g [2013/01/27 18:13] – rlunaro | linux:modem3g [2013/05/19 18:57] – rlunaro | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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. | ||
+ | |||
+ | 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/ | ||
+ | |||
+ | ===== Setup modem ===== | ||
+ | |||
+ | Install modem-manager: | ||
+ | |||
+ | < | ||
+ | # sudo apt-get install modemmanager | ||
+ | </ | ||
+ | |||
+ | it will detect the modem, do 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. | ||
+ | |||
+ | I reommend to run it the '' | ||
+ | |||
+ | < | ||
+ | root@raspberrypi:/ | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | </ | ||
+ | |||
+ | Many lines will evidence where is the modem located: | ||
+ | |||
+ | < | ||
+ | |||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | modem-manager[16723]: | ||
+ | |||
+ | </ | ||
+ | |||
+ | In my case is / | ||
+ | |||
+ | |||
+ | ===== 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. | ||
+ | |||
+ | < | ||
+ | # sudo apt-get install minicom | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # minicom --device / | ||
+ | </ | ||
+ | |||
+ | |||
+ | It is advisable to check out these pages in order to know the basic AT commands to do the task: | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ==== Enter the pin, check pin status, etc ==== | ||
+ | |||
+ | See pin status: | ||
+ | |||
+ | < | ||
+ | AT+CPIN? | ||
+ | +CPIN: SIM PIN # it needs pin of the SIM | ||
+ | |||
+ | OK | ||
+ | </ | ||
+ | |||
+ | Enter pin: | ||
+ | |||
+ | < | ||
+ | AT+CPIN=9999 # put your pin here | ||
+ | OK | ||
+ | </ | ||
+ | |||
+ | ==== Network registration ==== | ||
+ | |||
+ | Check out network registration and register into network if neccesary: | ||
+ | |||
+ | < | ||
+ | AT+CREG? | ||
+ | +CREG: 0,5 # 5 means connected | ||
+ | </ | ||
+ | |||
+ | Description of the values: | ||
+ | |||
+ | <n> | ||
+ | |||
+ | * Disable unsolicited status callback. | ||
+ | * Enable unsolicited status callback, +CREG: < | ||
+ | * Enable unsolicited status callback, +CREG: < | ||
+ | |||
+ | < | ||
+ | |||
+ | * 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: | ||
+ | |||
+ | < | ||
+ | AT+CREG=1 | ||
+ | </ | ||
+ | |||
+ | ==== 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... | ||
+ | |||
+ | **Direct sending** | ||
+ | |||
+ | < | ||
+ | AT+CMGF=1 | ||
+ | OK | ||
+ | AT+CMGS=" | ||
+ | > text your message here, and end the message with ^Z (control+z) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | AT+CMGF=1 | ||
+ | AT+CMGW=" | ||
+ | > A simple demo of SMS text messaging. | ||
+ | |||
+ | +CMSS: 1 # the ID of the message in memory | ||
+ | |||
+ | AT+CMSS=1 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Read a message ==== | ||
+ | |||
+ | To list all the messages in the memory: | ||
+ | |||
+ | < | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Delete a message ==== | ||
+ | |||
+ | To delete a message: | ||
+ | |||
+ | < | ||
+ | |||
+ | AT+CMGD=2 | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Lista de operadores moviles ==== | ||
+ | |||
+ | < | ||
+ | AT+CGDCONT? | ||
+ | </ | ||
+ | |||
+ | Y usamos uno: | ||
+ | |||
+ | < | ||
+ | |||
+ | AT+CGDCONT=1 | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Connect to internet ===== | ||
+ | |||
+ | INSTALAMOS PPP Y WDIAL: | ||
+ | |||
+ | < | ||
+ | # sudo apt-get install wvdial ppp | ||
+ | </ | ||
+ | |||
+ | ~~DISQUS~~ | ||
linux/modem3g.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1