Some hardware such as the Ben Nanonote or Dingoo A320 come with no built-in RF capabilities. However, they both contain microphones and speakers which opens up the possibility of transferring small amounts of data over sound. This type of communication is challenging due to the bandwidth constraints and noisey channel. I am interested in communicating structured data across such environments. XML is a decent way to structure data, providing you can minimise the transmission overhead. Using XML Schema, Packedobjects can support the levels of compression required to make usable applications. Generating and processing sound can also be challenging but we can reuse existing technology such as DTMF. By combining some of these technologies I have created a library which allows you to build simple applications which can communicate XML over DTMF. Currently you can transfer XML data from the headphone socket of one device using an audio cable to the microphone socket of another device. You can see an example of this setup in the first image. Here the software is communicating XML from a Ben Nanonote to my Macbook. The other images show the commands to run on the Nanonote and Macbook and their outputs. Using an audio cable from an embedded device is limited but has some niche applications because it is simple, cheap and has minimal setup. More interesting applications exist if you transfer the sound over longer distances, eg. through phone lines, or if you actually use air as the transmission channel. A noisey channel will require forward error correction (FEC). A fun challenge will be to find a FEC technique that works well on an embedded device across this noisey channel without significantly increasing the size of the data to transmit. Intially I had some FEC code integrated in the library but think it will be better if something like libFEC existed.
The project is called nibble and the source code is available here: http://code.google.com/p/libnibble/
If you have a Ben Nanonote you can get all the required packages here: http://zedstar.org/nibble/. On the Nanonote you will probably need the ALSA config file listed there called asound to fix some playback issues. Just copy it to ~/.soundrc
For a simple test setup just loopback an audio cable from headphone to microphone on a PC running Linux. The spandsp library has a hard limit of 128 DTMF digits set in dtmf.h. This is patched in the Nanonote build.
Share your thoughts
The only library libpackedobjects depends on is libxml2, therefore, it should port to all kinds of devices. Here it is running on a MIPS-based Dingoo A320:
john@macbook:~/git/gitorious/libpackedobjects$ telnet 10.1.0.2
Trying 10.1.0.2...
Connected to 10.1.0.2.
Escape character is '^]'.
_________________________
< Welcome to OpenDingux ! >
-------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
opendingux:/boot/local/home # wc -c menu.xml
860 menu.xml
opendingux:/boot/local/home # packedobjects --schema menu.xsd --in menu.xml --out menu.po
opendingux:/boot/local/home # wc -c menu.po
11 menu.po
opendingux:/boot/local/home # gzip menu.xml
opendingux:/boot/local/home # wc -c menu.xml.gz
310 menu.xml.gz
opendingux:/boot/local/home #
The example rootfs used is available here.
Share your thoughts
libpackedobjects is a C library based on libxml2 which provides XML compression and validation.
libpackedobjects provides a good range of data types for writing network protocols for application in areas such as network management over a wireless embedded internet.
libpackedobjects will run on anything that runs libxml2 such as the Raspberry Pi or iPhone.
A preview release (0.0.1) is available at packedobjects.org
Share your thoughts
There are different ways of compressing XML but I like the idea of doing it with a schema. Using a schema you always have the advantage of validation but you can also produce very efficient encoding of the XML data. I have been working on an XML layer for packedobjects to allow compression of XML data. Currently it takes XML data with a schema written in packedobjects and produces binary data. This is very similar to XER but everything happens at runtime. This means I could support a subset of XML Schema and dynamically map to the packedobjects schema. Doing this the end user will only see an XML world. Everything is handled by embedding Scheme to take care of the mapping between XML and s-expressions. From C you will not see this but you still have the advantage of working directly within a REPL to design your schema if you want. The Scheme layer could also be extended to handle other data formats.
Running the example will show that the packedobjects compression is about 3 times smaller than gzip based compression. In similar tests I have seen similar gains over encoding with Protocol Buffers.
Share your thoughts
Building The Clashing Rocks prototype was fun. It really identified some brick wall challenges surrounding the quantity of data we had to process in real-time. Even encoding to bit-level was not going to cut it. As a result a new direction for the project will be to focus solely on recording the seismic events. This will provide more opportunity to implement techniques to work with the bandwidth constraints in place and will eliminate the hard real-time processing constraints. There will still be the challenge of synchronising, logging and presenting the data but we will focus more on providing high-level APIs and/or a DSL to help realise this. The project will still be OpenWrt based and run on different architectures.
Share your thoughts
This project is about using embedded Linux devices to detect, record and react to seismic events. The idea is to use accelerometers to detect shaking and then communicate this event to all other devices connected to the same broadcast group. We are developing the technology using OpenWrt which allows us to use a range of hardware including routers and pocket computing devices. We really like the idea of exploring emerging low-powered, low-bandwidth mesh networks in developing countries. In this video you can see some early work using a network of Ben NanoNote computers fitted with WPAN hardware. Three devices are connected to a Spread daemon running on a co-ordinating device. Because our current hardware lacks accelerometers we run a program on one device to send fake accelerometer data onto the network. Each device should then pick up this data across our wireless network. We are currently able to get some basic support for IP networking using a hack by Werner Almesberger who also developed the WPAN hardware. In the video you can see the devices display a bar graph indicating it received data. Only one bar is registered as only one device is transmitting. This bar graph could act as a finger print for deciding the scale of seismic activity in a larger network. We intend to add some more intelligence to this part by building a some kind of knowledge system. Currently the project is at a very early stage with some basic infrastructure developed in C. The aim is to extend this infrastructure by embedding GNU Guile. This will allow us to dynamically control how we communicate, store and process the structured data shared amongst devices. Part of this system will involve trying to minimise the quantity of structured data exchanged on the network by serialising to bit-level using Packedobjects.
Further details of the project can be found at The Clashing Rocks wiki.
Share your thoughts
Recently I was revisiting a powerful open source search engine technology on a Ben NanoNote to see how well it performed. Bearing in mind the NanoNote is only equipped with 32MB of RAM and a 336MHz MIPS processor it performed admirably. As a proof of concept I took the PDF lecture slides from three MIT OpenCoureWare undergraduate modules and indexed them on the device. This part of the process is time consuming but only needs to take place once. As you can see from the following video (OGG format), searching the PDFs is rapid and there should be no problem scaling to thousands of documents.
One nice feature of connecting the NanoNote to your PC is that you are able to access the search engine through your PC’s web browser. This becomes close to something I have thought about for a while – a copyleft designed USB flash drive with embedded web server and search engine. This would allow you to take your documents with you and view them using a familiar g**gle style search on any PC you get access to (in theory) without relying on the host OS to do the work.
Share your thoughts
Twitter pulling the plug on basic authentication meant I had to make changes to btlogger to support OAuth. Fortunately, librest made the code changes trivial. However, I ran into some problems. The clock was out of sync on the PC where btlogger runs. This caused the authenticate process to fail at the token request stage and was not easy to debug. The other issue which has been heavily documented is how to support authentication keys in FOSS. Currently configure.ac requires an edit to supply the key information. In theory I could supply the keys to somebody who wants to build the software from source until I figure out another way to handle this. I think they call this “best effort security”.
btlogger is now running from its own twitter account at: http://twitter.com/bluetoothlogger
Share your thoughts
Recently I have been working on Packedobjects which included redesigning the API and replacing a lot of C code in Scheme. I will try and formalize the whole encoding process which I have called Integer Encoding Rules. I also began work on a manual which includes some examples. My aim is to support the tool on OpenWrt which also involves maintaining the GNU Guile build.
I built and tested the software on my Ben Nanonote. The ipk is available: http://zedstar.org/ipk/packedobjects_0.4_xburst.ipk
After improving the documentation I intend to use the tool in a networking course at work. I think it is important for students to gain some experience of designing and structuring binary network protocols. We will be getting a bunch of Nanonotes to compliment the Openmoko Freerunners we have. This will provide some nice hands on experience packing some data and communicating it across different kinds of hardware.
Long term, I am interested in designing some funky SlowFi protocols on copyleft hardware.
Share your thoughts