serial-portraspberry-pipppsim900

Raspberry Pi sim900 Default Internet Access


I have set up a ITEAD sim900 GSM module to interface with raspberry pi. I believe I have established a gprs connection to AT&T though wvdial as I get these results.

    --> WvDial: Internet dialer version 1.61
    --> Initializing modem.
    --> Sending: AT+CGDCONT=1,"IP","Broadband"
    AT+CGDCONT=1,"IP","Broadband"
    OK
    --> Modem initialized.
    --> Sending: ATDT*99#
    --> Waiting for carrier.
    ATDT*99#
    CONNECT
    --> Carrier detected.  Starting PPP immediately.
    --> Starting pppd at Thu Aug 14 05:49:20 2014
    --> Pid of pppd: 2794

I have been looking all over the internet for some answers to a few questions that I have, but I can't seem to find any. Any help with the following questions will be greatly appreciated! Thanks!

I have three questions, and some may be stupid as I am VERY new to this field.

  1. Am I actually connected to AT&T's GPRS network?

  2. How can I make this module (serial port /dev/ttyAMA0) my default internet connection? What I mean is I want all internet traffic routed through this modem(web surfing, email etc.). I am connected to the Raspberry via ssh so I have to have either ethernet or wifi active to access the computer--I am currently using ethernet. After I connect through wvdial in the way shown above, and disable all other internet sources I have no access. It seems to still be looking to the active ethernet port for data(I could be wrong).

  3. For my project I need to have the sim900 modem as the internet access point, but I also need to be able to connect to a LAN via wifi that has no internet access. Is this possible?


Solution

  • Finally i got the ( raspberrypi + ppp + gprs/gsm-modem ) working.

    Some notes before start:

    1. Make sure the power supply you used for raspberrypi is exact 5V and it can provide at-least 2A current without voltage drop-out.The SIM900 power-source must be 3.3V 2A

    2. Set the SIM900 baud rate to 115200 via: AT+IPR=115200

    3. Check the modem serial peripheral via: $ screen /dev/ttyAMA0 115200 type AT<enter> it will echo: OK. Hit ctrl+a k y to exit.

    /etc/ppp/options-mobile

    ttyAMA0
    115200
    lock
    crtscts
    modem
    passive
    novj
    defaultroute
    replacedefaultroute
    noipdefault
    usepeerdns
    noauth
    hide-password
    persist
    holdoff 10
    maxfail 0
    debug
    

    Create the /etc/ppp/peers directory:

    $ mkdir /etc/ppp/peers
    $ cd /etc/ppp/peers
    

    /etc/ppp/peers/mobile-auth

    file /etc/ppp/options-mobile
    user "your_usr"
    password "your_pass"
    connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
    

    /etc/ppp/peers/mobile-noauth

    file /etc/ppp/options-mobile
    connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
    

    Create the /etc/ppp/chatscripts directory:

    $ mkdir /etc/ppp/chatscripts
    

    /etc/ppp/chatscripts/mobile-modem.chat

    ABORT 'BUSY'
    ABORT 'NO CARRIER'
    ABORT 'VOICE'
    ABORT 'NO DIALTONE'
    ABORT 'NO DIAL TONE'
    ABORT 'NO ANSWER'
    ABORT 'DELAYED'
    REPORT CONNECT
    TIMEOUT 6
    '' 'ATQ0'
    'OK-AT-OK' 'ATZ'
    TIMEOUT 3
    'OK' @/etc/ppp/chatscripts/pin
    'OK\d-AT-OK' 'ATI'
    'OK' 'ATZ'
    'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
    'OK' @/etc/ppp/chatscripts/mode
    'OK-AT-OK' @/etc/ppp/chatscripts/apn
    'OK' 'ATDT*99***1#'
    TIMEOUT 30
    CONNECT ''
    

    /etc/ppp/chatscripts/my-operator-apn

    AT+CGDCONT=1,"IP","<apn-name>"
    

    /etc/ppp/chatscripts/pin.CODE

    AT+CPIN=1234
    

    /etc/ppp/chatscripts/pin.NONE

    AT
    

    /etc/ppp/chatscripts/mode.3G-only

    AT\^SYSCFG=14,2,3fffffff,0,1
    

    /etc/ppp/chatscripts/mode.3G-pref

    AT\^SYSCFG=2,2,3fffffff,0,1
    

    /etc/ppp/chatscripts/mode.GPRS-only

    AT\^SYSCFG=13,1,3fffffff,0,0
    

    /etc/ppp/chatscripts/mode.GPRS-pref

    AT\^SYSCFG=2,1,3fffffff,0,0
    
    • The SYSCFG line in the mode.* files is device-dependent, and likely Huawei-specific, So You may use the mode.NONE file if your modem is SIM900. *

    /etc/ppp/chatscripts/mode.NONE

    AT
    

    Make some symbolic links:

    $ ln -s /etc/ppp/chatscripts/my-operator-apn /etc/ppp/chatscripts/apn
    $ ln -s /etc/ppp/chatscripts/mode.NONE /etc/ppp/chatscripts/mode
    $ ln -s /etc/ppp/chatscripts/pin.NONE /etc/ppp/chatscripts/pin
    

    If you have to enter credentials use mobile-auth

    $ mv provider provider.example
    $ ln -s /etc/ppp/peers/mobile-noauth /etc/ppp/peers/provider
    

    Check syslog in another console:

    $ tail -f /var/log/syslog | grep -Ei 'pppd|chat'
    

    Finally issue the pon command to see the result:

    $ pon
    

    The base instruction : https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd