Huawei USB 3G modem with Balena

Hi everyone

I have Raspberry Pi 4 2GB and I have configured GSM modem file like it says here: Network Setup on balenaOS - Balena Documentation

When I go in console of device in Balena I can run mmcli -m 0 and it shows the modem is connected online with 35% signal quality on the network. But it does not show up in ifconfig and if I disconnect the WiFi the device goes offline and does not try to use cellular connection even though it is available.

What can I do?

Anyone has 3G connection working in Balena? Thanks

Hello @superdave welcome to the balena community!

Could you please share here the results of your nmcli commands? Could you please confirm that you have credits on the sim card?

Meanwhile when you are connected through WiFi could you please try ping -I <name of your gsma interface> google.com to check that the cellular connectivity works?

Hi, thank you for reply.

root@9e53916:~# mmcli -L
    /org/freedesktop/ModemManager1/Modem/0 [huawei] E220

root@9e53916:~# mmcli -m 0
  -----------------------------
  General  |              path: /org/freedesktop/ModemManager1/Modem/0
           |         device id: acde4c693cb4777d46ab2c1dbcb9f757f0d9799f
  -----------------------------
  Hardware |      manufacturer: huawei
           |             model: E220
           | firmware revision: 11.117.08.05.156
           |         supported: gsm-umts
           |           current: gsm-umts
           |      equipment id: 358193015605893
  -----------------------------
  System   |            device: /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1
           |           drivers: option
           |            plugin: huawei
           |      primary port: ttyUSB1
           |             ports: ttyUSB0 (at), ttyUSB1 (at)
  -----------------------------
  Numbers  |               own: +447*********
  -----------------------------
  Status   |    unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           |             state: registered
           |       power state: on
           |       access tech: umts
           |    signal quality: 38% (recent)
  -----------------------------
  Modes    |         supported: allowed: 2g, 3g; preferred: none
           |                    allowed: 2g, 3g; preferred: 2g
           |                    allowed: 2g, 3g; preferred: 3g
           |                    allowed: 2g; preferred: none
           |                    allowed: 3g; preferred: none
           |           current: allowed: 2g, 3g; preferred: 3g
  -----------------------------
  IP       |         supported: ipv4, ipv6
  -----------------------------
  3GPP     |              imei: 35819301*******
           |       operator id: 23420
           |     operator name: 3 UK
           |      registration: home
  -----------------------------
  SIM      |  primary sim path: /org/freedesktop/ModemManager1/SIM/0

I have removed phone number and part of IMEI for safety.

I don’t know how to specify this interface with ping because it does not show up as an interface

root@9e53916:~# ifconfig
balena0   Link encap:Ethernet  HWaddr 02:42:76:87:46:6D  
          inet addr:10.114.101.1  Bcast:10.114.101.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

br-7f43c4f551d3 Link encap:Ethernet  HWaddr 02:42:88:38:08:DC  
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:E0:4C:36:03:14  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:990 errors:0 dropped:0 overruns:0 frame:0
          TX packets:990 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:144270 (140.8 KiB)  TX bytes:144270 (140.8 KiB)

resin-dns Link encap:Ethernet  HWaddr 96:64:5D:6C:1D:E6  
          inet addr:10.114.102.1  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

resin-vpn Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.246.85.22  P-t-P:52.4.252.97  Mask:255.255.255.255
          inet6 addr: fe80::fd81:a493:dc57:4a51/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:198 errors:0 dropped:0 overruns:0 frame:0
          TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:19126 (18.6 KiB)  TX bytes:22445 (21.9 KiB)

supervisor0 Link encap:Ethernet  HWaddr 02:42:5E:57:ED:C1  
          inet addr:10.114.104.1  Bcast:10.114.104.127  Mask:255.255.255.128
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr E4:5F:01:3C:51:C9  
          inet addr:10.1.121.117  Bcast:10.1.121.255  Mask:255.255.255.0
          inet6 addr: fe80::c6fa:7b88:ed2a:e763/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:107239 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13090 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:154738245 (147.5 MiB)  TX bytes:1453053 (1.3 MiB)

PS. I did this tests on Raspberry Pi Zero 2W because original Pi 4 is already used in other project. On this Pi Zero I just flashed a Balena Dash image and did not even make network config file for USB 3G modem but it still works

1 Like

@superdave try nmcli devices (or ncmli d) and there you might have the list of the interfaces.

On this Pi Zero I just flashed a Balena Dash image and did not even make network config file for USB 3G modem but it still works

This is great :slight_smile:

Let us know if we can help you more!

Hi, sorry for confusion, when I said “it works” I meant it shows up correctly in mmcli etc and it is connected to the provider without specifying APN. In fact when I was testing with previous Pi 4 I was testing with 2 different SIM cards from different providers, and mmcli still showed SIM 1 was connected to the provider even when I had APN settings for provider 2 in the config file. Now I am testing with Pi Zero I have not even created config file and it is still connected to provider 1 so I assume it has detected the APN settings automatically.

I will test nmcli commands later today.

1 Like
root@9e53916:~# nmcli d
DEVICE           TYPE      STATE                   CONNECTION     
wlan0            wifi      connected               balena-wifi-01 
supervisor0      bridge    connected (externally)  supervisor0    
ttyUSB1          gsm       disconnected            --             
eth0             ethernet  unavailable             --             
balena0          bridge    unmanaged               --             
br-7f43c4f551d3  bridge    unmanaged               --             
resin-dns        bridge    unmanaged               --             
veth9a23318      ethernet  unmanaged               --             
vethe65ab72      ethernet  unmanaged               --             
lo               loopback  unmanaged               --             
resin-vpn        tun       unmanaged               --             

Hello @superdave is this working properly? i see the gsm disconnected.

Let us know if we can help you more :slight_smile:

Hi, can you suggest what I can do to test more? I am not sure where to go from here. I know this modem and SIM card works, because I used it before on Windows and also on Raspberry Pi with sakis3g.

Thanks

Did you check this tutorial?

https://youtu.be/e5-r_9ggHqI

There are examples!

El dj., 22 de des. 2022, 15:07, superdave via balenaForums <notifications@balena.discoursemail.com> va escriure:

Hi

I created cellular config file on system-connections folder again. Now in nmcli devices I can see it is connected:

root@9e53916:~# nmcli d
DEVICE           TYPE      STATE                   CONNECTION     
wlan0            wifi      connected               balena-wifi-01 
supervisor0      bridge    connected (externally)  supervisor0    
ttyUSB1          gsm       connected               cellular       
ppp0             ppp       disconnected            --           

So I check with curl and it can successfully use the 3G:

root@9e53916:~# curl --interface ppp0 myip.wtf/json
{
    "YourFuckingIPAddress": "[xxx.xx].224.133",
    "YourFuckingLocation": "Glasgow, SCT, United Kingdom",
    "YourFuckingHostname": "[xxx.xx].224.133.threembb.co.uk",
    "YourFuckingISP": "Three",
    "YourFuckingTorExit": false,
    "YourFuckingCity": "Glasgow",
    "YourFuckingCountry": "United Kingdom",
    "YourFuckingCountryCode": "GB"
}

So it seems that now it is working.
Thanks