Internet Connection to Raspberry pi 3 (Raspbian Stretch) with a 4G Huawei Mobile Broadband LTE USB Stick (HUAWEI E3372) using wvdial

This post describes how to use    the linux package “wvdial”   for configuring the USB dongle to obtain internet access  to pi3 .

First connect the 4G Huawei E3372  dongle is connected to a USB port of  the Raspberry pi 3

Required Linux Software

wvdial

usb-modeswitch

ppp

Install above packages using the terminal

sudo apt install ppp usb-modeswitch wvdial

Plug the USB 4G dongle to the Raspberry pi 3

Open the terminal

lsusb

Screenshot from 2018-09-01 00-00-41

Figure 1:- From the above figure it can be seen that USBMODEM=’12d1:1506′

Now you will be able to see the details of the USB dongle on the terminal

Creating a default wvdial.conf file on /etc

wvdialconf /wvdial.conf

Open wvdial.conf using gedit

sudo gedit /etc/wvdial.conf

Then modify the wvdial.conf file as shown below

Screenshot from 2018-09-04 22-31-58

Figure 2:-wvdial.conf file at /etc

As I have used a sim card of Mobitel Sri Lanka at the end of the line no 5 of above file is written as ‘mobitel’

Line no 10 depends on how the dongle is connected in your system.

ttyUSB* is found and automatically written in generated wvdial.conf when you use

“wvdialconf /wvdial.conf” command on the terminal.

ttyUSB* corresponds to USB dongle can also be found using “ls -l /dev/serial/by-id” on the terminal.

Screenshot from 2018-09-05 11-05-52

Figure 3:-

 

Test the connection

sudo wvdial

Now you can see that internet is activated in Raspberry pi 3

 

Making the internet connection automatic during the boot time.

For this purpose we have to make a script file and add an executing command in /etc/rc.local

sudo gedit 4GModam.sh

write following lines in the file and save

#!/bin/bash

wvdial

sudo chmod +x 4GModam.sh

Screenshot from 2018-09-04 22-32-58

Figure 4:- 4GModam.sh script file at /home/pi

Including executive command in /etc/rc.local to activate 4GModam.sh during the boot time

sudo gedit /etc/rc.local

Add the following command above “ext0” command in /etc/rc.local and save

sh ‘/home/pi/4GModam.sh’

Screenshot from 2018-09-04 22-34-03

Figure 5:- Editing  /etc/rc.local

Reboot the Raspberry pi 3

Now you can observe that the internet connection is activated in Raspberry pi 3


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s