Using Teltonika TRM500 on a Raspberry Pi with OpenWrt

Hi, got an idea to use a wireless modem on a Raspberry Pi to make a home router. I know the Raspberry Pi hardware is not ideal, but it is a fun project. Here is a little summary of how easy it was to install the 5G modem Teltonika TRM500 on OpenWrt on a Raspberry Pi using the QMI Cellular interface in case someone else wants to try a similar thing.

Have been struggling for quite a long time with 4G USB dongles and their USB mode switch. Have given up on that and now got the TRM500 instead. Got it up and running in about 15 minutes. It was very easy compared to the devices I tried before. Now I just wanted to share how I got this to work in case other people would like to do something similar.

Prepare the Raspberry Pi

  • Go to https://firmware-selector.openwrt.org/
  • Enter the Raspberry Pi model.
  • Click “Customize installed packages […]”.
  • Add the following packages at the end of the existing list: kmod-usb-net-qmi-wwan uqmi luci-proto-qmi kmod-usb-serial-option picocom
  • Click “Request build” and wait a minute or two while it builds.
  • Download the “Factory” image. Choose whatever filesystem you prefer.
  • Flash the file to a microSD card using for example “Raspberry Pi Imager”.
  • Connect the Raspberry Pi ethernet port to a computer with a crossed TP cable or via a switch with two regular cables.
  • Boot the Raspberry Pi from the microSD card.

Connect OpenWrt to the Internet

  • Run command ssh root@192.168.1.1 on your machine to connect.
  • Change the password with the passwd command once connected.
  • Open the OpenWrt web admin tool LuCI that is available at “http://192.168.1.1/”.
  • Click “Network” > “Interfaces” > “Add new interface…”.
  • Use name “wwan” and protocol “QMI Cellular”. Click “Create interface”.
  • Set field “Modem device” to “/dev/cdc-wdm0” and the two APN fields “APN” and “IPv6 APN” to the VPNs from your cell network provider.
  • Click on the “Firewall Settings” tab and attach the interface to “wan”.
  • Click “Save”.
  • Click “Save & Apply”.
  • After about 10 - 20 seconds I was connected. Got an IPv4 address and a delegated IPv6 prefix address from the cell network provider.

Use the Raspberry Pi built in WiFi as an access point

  • Open the OpenWrt web admin tool LuCI again.
  • Click “Network” > “Wireless”
  • Click “Edit” on the “OpenWrt” SSID.
  • Change the “Country Code” to your country.
  • Change the “ESSID” field to what you want.
  • Click “Wireless Security” and enable the encryption you want and set the “Key” you want.
  • Click “Save”.
  • Click “Save & Apply”.
  • Click “Enable” on your SSID.

Now you can connect your devices to the WiFi hotspot.

One thing I might do in the future is to add a Ubiquiti UniFi access point and maybe switch out the Raspberry Pi for something like a ZimaBoard or similar to improve the speed.

6 Likes

Hello @marcushammar,

Thank you for taking the time and effort to share your experience and detailed setup guide! Your instructions will undoubtedly be valuable for users with similar use cases or those who enjoy building custom projects for fun.

If you or any other users would like to share more custom setups with guides, it would be greatly appreciated, as they can inspire and help others in the community.

As a token of our appreciation, I have sent a form to your email (used for registering on the forum) inbox to reach out to you privately. When completing it, use 12905 for the ticket ID.

Thank you again for your contribution!

Best regards,

1 Like

Very nice guide! May I ask what speed you are getting on the WAN-side? Are there any limitations on the interface or are you getting full 5G speed?

Reason why I´m asking is that I read another guide for OpenWrt + LTE/5G modem and that guide said that it was limited to about 100Mbit/s.

I´m trying to get TRM500 work with OpnSense, but due to lack of support of modems in OpnSense I need to find another more reliable solution.

1 Like

When the TRM500 is directly connected to the PC without a router I get around 530 Mbit/s.

When connecting the PC via Ethernet to the Raspberry Pi 4 that runs OpenWrt and has the TRM500 modem I get around 430 Mbit/s.

When connecting the PC via WiFi using a Ubiquiti UniFi U7 Lite that is connected to the Raspberry Pi 4 running OpenWrt and the TRM500 modem I get around 460 Mbit/s.

On the device the 5G LED has a solid light. There might be some constraints with my cell phone carrier thou. But overall I am very happy with the speeds.

Here are some other learnings from using the above solution for a while.

The Raspberry Pi 4 did not have a very good WiFi when acting as a hot spot. The range and speed was quite limited. Because of that I bought the Ubiquiti UniFi U7 Lite and plugged it directly into the Ethernet port on the Raspberry Pi 4. The UniFi Network Server runs in a Docker container on the same Raspberry Pi that runs OpenWrt in order to configure the UniFi network and see the status of it.

One issue when trying to run Docker with the OpenWrt image created according to the instructions above was that the root partition only got assigned 100MB on the microSD card which was too small for the UniFi Network Server installation. In order to overcome that I used the OpenWrt Image Builder to build a custom image to override the root filesystem size. That is done by setting the variable CONFIG_TARGET_ROOTFS_PARTSIZE in the .config file to a larger size. Note that in order to use the OpenWrt Image Builder you need a x86 Linux system.

Earlier I found some instructions for how to expand the existing image beyond 100MB but I was not successful with that. But using the OpenWrt Image Builder worked well.

Thanks for the update!

Sounds like good news for me, decent speed and also faster speed than the carriers can deliver at my location, I was afraid that it was limited to around 100Mbit/s.

I´we already got OpenWrt VM up and running for test, at the moment only 4G-sim and wrong location, I get around 20Mbit/s so it may be local limitations. With your instructions I think it’s worth continue testing, I will prepare a Raspberry Pi for testing with 5G at another location.

1 Like

This topic was automatically closed after 60 days. New replies are no longer allowed.