Ever since I got my hands on a Raspberry Pi, I’ve been meaning to do a real science oriented project with it. Not just a little project that you can have fun with for a while, but an actual practical and useful project. I tried Googling for any similar ideas online, but unfortunately, I didn’t really come across any. I tried thinking of ways I could use it in lab for quite a while, but I couldn’t really think of anything really practical. Until a few weeks ago!
Before I explain my idea, let me give you a little background about myself. I’m a PhD student working in the field of structural biology / biochemistry, and hence my days are filled with purifying proteins and doing research on them. If you’ve had any experience of working with proteins, you’ll know that proteins can’t be stored in water; they need to be stored in buffers. And not just any buffer, the pH of the buffer needs to be set at a particular value, which itself depends on the protein you’re working on. What’s more, that half a litre of buffer you carefully weighed up and made, can get used up really, really quickly! And if it doesn’t get used it up, it will surely get contaminated soon enough! Hence, the never ending cycle of making buffers.
Your experiences may vary depending on your pH meter in lab, but at least for me, adjusting the pH of the buffer is usually the longest and more tedious part. You have to add acid or base drop by drop to make sure you don’t overshoot, and in between each drop you need to wait for the pH meter to detect the change in pH. Long story short, it’s very cumbersome! So here I am, designing a concept that can adjust the pH for me automatically.
How’s it all going to work?
I should point out first, that this is a concept tutorial and I haven’t been able to physically try this out (due to lacking the pH meter kit). There’s two key parts to this project, a way to measure the pH of the solution, and a way to dispense acid or base into the buffer. To measure the pH of the solution is surprisingly easy! Atlas Scientific does an amazing pH probe kit that you can hook up to your Raspberry Pi. The kit comes with the probe to measure the pH, an I2C/UART pH circuit for reading values from the sensor and calibration solutions!
The second important part to this project is the motor to dispense acid and alkali into the solution! This can be achieved rather easily using a peristaltic pump! You can actually find these on Amazon or eBay for less than £15. These same sort of pumps are used in science labs, as well as in aquaponics as a way for watering plants. The ones on Amazon / eBay are in fact made for the latter, and can apparently dispense liquid at very high flow rates (~40 mL/min). The smallest of such pumps contains a 6V DC motor, meaning you’ll need a special motor shield to control it.
RaspiRobot board v2
Monk Makes does a fantastic robot shield called the RaspiRobot board v2 for the Raspberry Pi, for controlling such motors. What makes this shield especially great, is that it has on board connectors such as I2C sockets, and connectors for an ultrasonic distance module. You can even connect Adafruit’s LED matrices for making your project even more awesome! The shield is in fact for driving robots, but re-purposing components is what makes electronics so much fun, so why not?!
To sum it up, here’s how everything will work together: The pH probe will send readings to the Raspberry Pi at regular time intervals, and according to the set pH value, a peristaltic pump connected either to an acid or alkali solution, will be turned on and begin dispensing the liquid into our buffer or solution. For this to work for any scenario, we’d ideally need two pumps. However, as in practice you only use an acid or alkali to bring the pH to your desired value, you could make this work with just one pump. It’s generally a bad idea to add both acid and alkali to your buffer (the only scenario in which this would happen is if you overshoot past your pH), as during the neutralisation process, salt will be produced. As most buffers have tightly regulated salt concentrations, this is something you generally want to avoid!
What do we need?
- Raspberry Pi (any model should do)
- RaspiRobot Board v2
- (2x ideally) 6V dosing peristaltic pump
- Tubing to connect to peristaltic pump (also available from Amazon / eBay)
- 7-9V power supply (e.g. 7.4 V LiPo batteries or 6x AA batteries)
- pH probe and circuit (Atlas Scientific pH kit)
- Breadboard
- Jumper wires and electrical wires
For the power supply, 6x AA batteries are the best choice as they have a large capacity (~1,000 mAh) and are easy to get hold of. Maplin stores in the UK (a fantastic store for an electronics hobbyist, which I recently discovered!) are good place to find battery boxes for AA batteries, amongst others. On the other hand, you could nick a battery from a DSLR (assuming you have one), which happen to be 7.4 V LiPo batteries similar to ones used in RC cars. Nikon DSLR batteries in particular, are more suitable, as the terminal pins are accessible to jumper wires.
Wiring it all up!
First things first, install the RaspiRobot board onto your Raspberry Pi. If you’ve got a Raspberry Pi model B+ or Pi 2, there are more pins on the GPIO header than required. The board should sit, so that it occupies the pins in the corner of the circuit, as opposed to those in the centre. Looking at the board from the bottom (with the power and motor screw terminals at the bottom), connect the negative terminal terminal to the left pin of the power pins pair, and the positive terminal to the right pin of the pair. Hence, from left to right it should be: -ve, +ve. The two motor pin pairs, have negative and positive terminals, but these don’t matter as much. Connecting them in the wrong order simply means the motor runs the wrong way, hence try both ways to see which works for your motor. Ensure you connect the left motor pair to the pump dispensing alkali solution, and the right pair to the pump dispensing acid solution.
For more detail: Buffer and solution pH adjuster with Raspberry Pi