Memoirs from James Duffy's Sonic Kayak Secondment

Posted June 4, 2018 by James Duffy

At the start of March I joined FoAM Kernow, excited to experience working in ways different to those in academia. I knew that my main focus would be to further develop the Sonic Kayaks project, but that has not been my sole focus during my time at the studio. It has been both refreshing and enjoyable to get involved with the multitude of other projects currently being worked on by Amber, Dave and Aidan (after all the low-tech but easily understandable, wall-mounted, post-it clad project management system is brimming with ventures). I’ve had a great three months which has been a welcome break from the final year of my PhD. This time has allowed me to take stock, think a bit about my future, adopt some new skills and get my teeth into something quite different to my day-to-day work in a university.

Before I started working on it, the Sonic Kayaks system was a functioning entity. FoAM had successfully built a working suite of sensors, run an installation at the British Science Festival in Swansea, and published a scientific paper detailing the hardware and its potential applications. However, after this, the project was ‘mothballed’, and some of my tasks would fall under the umbrella of a mini-revival, aiming to improve functionality, both on the software and hardware side of things.

I’ll start off with hardware modifications (i.e. attempting to waterproof as much of the electronics system as possible). I’ve had some experience of researching the waterproofability of electronics and field kit, mainly due to the coastal fieldwork I’ve undertaken over the past few years. I was fairly familiar with ‘IP’ ratings, which describe the protection of a product from dust and water. After some further reading I found that ‘IP68’ was the label we should be looking for. This indicates “Protection from immersion in water with a depth of more than 1 meter” and as a bonus, “Complete protection from dust ingress”. After a trip to the local chandlery (oh the benefits of living by the sea), I discovered cable glands. Whilst the name is not that appetising, their function is brilliant. They allow the routing of cables through a solid surface, keeping water in/out while allowing cables to pass through. These ingenious pieces of kit would be the key to my hardware improvements. It was really satisfying getting hands on and installing the glands, soldering some of the internal cables, and carefully choosing the positioning of components. Throughout the three months, my newly acquired Bopla Bocube IP68 rated waterproof box became my own little 125 x 231 x 90 mm world, that I could escape to, as and when I please. I’m happy to say that submersion testing in a sink and also after a couple of trips to sea, the box and glands seem to doing the job of keeping everything inside dry, and free from salt and ultimately corrosion.

Another part (and the area I have spent the most time on) is delving into the software of the project, and trying to make ground and improvements where I can. I was first presented with a github repository which turned out to be a prime example of how multiple (I think four) programming languages can be knitted together to make something work as a whole ‘thing’. It was a bit like a tangled web of Lua, Python, puredata and bash criss-crossing to both collect environmental data and provide the paddler with an interesting audio experience. I won’t lie, it was an intimidating sight at first. I had used Python a fair bit before, so naturally it was the code that utilised the language that I leant towards. Now seems the right time to thank Dave and Amber for their encouragement and support, reminding me right from the off to make sure I gain some skills in something I want during my time with them. Improving my programming skills beyond the realms of R was definitely on my to-do list when arriving here, and this was one way I could set about doing just that.

With my geographers hat on (although it’s actually obvious to most), I knew that having reliable and robust location data was crucial to this system and the data it produced. As it stood, the GPS driver was a bit unreliable, and it was proving hard to understand when it wasn’t working, why it wasn’t working. With Dave’s guidance and expertise I have written a brand new GPS driver which logs position alongside metadata such as the number of satellites used to provide said position and also provides outputs based on it’s state (e.g. no driver detected, or no satellite fix). It was really satisfying to see something that I’d made deal with unplugging/replugging, dropping in and out of satellite fixes and others, as a result providing the user with informative logs. This is now a solid foundation which can be married up to data collected with other sensors. Without getting too bogged down in the details of coding, I’ll briefly described some of the other improvements to the software. I rewrote the thermometer driver in python to sit more in line with the GPS driver and adopt proper dates and times for each reading. I collaborated with another member of the Sonic Kayaks team – Jo Garrett, using her expertise to convert hydrophone into data that can ultimately be visualised. An example of this is selecting a set of frequency bands (e.g. large boat engines), and creating a log for every second of the kayak trip, showing the sum decibels (intensity of sound) for that given band. This conversion of raw data into something more visualisation friendly brings me onto another area of software development that I have been chipping away at. What’s the point in collecting all of this information if we can’t visualise it in some way? I have written multiple processing scripts to take raw GPS, thermometer and hydrophone data and produce GEOJSON (web-map ready files). As a GEOJSON, the data can easily be viewed and styled on a web-map. To complete the flow of information from collection to visualisation, I have also tried my hand at learning Javascript, the most popular programming language for websites. With the aid of a library called ‘Leaflet’ (an open-source web mapping library) and a very patient Dave, I have managed to create some basic visualisations of data collected with the Sonic Kayak system. While this is far from a polished end-product it’s a starting point that I hope I or someone else can pick up at some point in the future, hopefully when more fine scale environmental data has been collected.

Please visit the Sonic Kayak repository on Github for all code and a wiki with information about each part of the project.