How to Connect a Raspberry Pi to a Cell Network // OpenWrt, 3G

Опубликовано: 07 Март 2025
на канале: Dev Odyssey
33,520
481

Support Me

Get a discount on Ekster Products
https://shop.ekster.com/devodyssey or discount code "DEV" at checkout!
(PAID Link)

Follow me on Twitter and Facebook

  / dev_odyssey  
  / dev0dyssey  

Welcome back to Dev Odyssey Home Networking! In this episode, I show you how to take a Raspberry Pi, and connect it to 3G Internet! With a Raspberry Pi connected to cell networks, you can use this as a travel router, or as a backup internet connection when your internet goes out. This makes the use case for a Raspberry Pi Router even stronger. 3G speeds are not the fastest, but they do work in a few scenarios, like remote areas and low bandwidth deployments. 3G is being phased out in the US, so this won't be the best solution for those living in the US. I'm working on setting up a 4G connection to my Raspberry Pi using a Sierra Wireless modem, so stay tuned to see that it in action, along with my other Raspberry Pi, SBC, IoT and OpenWrt projects!

Links

Hardware

Raspberry Pi 4B Kit
https://www.amazon.com//dp/B07V5JTMV9

Sixfab (PiHat) Raspberry Pi 4G/LTE Cellular Modem Kit
https://sixfab.com/product/raspberry-...

PiHat Mounting Kit (Geekworm)
https://www.amazon.com/dp/B0756CW6Y2

Electronics screwdriver
https://www.amazon.com/dp/B07V6ZZTBF

Software

OpenWrt Image for Raspberry Pi 4B
https://downloads.openwrt.org/release...
https://firmware-selector.openwrt.org/

Minicom Terminal Emulator
https://salsa.debian.org/minicom-team...

Informational

US 3G Phasing Out
https://www.fcc.gov/consumers/guides/...

Telit LE910 C4 AT Commands Documentation
https://www.telit.com/wp-content/uplo...

OpenWrt 3G Documentation
https://openwrt.org/docs/guide-user/n...

Video Description / Outline

— OpenWrt Configuration

Login with ssh root@OpenWrtIPAddress (usually 192 . 168 . 1 . 1)
Run command opkg update
Install packages with opkg install comgt kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch minicom luci-proto-3g
Run command reboot to restart OpenWrt
Login with ssh again, run command dmesg
Look in dmesg output for 'modem' and ttyUSB# to verify serial interfaces loaded
Look in dmesg for baud rate, usually next to 'ttyAMA0', generally its 115200
Interact with serial interface using the following command: minicom -b 115200 -D /dev/ttyUSB3
Check if AT commands work by typing AT and enter
Check for Operator Selection - AT+COPS?
Confirm SIM Registration - AT+CREG?
Check Cell Signal Quality - AT+CSQ
Check PDP Context - AT+CGDCONT?

— Network Configuration in LuCi

Login to LuCI with credentials
Go to Network tab, then Interfaces tab
Click "Add New Interface"
In popup name interface "WWAN"
Choose Protocol "UTMS/GPRS/EV-DO"
Click "Create New Interface" Button
Leave “Bring up on boot” checked
In Modem Device dropdown, choose “/dev/ttyUSB2”
In Service Type dropdown, chose choose “UTMS/GPRS”
In APN, type in "super" (or your specific APN)
In PIN, leave as empty (unless you have a PIN for the SIM)
PAP/CHAP username and password, leave empty
Dial number, leave blank

Click Firewall Settings tab, in Create / Assign firewall-zone dropdown, chose wan

Click "Save", then "Save and Apply"

Testing

To test with ping, in terminal run command: ping -I 3g-WWAN

To test speed, shut down wired wan interface by clicking "Stop" for the "WAN" Interface.
Test network connection (speedtest.net) in browser

00:00 Intro
01:08 3G Considerations
01:41 Hardware / Software Intro
02:30 Hardware Assembly
05:36 Software Setup
07:22 AT Commands
09:59 Creating WWAN Interface
11:33 Ping Test / Speed Test
12:39 Outro

Attributions

Music | "Shine" by LiQWYD
Watch:    • LiQWYD - Shine [Official]  
License: https://www.liqwydmusic.com/how-to-use
Download/Stream: https://hypeddit.com/liqwyd/shine

Icons made by Pixel perfect, Dinosoft Labs
https://www.flaticon.com

Raspberry Pi trademark of Raspberry Pi Trading