Keeping a watchful-eye on WiFi and cellular networks in Ghana with balenaCloud

Guest author and balena user- Sam Moorhouse [https://twitter.com/sammoorhouse]- tells us about how he’s using Raspberry Pi devices on balenaCloud to monitor ISP-supplied 4G (cellular) routers in Ghana.

Balena user Sam Moorhouse writes a guest blog post to tell us about how he’s using Raspberry Pi devices on balenaCloud to monitor ISP-supplied 4G (cellular) routers in Ghana. His project watchful-eye keeps eyes 👀 on these devices which are used as a fallback connectivity option for his charity project Global Code which runs a summer program each year teaching students in Ghana about the joys of Linux, Python, containers and IoT.


The telco landscape in Accra, Ghana is different to what you might be used to. You see, there was never much copper laid down and so no POTS (plain-old-telephone-system) to replace, which means that over the last five years the fibre rollout by Google-led CSquared has been instrumental in the growth of network-bound businesses, government operations and education.

It’s like the lights have been switched on. Ghana is well served by the undersea cable network so high-speed internet is available – however, because there’s no existing last-mile conduit network you either have to dig it yourself (BYO hard hat) or rely on a wireless option.

…which is where MTN steps in with TurboNet, essentially a router offering with 4G on one side and WiFi/ethernet on the other.

TurboNet lets you take advantage of the fibre backbone behind MTN’s excellent cell tower network and, as long as you don’t mind the occasional power outage and you’re comfortable competing with consumer usage on an asymmetric connection, you’re off to the races.

I run Global Code – we teach university students here in Ghana how to be brilliant software engineers in a three-week summer program every July. We give every student a Raspberry Pi and teach them Linux, Python, Git, containers, and a bit of IoT. It’s very hands-on and we’re growing quickly. This year we’ll have 150 students (75 are women!) and, whilst the university internet connections we use are usually brilliant, it’s wise to have an alternative in your back pocket.

So I bought a handful of these TurboNet boxes and… they’re really good! I wanted to build in some telemetry so I grabbed a nearby Pi and set to work building Watchful Eye.

Simply put, it reads local WiFi strength and a bunch of stats from the router firmware’s built-in (but absolutely not documented and definitely subject to change, but who’s updating router firmware?) REST API, then sends it out over the WiFi connection (yes, I know) to a Linode box I’ve got running Grafana and Graphite.

Hosting the whole thing on balenaCloud is a dream, it couldn’t be easier. I created a balena application and a Dockerfile.template alongside my code. scripts/start.sh runs balena wifi-connect, a fantastic bit of plumbing that exposes a WiFi network on the Pi, and gives you a captive portal where you can supply credentials for the target network, massively simplifying rollout. The next time the Pi boots, it connects to the target network and runs my code.

I first discovered balena back when they were resin.io, and it’s always seemed like such a fantastic tool. I’m the kind of engineer who tries to find excuses to use neat things and I’m glad I’ve been able to use balena in the field to help our students here in Ghana. [we are too! — ed]

If you want to help us out there are three ways:

  • Donate at justgiving.com/globalcode – we’ve got no staff costs so everything goes into flights for volunteers and hardware for students
  • Give an hour a month to mentor one of our alumni – they’re programmers in their final year of university and mentoring really gives them a bump
  • Come to Ghana with us in 2020! Email [email protected] for more information, in particular we’re looking for women/PoC, but everyone is welcome!

Thanks go out to Sam for publishing his project and for taking the time to tell us about the work he and his charity are doing in Ghana. If you’d like to learn more, contact Sam on Twitter @sammoorhouse or via email to [email protected]. If you’d like to support the work they’re doing you can do so at justgiving.com/globalcode.


Posted

in

Tags: