HSMM Mesh on Raspberry Pi
2014-03-16 34 Comments
Broadband-Hamnet™ (formerly called HSMM-Mesh™) is a high speed, self discovering, self configuring, fault tolerant, wireless computer network that can run for days from a fully charged car battery, or indefinitely with the addition of a modest solar array or other supplemental power source. The focus is on emergency communications.
In its current form it is built using the Linksys WRT54G/GL/GS wireless routers and operates on channels 1-6 of the 2.4GHz ISM band, which overlaps with the upper portion of the 13cm amateur radio band. Other platforms and bands are in development at this time. Next will be Ubiquiti equipment with others supported as development resources permit.
It’s fairly easy to flash an old Linksys WRT54G router with HSMM-Mesh (now called BroadbandHamnet-v1) firmware. The downside is that the routers are fairly old and not that easy to find anymore. Plus, they are fairly limited in functionality. It would be more interesting to put mesh software on a microcomputer such as Raspberry Pi or BeagleBone which I did.
I came across a script created by Scott Kidder which does just that – it radically simplifies installation and configuration of hsmm-mesh on Raspberry Pi / Beaglebone. See installation instructions here: https://github.com/urlgrey/hsmm-pi
I used a Raspberry Pi Model B with a small USB WiFi dongle. The Ethernet port will provide LAN connectivity (DHCP) for connected computer(s).
After installing Raspbian and hsmm-pi software following instructions from Scott, all I needed was to login to the node’s web interface and change the SSIS to ‘BroadbandHamnet-v1’ – same as the currently used SSID by new linksys firmware and reboot the Pi. After reboot, the local mesh router was recognized by the Pi:
For mobile WiFi, I planned to use either an ALFA 1,200 mW USB WiFi network adapter that are known to work with Raspbian.
Surprisingly, the chip inside was NOT RT5370 as advertised- it was Mediatek 7601T instead. The USB ID was 148f:7601 instead of 148f:5370 accordingly.
As a result, the dongle did not work in Raspbian out-of-the-box. Luckily, the source code of a driver was available from mediatek.com which I promptly downloaded to the Pi but it needed to be compiled first.
Compiling Mediatek RT7601 driver
After googling forums, reading documentation, and some trial and error, the driver was compiled, installed (mt7601Usta.ko) and the card was finally recognized by Raspbian (3.10.33+ #656 PREEMPT armv6l GNU/Linux).
The compilation steps were as follows (in Terminal):
# get root sudo bash # now continue as root and download latest updates apt-get update apt-get upgrade rpi-update # now download linux kernel source cd /usr/src git clone --depth=1 https://github.com/raspberrypi/linux.git sudo ln -s /usr/src/linux /lib/modules/`uname -r`/build cd linux # test kernel sources make mrproper zcat /proc/config.gz > .config cp .config .config.org sed -i 's/^CONFIG_CROSS_COMPILE.*/CONFIG_CROSS_COMPILE=""/' .config make modules_prepare # download module symbols to avoid recompiling kernel from sources wget https://raw.github.com/raspberrypi/firmware/master/extra/Module.symvers exit
Now all prerequisites are satisfied so we can download and compile the driver:
# download the driver into your home ~ folder cd ~ tar -xvjpf DPO_MT7601U_LinuxSTA_220.127.116.11_20130913.tar.bz2 cd DPO* # now you can modify ULONG RTDebugLevel = 0; // RT_DEBUG_TRACE; # as per http://ubuntuforums.org/showthread.php?t=1708767 to avoid the driver spamming into syslog nano os/linux/rt_linux.c # or, alternatively, can run this every time after reboot: iwpriv ra0 set Debug=0 # now build and install the driver sudo make sudo make install # and, finally, reboot! sudo reboot
After reboot, the wifi card showed up as ‘ra0’ interface in ifconfig.
I noticed that the driver writes a LOT of debug info into the logs. To avoid that, I used:
iwpriv ra0 set Debug=0
as suggested by http://ubuntuforums.org/showthread.php?t=1708767
Done! In this configuration (1 – wireless, 1 – ethernet interface), the Pi can function either as a wireless gateway to WAN (internet) for other mesh nodes, or as an individual access point to wireless mesh. I’m planning to use it mostly for the latter – portable/mobile operation. A laptop is plugged in into the Pi’s ethernet port, and the Pi routes the network to the other wireless mesh nodes in the vicinity.
The Pi can be deployed either independently as part of a bigger mesh network or used as a gateway/access point. Any additional services such as shared folders, web forum/board, IRC chat, SIP client / asterisk, can be installed right on the Pi.
Update August 8th, 2014 on WiFi dongle:
The WiFi dongle was very flimsy and badly built. One of those days it stopped working probably due to some PCB circuit or SMD solder failure and was discarded.
The next iteration was ALFA clone from DX.COM. It worked fine for a bit with a standalone stock antenna but when connected to a high-gain Yagi it just died right away….
So now I use ‘$5 Dx.com original‘ WiFi dongle. It’s tiny, works well for short distances, and has a low power consumption so it didn’t require a powered USB hub for itself. Also no drivers were required for Raspbian (possibly other distros too), and it haven’t seem to hang itself after a few days as some other USB dongles did so the chipset/drivers are fairly stable. One improvement would be an external antenna connector so I could use directional / gain antennas.
Please share your experiences in the comments.