Skip to main content

Getting Vodafone 3G to work on Raspberry Pi in India using K3770-Z

I live in Pune, India and I wanted to do this: DHT Humidity Sensing on Raspberry Pi with GDocs Logging

So I assembled this:


and faced two problems: 


  1. I couldn't immediately figure out how to get K3770-Z to work on Raspberry Pi. Since this K3770-Z 3G USB Modem from Vodafone worked on Ubuntu 12.10 x86 without requiring any installation or configuration, I was sure that I could somehow get it to work on Raspberry Pi
  2. When I finally did get the modem to work on RPi, I found that the iBall Portable Charger (Datasheet here) could not source the peak current requirements of the modem when it turns on registers to the 3G network. The charger can supply only 600mA @ 5V where as the 3G modem definitely requires a lot more during registration.
The second problem can be solved simply by using a 12V 2.2Ah Sealed Lead Acid Battery and a 12V to 5V DC-DC converter. For the conversion you could use the car accessory for charging phones or build one yourself using LM2576.

As for the K3770-Z, here is how I got it to work on Arch Linux.

Things you need:

  1. 5V DC power supply capable of supplying current greater than 1.0 Ampere
  2. Raspberry Pi
  3. powered USB Hub (Raspberry Pi by itself will not be able to supply enough current to the modem)
  4. K3770-Z
  5. SD Card (atleast 4GB)
  6. TV or Monitor with HDMI input
  7. HDMI Cable
  8. USB Keyboard
  9. A Windows or Linux PC with an SD Card reader
  10. Internet connection for the Raspberry Pi over Ethernet
Instructions (ours will be bit different from the ones given over at 3G Internet on Raspberry Pi - Success!, also order of executing the instructions is important):
  1. Using your laptop, download the Arch Linux image from here: http://www.raspberrypi.org/downloads and write it to an SD Card using Win32DiskImager (if using Windows) or dd (if using Linux).
  2. Insert the SD Card into the Raspberry Pi and supply it with an internet connection using an Ethernet cable connected to your router. You could also connect the Raspberry Pi to your computer using a cross Ethernet cable and use Windows Internet Connection Sharing to give internet access to your Raspberry Pi. Connect the required peripherals (USB Hub, Modem, Keyboard, Monitor etc.) to the Raspberry Pi and power it up. Carry out the remaining instructions on the Raspberry Pi itself.
  3. Login into Arch Linux (login: root, password: root)
  4. Make sure your Raspberry Pi has internet connectivity (using Ethernet) by trying ping:
    ping www.google.com
  5. Restart the Raspberry Pi once
  6. Update pacman package lists:
    pacman -Syy
  7. Update pacman:
    pacman -S pacman
  8. DO NOT update all the system packages blindly by executing pacman -Syu
    Instead only install the packages required for the 3G connection:
    pacman -S ppp
    pacman -S wvdial
    pacman -S usb_modeswitch
  9. Our K3770-Z modem has a Vendor ID of 0x19d2 and Product ID of 0x1175. This product ID corresponds to a Virtual CD-ROM device. We must switch K3770-Z to modem mode (to product ID 0x1177) if we want to use it to access the internet. To do this create a configuration file for it:nano /etc/usb_modeswitch.d/19d2\:1175
  10. Type the following lines into this new configuration file:
    # Vodafone (ZTE) K3770-Z
    
    DefaultVendor= 0x19d2
    DefaultProduct=0x1175
    
    TargetVendor=  0x19d2
    TargetProduct= 0x1177
    
    MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
    
    NeedResponse=1
    
    CheckSuccess=20
  11. Ctrl+O to save the file 
  12. Ctrl+X to exit
  13. Now we need to download the "binary free" version of Sakis3G script ( we need binary free version as we want it to use the system supplied version of usb_modeswitch):
    wget "http://www.sakis3g.org/versions/latest/binary-free/sakis3g.gz"
  14. Uncompress the script:gunzip sakis3g.gz
  15. Make the file executable:
    chmod +x sakis3g
  16. Now you can disconnect the Ethernet cable from Raspberry Pi and try to use the 3G modem to access the internet (make sure the network coverage in your area is good enough, use a Windows PC to connect to the internet using your 3G Modem and check if it is working fine before carrying out the instructions):
    ./sakis3g --interactive
  17. An interactive menu driven interface will help you connect to the internet. Some of the configuration options that need to be selected are as below:
    1. USB Interface: Select Interface #1
    2. APN: Custom APN
    3. Enter "www" for APN.
    4. For username and password just enter "123" and "456" respectively. Actually it doesn't matter what username and password you enter, you can enter anything.
  18. If you followed the steps correctly, you should be connected to the internet and you should be able to ping www.google.com successfully.
