SpiroBoard Aeroponics pH / EC / Motor Controller

A Raspberry PI HAT designed to control an aeroponics tower system

Similar projects worth following
The SpiroBoard along with software running on the Raspberry PI monitors pH, Electro Conductivity (EC), air temperature and water temperature. It also controls a 12V 6.5A water pump and a motorized valve. The board monitors the pump current to estimate the water pressure and detect clogged filters or spray nozzles. As a bonus, it also provides 5V at 1.5A to power the Raspberry PI. The board is powered by standard 12V/8A supply with a 5.5 x 2.5mm coaxial power plug.

I am currently debugging the board and will fill in more details in the project log below as the process continues.

The internet has a dizzying amount of information on EC and pH. After sifting through it, I found some potentially interesting links that are detailed below.

The DIY EC meter project that inspired the EC portion of this design

A tutorial on EC probes

A DIY EC sensor project with with lots of great information and links

The Difference between EC and PPM

Tutorial on how to verify the operation of a pH probe

A comparison of commercial pH calibration buffers


This is the original schematic for the PC board. While debugging, I found a few problems that require a bit of surgery on the board. I will upload a new schematic when I have finished debugging, assuming that the patient lives.

Adobe Portable Document Format - 86.23 kB - 02/16/2017 at 13:54

Preview Download

