Photocatalysis with a Raspberry Pi

Access to clean, safe drinking water is a global problem: as notes, 663 million people lack access to water that’s safe to drink. That’s twice the population of the United States, or one person in every ten. Additionally, a recent review of rural water system sustainability in eight countries in Africa, South Asia, and Central America found an average water project failure rate of 20-40 percent. It’s no surprise that the search for a solution to this crisis preoccupies scientists the world over, but what you may not have expected is that, in a lab in Cardiff University, researchers are using Raspberry Pi to help in their efforts to bring safe drinking water to some of the poorest areas of the world.

A tap set into a wall, with sign above reading "SAFE DRINKING WATER"

There are three processes involved in water purification, two of which are reasonably straightforward: filtration can remove particulate matter, while heating water to near 100°C kills bacteria. However, the third process — the removal of highly toxic hydrocarbons, typically from fertiliser and pesticide runoff — is very difficult and, currently, very expensive. The Cardiff group is working on a project to find a cheap, effective method of removing these hydrocarbons from water by means of photocatalysis. Essentially, this means they are finding a way to produce clean water using little more than sunlight, which is really pretty mind-blowing.

Here’s a picture of their experimental setup; you can see the Raspberry Pi in its case on the right-hand side.

A laboratory photocatalysis setup at Cardiff University: on a bench are a beaker of water dosed with methylene blue "pollutant" under UV LED illumination, semi-transparent tubing connecting the contents of the beaker to a flow cell, a Raspberry Pi, and other components.

Raspberry Pi in the lab

A cheap, readily available chemical, titanium dioxide, is spin-coated onto a glass wafer which sits in the bottom of the beaker with a UV LED above it. This wafer coating acts as a semiconductor; when UV photons from the LED strike it, its electrons become mobile, creating locations with positive charge and others with negative charge. As a result, both oxidation reactions and reduction reactions are set off. These reactions break down the hydrocarbons, leaving you with pure water, carbon dioxide, and hydrogen. The solution is pumped through a flow cell (you can see this in the centre of the picture), where an LED light source is shone through the stream and the amount of light passing through is registered by a photodiode. The photodiode turns this output into a voltage, which can be read by the Raspberry Pi with the help of an ADC.

The team are currently using two organic dyes, methyl orange and methylene blue, to simulate pollutants for the purposes of the experiment: it is possible to see the reaction take place with the naked eye, as the colour of the dye becomes progressively less saturated. A colourless solution means the “pollutants” have been entirely broken down. You can see both dyes in situ here:

Laboratory photocatalysis setups at Cardiff University: on a bench are a large LCD display with a desktop showing the Raspberry Pi logo, beakers of water dosed with methyl orange and methylene blue "pollutants", semi-transparent tubing connecting the beakers' contents to flow cells, a Raspberry Pi, and other components.

Experimental setup with methyl orange and methylene blue

In previous versions of the setup, it was necessary to use some very large, expensive pieces of equipment to drive the experiment and assess the rate and efficacy of the reaction (two power sources and a voltmeter, each of which cost several hundred pounds); the Raspberry Pi performs the same function for a fraction of the price, enabling multiple experiments to be run in the lab, and offering the possibility of building a neat, cost-effective unit for use in the real world in the future.

Several of the team have very personal reasons for being involved in the project: Eman Alghamdi is from Saudi Arabia, a country which, despite its wealth, struggles to supply water to its people. Her colleague Jess Mabin was inspired by spending time in Africa working with an anti-poverty charity. They hope to produce a device which will be both cheap to manufacture and rugged enough to be used in rural areas throughout the world.

Jess, a research scientist, smiles as she pipettes methylene blue into a beaker that is part of her group's photocatalysis setup.

Jess demonstrates the experiment: methylene blue going in!

As well as thoroughly testing the reaction rate and the lifespan of the wafer coating, the team are hoping to streamline their equipment by building their own version of a HAT to incorporate the ADC, the photodiode, and other components. Ultimately the Pi and its peripherals could form a small, rugged, cost-effective, essentially self-sustaining device which could be used all over the world to help produce clean, safe drinking water. We are really pleased to see the Raspberry Pi being used in this way, and we wish Jess, Eman, and their colleagues every success!

Edit: We’ve just received this time-lapse of the experimental setup at work (filmed using a Raspberry Pi Camera Module, no less!); you can check it out below:



karan avatar

This is probably one of the best uses for the raspberry pi.Congratulations to the team and all the best!

bluecar1 avatar

couple the hat to a pi zero and one cheap system

Mohamed Meerasahib avatar

It is really wonderful project.It is happy to see that Raspberrypi pave the way to such kind of charity project.God may bless The people involved in this project.

Richard Sierakowski avatar

A truly excellent development and I wish the team every success with it.

This is the time to ensure this project is firmly rooted in a very secure setup and that a hardened Linux operating system is deployed when it moves out into the field.

