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
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
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
Open wvdial.conf using gedit
sudo gedit /etc/wvdial.conf
Then modify the wvdial.conf file as shown below
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.
Test the connection
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
sudo chmod +x 4GModam.sh
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
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