Learn different ways you can access a 4G connection for your Raspberry-Pi-based IoT projects!
We’ve all seen our share of IoT projects and they all usually have one thing in common: they rely on a Wi-Fi hotspot that they utilize to connect to the Internet.
Connecting to the Internet via Wi-Fi hotspot works perfectly fine if you only want to use the final product at home or wherever you have access to a Wi-Fi hotspot. But what if you want to use the device on the go or leave it out in the field to collect data and transmit it to a server? In such a case, you’ll have to use a cellular network to transmit data.
In this article, I’ll describe a few methods you can use to connect your Raspberry Pi to a 4G network.
Use a Dedicated HAT
A Raspberry Pi HAT is an expansion board that’s specifically made and tested to work with a certain version of a Pi. They are pretty much the same thing as shields in the Arduino universe. However, unlike modules and other smaller expansions, HATs usually perform more demanding tasks.
Using a dedicated HAT, for example, a SIMCom SIM7600E-H LTE SMT EU which utilizes the SIM7600 chip, is a clean way to connect your Raspberry Pi to a cellular network.
This HAT option utilizes the SIM7600CE for 4G.
Keep in mind that the above option is just one example and there are many more different modules and HATs out there that work just as well.
Make sure to do some research to find the right one for your projects, because some of them offer additional functions, like GPS support, and others lack in some, like the ability to connect to a 3G or 4G network (which would totally defeat the purpose).
However, one thing that such HATs generally have in common is their price — they're quite expensive. Furthermore, setting them up to work with Linux can be a pain, especially for new users.
Use a Simple Consumer Wi-Fi Modem
As I mentioned, HATs can be quite expensive, so I usually utilize a simple consumer-grade USB modem to get my Raspberry Pi connected on-the-go. There is a wide variety of models out there to choose from, but I recommend that you go for a USB modem that sets up a Wi-Fi network. This allows you to connect your Pi in the same way you would at home.
A modem that I frequently use for this purpose is the Huawei E355. However, it was incredibly hard for me to find that particular model. You may have to look for an alternative, like the Huawei LTE E8372 modem (PDF). For this method, the modem creates a wireless network that the Raspberry Pi can connect to.
I highly recommend this method — especially if your Pi can connect to a Wi-Fi network out-of-the-box (which all new models do). Such modems are incredibly cheap, easy to use, and usually very reliable, which makes them the go-to solution for me.
Use a Simple Consumer USB Modem
If you can’t find a modem that puts out a Wi-Fi network, you can always try a model that utilizes the Raspberry Pi’s USB port to communicate with it.
The Huawei E303 modem is one I've had success with. Note that this is an old device, but there's a reason I still use it. It’s incredibly difficult to get most USB modems to work properly and reliably with the Raspberry Pi. Once you find one that works, stick with it!
The Huawei E303 works when you can't find a modem that puts out a Wi-Fi network.
These devices are readily available and even cheaper than the Wi-Fi options, making them a good alternative if you’re on a budget and know your way around Linux.
Use Your Smartphone: A Quick and Dirty Alternative
Don't want to leave your Raspberry Pi unattended? If you know you’ll stick around your Pi while it communicates, you can always use your smartphone to create a Wi-Fi hotspot and connect your Raspberry Pi to that network. This is usually the most cost-effective solution because virtually everyone has a smartphone nowadays.
You can always use your smartphone hotspot as a means of establishing 4G!
A Few More Considerations
Keep in mind that you’ll need a SIM card and, in most cases, a valid contract to connect your Pi to a cellular network, which adds to the cost of your project.
Furthermore, the cheaper variants of modems, like the 2G ones, might not work reliably everywhere. Recognize that, if you choose a cheaper alternative, you may struggle to find a signal especially in rural areas where the reception can be worse.