It is essential to deny access to malicious actors who would seek to harm the end users for either political or religious objectives.


Andrew C avatar

That’s possibly a little more ‘tin-foil (RaspberryPi) Hat’ – pardon the pun – than is relevant at this stage.

[One wouldn’t generally, say, evaluate/critique a clever small appropriate-tech desalination widget design by analyzing the security issues of the CPU in the PC running things. (And ‘paranoid-case’ – there’s no particular reason the RaspPi here needs to be network-enabled, and the code-base is small enough to be verifiable.)]

Basically: the scenario of ‘terrorists might kill us [insert persecuted target category here] by hacking the code of our small-scale water purifiers’ has an awful lot of zeroes to the right of the probability decimal point. Especially in the *overall* threat-space. (And a separate, hard-wired sensor or two might just take care of the issue….? >;-)

(This is a good place to insert some placeholder thoughts on Bayesian analysis, failure engineering — and just plain common sense… It’s fun and dramatic to talk about lightning/meteor-strike vulnerability scenarios, but not particularly *useful* — in fact mostly distracting and sensationalist, in *most* cases.)

paddyg avatar

Presumably the final product will use that abundant source of free UV light that is generally available in countries with scarce drinking water. A UV LED isn’t going to go very far. (couldn’t see any mention of this, but may have missed it)

paddyg avatar

PS, just seen that you do mention sunlight right at the start. Oops, pay no attention to me.

AndrewS avatar

I spy a Gertboard in the bottom picture ;-)
Higher-precision ADCs (if needed) can be bought from e.g.

Great project, I wish them the best of luck with it.

MalMan35 avatar

That is amazing! Keep up the good work!

Fester Bestertester avatar

I’m wondering: if this process sits between filtration and heating, and uses sunlight, might heat from the sunlight accelerate the catalysis, and add to the efficacy of the (presumably also sun-powered) heating to near-boil, with an overall benefit to the whole process? Simple enough to research, if not already … :)

Hacker X avatar

Speaking of the use of sunlight. It seems like the whole world has forgotten about solar stills. Small ones may not produce much clean water per day but they are cheap to make, exceedingly simple to understand and use, and certainly better than nothing. They are the kind of thing that might not do the whole job but they sure would help a lot of people and could be used in addition to other methods.

Seeing as how some people seem to think sea salt is the greatest thing to ever arrive in kitchens I see a big opportunity. Set up stills along the coast and let the tide bring in salt water through a pipe with a one way valve. Use solar cells (and possibly hydro electric) to operate any pumps necessary to move the clean water to trucks or directly into the public water supply. Once enough salt is collected sell it off to help cover the cost of construction.

AndrewS avatar

Yup, there’s some places that already do that :)

Bob LeSuer avatar

Measuring the decomposition rates of dyes (either through chemical {bleaching} or photolytic processes) is a common laboratory experiment in the undergraduate Chemistry curriculum. What I find significant about this post is that the Raspberry Pi makes this experiment more accessible. Due to the low costs, an instructor can provide a greater “scientific instrument – to – student” ratio in the laboratory. Additionally, the “physical computing” aspects of this type of project transform what could be a textbook “push this button on an expensive instrument; get this result which you could find on the internet” experiment into a systems-based project steeped in scientific inquiry. Add a cheap peristaltic pump, a home made spin-coater (fan and magnets from old computer) and perhaps a Peltier cooler and you’ve got yourself a (very affordable) setup that can teach a majority of the Introductory Chemistry lab concepts (thermodynamics, kinetics, oxidation/reduction) while incorporating engineering design principles and a bit of coding. Nice work. Now if you’ll excuse me, I have a lesson plan to write….

Andrew C avatar

“Home-made spin coater from fan/magnets from old PC” — I get the fan/magnets bit, but could you provide pointer(s) to actual spin-coating process that’s doable at / equivalent to this DIY tech-level?

Thanks! Look forward to your lesson-plan write-up. ;-)

Helen Lynn avatar

If anyone finds, like I did, that they’d like to revive their fading memories of A-level/undergrad physics/chemistry and understand more about how this works, they might like this:

Harold avatar

Great idea and a convincing proof-of-concept! Next step hydrocarbons and pesticides. Best wishes

James avatar

I remove the WIFI from desk top how can I find it HELP.

Devin avatar

Do they show data on these experiments somewhere, especially a control? Don’t want to be a buzzkill, but methyl orange and methylene blue will break down under UV light even without a catalyst. I’d like to see the control rate vs catalyzed rate.

Richard Hodgkiss avatar

Arsenic contamination of groundwater is a big deal in some parts of the world, especially Asia. What will that do to your catalyst and have you any plans to try to remove arsenic ? As a minimum I’d think that you’d want to make sure that you don’t make the problem worse by mobilising Arsenic bound to particulates.

Comments are closed