Venue: RC School, Sahn Malen
It’s official: Sahn Malen is now online.
Let me give you some context first: this is a small village in southern Sierra Leone (about 1500 people). No electricity, no running water. We have our daily group meetings by candlelight and every morning go to the nearest communal hand-pump to get water for flushing down the toilet, or taking a shower. It is connected to the big towns only by bumpy dirt tracks. And yet, here I am, sitting in a classroom full of children and teachers surfing the internet on their XOs.
It’s amazing to watch this happen.
I’ll be the first one to admit that doing so wasn’t easy but now that it’s done, I’m sure replicating it will be much easier. The first question was what connectivity option should we choose. From an ‘online-offline’ setup like KioskNet to something as sophisticated as a long-distance wi-fi link between Sahn Malen and the nearest online town- we gave some thought to quite few options. But as is usually the case, the best option turned out to be the simpler one as well: Sahn Malen gets some spotty cellular coverage. So I thought that with proper placement and an antenna with the right gain, we might be able to get a GPRS internet connection up and running. We came to Bo (the second-largest city in Sierra Leone and a 4-7 hour poda-poda drive away from Sahn Malen) and checked out the Zain office (a cellular company with the most pervasive network here). We found out the location of their towers in Sierra Leone and an employee there was kind enough to lend us his own personal modem to test the network in Sahn Malen, before we made the pricey purchase. We just needed an antenna to start the test.
There are quite a few tutorials available online which walk you through making your own cell phone antennas but none of them looked easy AND dependable at the same time. Especially not with the tools we had here. Luckily, while walking through the market in downtown Freetown, I came across cheap TV antennas that were rated up to 866 Mhz for UHF (Ultra High Frequency). Cellular networks here work on 900 Mhz and I thought the $10 investment would be worth the try. So I bought the antenna, a spare male-female pins pair for extra coaxial cable and split the modem open to get to the board, which would take an external antenna. A close look at the port showed that the port was about the same size as the port for wifi antennas in an XO. So I took a dysfunctional XO, snipped some wire off of it and hooked the modem up to the antenna with one of the spare coax pins that we had bought.
The only thing left to do now was to make sure that the antenna worked for the right frequency (i.e. 900 Mhz). A Do-It-Yourself Pringles “cantenna” tutorial gave some insight into the physics of this and I hoped that if I cut UHF receptors on the antenna down to size of a quarter wavelength of the cellular signals, we would get the right gain. The math for calculating that length looks like this:
Speed of radio waves in air = 3.0 * 10^8 m/s
Frequency = 900 Mhz = 9.0 * 10^8 Hz
Speed = Wavelength * Frequency
Wavelength = Speed/Frequency = 0.33 m
Quarter wavelength = 0.33/4 = 0.085 m = 8.5 cm
So I cut the UHF receptors down to 8.5 cm, disconnected the VHF receptors and set the antenna up in a place where we usually get the best signals. And voila, our laptop connected to the internet in a room where it doesn’t without the antenna.
I wasn’t sure if the physics of it was accurate (in fact I still am not) but in a true manner of learning constructivist style, we just had to give it a shot. And it seems to work just fine. If you think this can be done better though, we’d love to hear from you.
All that was left to do was to install the modem and get it to run automatically on the school server (which has an OLPC-customized version of Fedora server installed). With little experience with linux, I had to tinker around with a lot of things (with some great help from Reuben and the people on the server-devel list at OLPC)- all of which don’t merit a mention here. As it turns out, if all the going around in circles is cut down, the procedure for installing a GPRS modem on the XS can be reduced to a few, relatively straightforward steps:
1. Plug the modem in and run: cat /proc/bus/usb/devices
2. Find the section that lists the name of your modem (in our case HUAWEI Mobile) and take down the Vendor and ProdID. Then run modprobe usbserial vendor= xxxx product=xxxx (replace the xs with the appropriate values for your model). Then run wvdialconf to create a default dial script for your modem.
3. Edit the wvdial.conf file by running nano /etc/wvdial.conf I am listing the contents of the one we used for reference:
[Dialer Defaults]
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet.sl.zain.com"
Stupid Mode = 1
Modem Type = USB Modem
Phone = *99#
New PPPD = yes
ISDN = 0
Username = blank
Password = blank
Baud = 460800
The important values which you will need to change depending on your case are:
a. Modem = (Enter the appropriate path for your modem; can be found by running cat /proc/bus/usb/devices ; in our case, it was /dev/ttyUSB0)4. Change the firewall rules to take the modem as the default internet connection by running nano /etc/sysconfig/olpc-scripts/iptables.principal and nano /etc/sysconfig/olpc-scripts/iptables.principal.cache The former stores the firewall rules for when Squid is turned off and latter for when it is on. In both these files look for the entry “-A POSTROUTING –o eth0 –j MASQUERADE” and change “eth0”(could be eth1 if you switched the nic roles earlier) to “ppp0”. This should tell the firewall to redirect requests for internet to the USB modem.
b. Init3 = AT+CGDCONT = 1, “IP”, “internet.sl.zain.com” (change the last entry to the appropriate APN for your cellular network)
5. Test the modem by running wvdial ; If it outputs primary and secondary DNS addresses, it means you’re connected to the internet. Test the connection on an XO/laptop connected to the server(in our case, it usually takes half a minute/minute after the modem has connected before the server starts accessing internet properly)
6. If the internet works on the XO, all that is left to do is create a udev rule that would automatically dial the modem when it’s plugged in, instead of someone having to run the wvdial command every time. Before you create the rule, you need some information about your modem. To find this, run udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB0) ; remember: /dev/ttyUSB0 is the path for the modem in our case; you should confirm what that path is from the cat /proc/bus/usb/devices command described in step 1. Now that you have these attributes, create a file in the udev rules folder by running nano /etc/udev/rules.d/10-usbmodem.rules , where 10-usbmodem.rules is the name of the file; you can change it as you wish. In the nano editor, enter something like this, changing the entries according to the values you found earlier from the udevinfo command:
KERNEL=="ttyUSB0",SUBSYSTEM=="usb",ATTRS{manufacturer}=="HUAWEIThis basically tells the system to run wvdial once it detects an interface with all
Technologies",ATTRS{product}=="HUAWEI Mobile",RUN+="/usr/bin/wvdial"
the listed attributes.
And that’s it. You’re all set to see amazing things happen.
Clem’s sister does Teach for America and he is going to try and hook some peer tutors up with her students. We have already set email addresses up for all the adult leads and some peer tutors. In fact, as I finish this post off, I am seeing emails from all the adult leads and some peer tutors sitting in my inbox. Should go read them now.
I’m really looking forward to seeing how this unfolds over the next year.
Signing out,
Faaez
P.S: Many thanks to Reuben, the OLPC server-development team and Google for making this possible.