Connecting Raspberry Pi to 4G network
In the Internet of Things IoT projects shared in the previous articles, we noticed that they usually have one thing in common: they rely on Wi-Fi hotspots and connect to the Internet network through this hotspot.
Connecting to an Internet network via a Wi-Fi hotspot is perfect if you only want to use the end device at home or somewhere with access to a Wi-Fi hotspot. But what if you want to use the device anytime, anywhere, or place it in the field to collect data and transfer it to a server? In this case, you must use a cellular network to transmit data.
In this article, we will focus on several methods that can be used to connect the Raspberry Pi to a 4G network.
Use a dedicated HAT expansion board
Raspberry Pi HAT is an expansion board specially made and tested for a specific version of Raspberry Pi. They are almost the same as the shields in Arduino development boards. However, unlike other expansion modules, HATs usually perform more demanding tasks.
Using a dedicated HAT, such as the SIM7600E-H LTE SMT EU module using the SIM7600 chip, is a convenient and quick way to connect your Raspberry Pi to a cellular network.
HAT module integrating SIM7600CE chip.
The model numbers of the modules above are just an example, there are many more different modules and HATs that will work fine as well.
Make sure to do some research to find the right module for your project, as some of them will offer additional features, such as GPS support, while others are missing certain features, such as connecting to 3G or 4G networks.
However, such HATs usually have one thing in common, that is, they are relatively expensive. Additionally, the process of setting up these modules under Linux can be complicated, especially for new users.
Use a simple Wi-Fi modem
As mentioned above, HATs can be very expensive, so I usually use a simple USB modem to connect my Raspberry Pi on the go. There are several models to choose from, but I recommend choosing a USB modem for setting up your Wi-Fi network. This way you can connect your Raspberry Pi just like you would at home.
The modem I often use is the Huawei E355. You may want to look for similar products, such as the Huawei LTE E8372 Modem (PDF). With this method, the modem creates a wireless network so the Raspberry Pi can connect to it.
I highly recommend this method – especially if your Raspberry Pi can connect directly to a Wi-Fi network. Such modems are very cheap, easy to use and generally very reliable, which makes them the preferred solution.
Using a simple USB modem
If you can’t find a modem capable of setting up a Wi-Fi network, you can try using a modem that communicates with your Raspberry Pi through its USB port.
I am using Huawei E303 modem. Please note that this is an older device. It’s very difficult to get most USB modems to work properly and reliably with the Raspberry Pi.
When you can’t find a modem that can connect to your Wi-Fi network, you can use the Huawei E303.
These devices are easy to use and even cheaper than Wi-Fi modems, so they’re a good choice if you’re on a budget and know your way around Linux.
Using your smartphone’s hotspot
If you’ll be around while the Raspberry Pi communicates, you can always use your smartphone to create a Wi-Fi hotspot and then connect the Raspberry Pi to that network. This is often the most cost-effective solution since almost everyone has a smartphone these days.
You can use your smartphone hotspot to set up a 4G network!
Note that you’ll need a SIM card and, in most cases, a valid contract to connect the Pi to a cellular network, which adds to the cost of the project.
Additionally, there are cheaper modems, such as 2G modems, that may not work reliably everywhere. Something to consider is that if you choose some of the cheaper plans, it may be difficult to find a network signal, especially in rural areas where reception quality may be poor.