View file

  • 1 × Sensorex pH1000 pH Probe After trying several pH probes, this one seems to be a good quality probe at a reasonable price

  • When the Chips Hit the Fan

    Chris Johnson03/14/2017 at 03:15 0 comments

    I received my AD8648 op amps from Digikey. For small orders weighing 13 oz or less (including packaging), you can't beat their price of their first class USPS shipping. I get my orders on the east cost within two or three days for only a few dollars. Replacement chips in hand, I removed and replaced the op amp, but the EC circuit still doesn't quite work. Because of the higher gain of the AD8648, there are now occasional oscillatory bursts at the peak circuit op amp output. These only occur when the op amp amplitude is relatively low, which happens at low EC values. The net result is that the peak circuit can not measure EC peaks that are lower than the noise burst, because it instead captures the noise burst. But, I still have other chips to fry.

    As a general rule, when debugging a board, until I am very sure that it is operating correctly, I power it with a current limited supply that has an output current and voltage display. This helps get an idea of the normal current draw for the board and protects from accidental short circuits. In this case, on one particular power up to continue looking at the oscillation problem, the power supply started current limiting at about 1.5V / 1.5A. Previously, it had hovered around 5V / 150ma, even with the Raspberry Pi running. Feeling the chips, the VCOM regulator (REG2V5 in the schematic) was hot. I measured the resistance between VCOM and GND and it was about 1 ohm. I lifted the VCOM pin on REG2V5 and VCOM was no longer shorted to 2.5V. So, I replaced REG2V5, powered up again, and the supply STILL current limited and the chip STILL got hot. Very depressing. After desoldering and lifting various pins on the +12V_IN net, I determined that the 12V input to REGA5 was shorted to the 5V output. Chips rarely die unless something actively kills them. I could not think of anything that I had done to cause this poor chip to short itself from input to output. It's only providing a few tens of milliamps of current to run the analog portions of the circuit.

    Through the years, I have found that keeping a good debug log is often helpful. Just the act of writing down your thoughts about what you know, what you think might be happening, what you think you changed, etc. can sometimes help you find a solution. In this case, the answer did not actually hit me until I was writing up this project log entry. As I typed the sentence above about checking the 12V net, it occurred to me take another look at the TPS73250 (REGD5) voltage regulator datasheet. Low and behold, I blew it. Literally. I blew up REGA5 by driving a 6V absolute max input with 12V. The valiant TPS73250 ran for weeks of testing, providing a nice regulated 5V output, until finally giving up the ghost and shorting from input to output. That of course put 12V on the input to the VCOM regulator (REG2V5), blowing it up as well. So, I need to figure out a way to limit the input to REGA5 to around 6V and to replace REGA5 and REG2V5 (again). Another debugging rule, always order a few spares. Ultimately, I will probably have to replace REGA5 with an LDO that supports 12V input ... and remember to read maximum input voltage specifications more closely. Once I get the power supply issues fixed, it will be back to solving the oscillation issue on the AD8648 peak detect circuit.

    An old Linear Systems professor of mine once said "Life is a series of transients waiting to die out". That was certainly the case for the poor LDO that gave its full measure in support of the Spiroboard debugging effort.

  • Peak Performance

    Chris Johnson03/08/2017 at 04:00 0 comments

    Below is a picture of a patch that gates the input to the ADC so that it is only looking at the value from the EC probe at the end of the square wave pulse, after the initial transient has settled out. It works really well, dutifully recording the voltage at this point for each pulse and averaging the values together with an RC filter. Unfortunately, this does NOT provide the correct EC value. After a lot of Googling, head scratching, and teeth gnashing, I think have a better understanding of how to measure EC.

    To measure the correct value for the EC, instead of measuring the voltage at the end of the pulse, you need to measure the peak voltage at the start of the pulse. As shown below in a snippet from an LTSpice schematic, you can simulate the effect of a real EC probe by putting a capacitor (C11) in series with the simulated EC resistance (R4). In the plot to the right, the red trace is the DIFF output from the op amp and the green trace is the output of the subsequent peak detect stage. The average value of the peak detect is very close to the lower voltage peak of the DIFF output. The peak DIFF voltage is due to the current that initially flows through the solution as the ions begin to separate due to the voltage across the EC probe. As the solution "charges up", the current flow through R4 drops. Eventually the op amp behaves like a voltage follower, since R4 is essentially an open circuit. The DIFF level at the end of the pulse is thus the same as the 100mv square wave that drives the non-inverting input. Note that the peaking effect is most pronounced with high conductivity solutions.

    In the above circuit, the pulses are running at about a 500 Hz rate. In the final circuit, in order to provide a more accurate peak detect function, the pulses will run at about 5 KHz. As you can see from the frequency response plot for the MCP3428 ADC, the low pass filter has about 60dB of attenuation at 5 KHz. As a result, the ADC will record the average value of the peak detect voltage without any additional external filtering.

    I made another patch to the board and verified the basic operation of the peak circuit. Using my home made EC probe, the ratio between the EC values measured for two test solutions is very close to the ratio measured using an off the shelf EC meter. During testing, I determined that the LMC6484A is not quite fast enough to accurately detect the peaks in all cases, so I am changing to an AD8648 op amp. It is pin compatible and has about 10 times the output slew rate. It also has a 1 Tera Ohm input impedance to support the pH probe. Once I change the op amp and make a few more tweaks, I hope to finally verify that the EC circuit works correctly. I will update and post a new schematic after testing is complete.

  • EC or not EC: that is the question

    Chris Johnson02/21/2017 at 15:05 0 comments

    For some reason, EC probes are relatively expensive. In most cases they are more expensive than pH probes, which to me seem a lot harder to make. So, I decided to make my own EC probe, as you can see below:

    The contacts are gold plated Studex ear piercing studs, which are made in the USA and only about $1 each. Gold is good for EC probes because it does not tarnish. The studs are pushed through a piece of 4mm O-Ring cord to waterproof the electrical contacts. The tubing is 6mm OD x 4mm ID flint glass, which is about $0.25/ft if you buy a 1 pound pack. It is very easy to snap to length. Here is a great video about how to cut and fire polish glass tubing. I would recommend a triangle diamond needle file for scribing. I got this set at Amazon and they worked fine. So, for less than $5 worth of parts (ignoring shipping, tools, and unused material), I was able to make an EC probe.

    I had previously verified that the Spiroboard EC circuit could correctly measure the calibration resistors that can be switched in to the circuit under control of the Raspberry PI. By doing a best fit line to the calibration resistors, the circuit could also measure a random resistor plugged onto the EC input to within about 0.5%. So, I though there would be no problem getting the circuit to measure the EC of a real solution.

    This is where the "not EC" part comes in. Every EC probe has a K constant that is based on the geometry of the probe contacts. For simple probe geometries it can be calculated. You can also work backwards from measuring several known conductivity solutions to calculate the K factor. This is what I attempted to do for my DIY EC probe, unsuccessfully.

    After a lot of poking around and wiping up spilled calibration solutions, I found the problem. The scope screenshots below show the input to the AC-to-DC portion of the EC circuit when measuring a resistor (left) versus measuring an actual solution through the EC probe (right, but unfortunately wrong). The peaking is caused by the capacitance of the EC probe and the solution. The peaking breaks the linear relation between resistance and the output of the AC-to-DC circuit. The original circuit that I based this on used a sinusoidal oscillator. My assumption is that it does not have a similar problem because the relatively slow rise of the sine wave masks the peaking effect. Bottom line, the EC circuit as designed can not accurately measure the EC for real solutions.

    But, all is not lost. A solution (pun intended), is to dispense with the AC-to-DC circuit entirely and just directly measure the DC voltage after the peaking has settled out. I successfully Spice simulated a circuit modification and now need to figure out the best way to patch the board to support it. Since the ADC now directly measures the output of the EC amplifier, this method could potentially be more accurate than the AC-to-DC version.

  • pH and EC Circuits Tested

    Chris Johnson02/17/2017 at 22:47 0 comments

    I just got the pH portion of the circuit working. There actually wasn't anything wrong with the circuit. It turns out that the probe that I was initially was using was bad. I tried a different brand and it worked perfectly. The working probe is listed in the Components section of the project. It's quite reasonably priced.

    I also verified the operation of the EC circuit using resistors in place of an EC probe. In order to test the conductivity of actual solutions, I am in the process of making a DIY EC probe using, believe it or not, ear piercing studs. They are gold plated stainless steel, only about $1 each, and have a pointed end that plugs very nicely into a gold plated Mill-Max machined pin contact (see image below). Correctly waterproofed, I should be able to make a cheap EC probe with replaceable contacts. Once I have it working, I will add a separate project on how to make your own EC probe. In the true MacGuyver spirit, perhaps I'll waterproof it with chewing gum.

View all 4 project logs

Enjoy this project?



Does this project spark your interest?

Become a member to follow this project and never miss any updates