To automate the Sakis3G script so that you don't have to manually supply the options, you can create a configuration file (execute nano /etc/sakis3g.conf) containing the following lines:
--console
--debug
--noprobe
--pppd
--googledns
MODEM="19d2:1175"
USBINTERFACE="1"
FORCE_APN="www"
APN_USER="123"
APN_PASS="456"
DIAL="*99***1#"

The debug option will spew out on the monitor the internal details of the sakis3g script on the screen as it executes. After you have created the script, you can execute ./sakis3g connect to connect to the internet without manual intervention.
The above configuration file is enough to connect quickly and easily to the Vodafone 3G network. You can refer to the Sakis3G configuration page here for more options that you can configure.

I captured the debug messages generated by sakis3g in a log file during a successful connect. It is here.

And as for the power supply problem, here is what my new setup looks like, and it works fine as expected - the 2.2Ah 12V rechargeable Valve Regulated Lead Acid battery is able to supply enough current to power the Raspberry Pi and the USB 3G Modem. For voltage regulation I used: an LM2576-5.0, 2nos. 1N5819 in parallel & a 150uH 1.5A Inductor.



Comments

  1. @RAM from German Bakery, Koregaon Park, Pune :P
    Just Joking!

    You can order it from here:
    http://downloads.element14.com/raspberryPi3.html?isRedirect=true
    You will need a credit card to get it.

    ReplyDelete
  2. nice post, dude i got question

    I have raspPi + ethernet cable+ laptop with win8 + tata photon,i see raspPi screen using TV tuner & putty on laptop....so far so good

    but the problem is , i can't access internet through raspPi ,thus i m not able to update raspPi and other apps.

    I created LAN btw raspPi and Laptop Win8 thats working fine but i am not able to make bridge connection btw laptops Win8 ethernet and Dial-up modem (photon+)

    Can u suggest me ... how to go abt tht

    Pls need ur help

    ReplyDelete
  3. Hi, I have tried Internet Connection Sharing on Windows 7. It works. In fact that is how I updated/installed packages on my RPi using pacman. I don't have any experience with Windows 8. Maybe you can look here: http://windows.microsoft.com/en-us/windows-8/using-ics-internet-connection-sharing

    ReplyDelete
  4. Hi Anurag,
    I am using the same modem, and following the same procedure as u mentioned in the blog, I reach till connection stage but after that I get an error as "can't create ttyACM0:Input/Output error ", request you to please help me on this.

    ReplyDelete
  5. i am using Wheezy - the Debian build operating system on my Pi. have followed the steps from http://shkspr.mobi/blog/2012/07/3g-internet-on-raspberry-pi-success/
    still i am ot able to connect my K3770-z modem to Rpi. please tell me what steps i am missing?

    ReplyDelete
  6. Hi this project looks something:-)that i am trying to do. But i want to put a ip camera in my car for security reasons.
    Do you think it would work.

    Regards,
    Peter.

    peter.neale2@btinternet.com

    ReplyDelete
  7. @peter

    I suggest that you use a wifi IP camera. With that you can use TP-LINK's TL-MR3020 pocket wifi router along with your 3G dongle to give the camera access to the internet

    ReplyDelete
  8. can i use tata dokomo wifi dongle for raspbian?..

    ReplyDelete

Post a Comment