How to connect 3G modem to Vera

From MiOS
Revision as of 14:57, 23 February 2013 by Cj man (Talk | contribs)

Jump to: navigation, search

How to connect a 3G modem to Vera 3

This guide applies to Vera 3 units with firmware versions older than 1.5.600.

Instructions

Connect to the unit by ssh as explained here, then follow these steps:
1. Plug in USB Modem in Vera

2. Check if the modem is insterted correctly and that vera can see it .

gcom info /dev/ttyUSBx | x = 0 or 1 

3. In /etc/config/network add the following :

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'device' '/dev/ttyUSB0'
        option 'apn' 'internet'
        option 'service' 'umts'
        option 'proto' '3g'
              

If the modem has a PIN code add it :

  option 'pincode' '1234' 

If the modem requires an username and password set it :

  option username yourusername
  option password yourpassword

Save and exit


4. Check 3G chatscripts ( they are used for the method of connection )

cat /etc/chatscripts/3g.chat

    ABORT   BUSY
    ABORT   'NO CARRIER'
    ABORT   ERROR
    REPORT  CONNECT
    TIMEOUT 10
    ""      "AT+CSQ"
    OK      "ATE1"
    OK      'AT+CGDCONT=1,"IP","$USE_APN"'
    SAY     "Calling UMTS/GPRS"
    TIMEOUT 30
    OK      "ATD*99***1#"
    CONNECT ' '


Settings should be like the ones above.


5. Restart network (be sure to on lan conected to it , not by wan !! IT will not show debugging info )

/etc/init.d/network restart

    BRIDGE ADDBR : brctl addbr br-lan
    BRIDGE ADDIF br-lan eth0.1
    BRIDGE ADDIF : brctl addif br-lan wlan0
    BRIDGE DELIF : brctl delif br-lan
    Configuration file: /var/run/hostapd-phy0.conf
    Using interface wlan0 with hwaddr 00:0e:XX:XX:XX:XX and ssid 'mios_wifi'
    BRIDGE DELIF : brctl delif br-lan wlan0
    BRIDGE ADDIF : brctl addif br-lan wlan0

6. Watch logread with the following parameters :

logread -f | grep local2.info 

It should be like this

    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: abort on (BUSY)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: abort on (NO CARRIER)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: abort on (ERROR)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: report (CONNECT)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: timeout set to 10 seconds
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: send (AT+CSQ^M)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: expect (OK)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: AT+CSQ^M^M
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: +CSQ: 24,99^M
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: ^M
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: OK
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]:  -- got it
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: send (ATE1^M)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: expect (OK)
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: ^M
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: ATE1^M^M
    Feb 15 04:18:15 MiOS_31000000 local2.info chat[11495]: OK


7. Check ifconfig


         3g-wan    Link encap:Point-to-Point Protocol
       inet addr:172.22.205.5  P-t-P:10.64.64.64  Mask:255.255.255.255
       UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
       RX packets:2671 errors:0 dropped:0 overruns:0 frame:0
       TX packets:2449 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:3
       RX bytes:1025131 (1001.1 KiB)  TX bytes:717822 (700.9 KiB)


8. Start and stop 3G

To stop it :

ifdown wan 

To start it  :

ifup wan 

  If you encounter any issues you can check the logs at :

logread -f | grep local2.info 


 Possible issues :

1. Not being able to connect to the modem (on /etc/init.d/network restart -> no such device )

Cause : USB port miss-configuration

Resolution :

Type the code below until the USB modem is detected

gcom info /dev/ttyUSBx 

Then update the option 'device' '/dev/ttyUSB0' in

/etc/config/network 

2. 3G (error) PIN code incorrect :

Be sure to set the PIN if it has one, or if it doesn't have one dont set it at all.





Personal tools