Aquaponics pH to 1-Wire Converter – Part 2

This is the first draft of the pH to 1-Wire converter schematic, and some of the component values are still missing. The original circuit runs on 12 VDC, but since the A/D converter IC must be supplied with 5 VDC only I want to scale down the circuit, so that 5 V is the maximum voltage present. I assume I would have to tweak some resistor values in order to make the circuit run at this lower supply voltage, but I haven’t looked into the details yet. I’ll post an updated schematic and the calculations later.

ph_1wire_1.png

(Click on the picture above for a larger version.)

These are the source files:

gEDA schematic, .sch and .pdf:
ph_1wire_1.sch ph_1wire_1.pdf

gEDA symbols, DS2762 and BAT54S:
DS2762-1.sym BAT54S-1.sym

The original idea was to use a 1-Wire A/D converter with built-in 1-Wire digital interface, but the one I found was not recommended for new designs. This is what Maxim writes about the DS2450 A/D converter:

This product is Not Recommended for New Designs. Some versions may be No Longer Available or being discontinued and subject to Last Time Buy, after which new orders can not be placed.

Also known as ‘NRND’. Most of the other A/D converters I found at Maxim had another interface, but the main IC on the soil moisture sensor board from Hobby Boards also converts analog signals to digital and that’s a DS2760. The updated version is called DS2762, which is the one that I have used in the new circuit.

The DS2760 on the soil moisture sensor board measures current, but the IC also has a voltage input pin. The IC is actually a ‘High-Precision Li+ Battery Monitor With Alerts’ as Maxim calls it. The idea is to only use the voltage input pin and 1-Wire interface to get a popular, and cheap, A/D converter, with high input resistance.

Since the DS2762 operates on 5 VDC, the ground reference for the amplifier section should be changed to 2.5 V instead of 7 V in order to use the entire input voltage span of the A/D converter. The 7 V in the original circuit was meant to be measured with a voltage meter and you would have the pH value directly as a reading (pH 7 = 7.00 V, pH 8 = 8.00 V etc.). There’s no meter or display on this new circuit, only data delivered to a computer via the 1-Wire interface, so voltages in the circuit can be converted to something meaningful using software on the computer. Historical data can be displayed with e.g. RRDtool.

When the supply voltage is changed, the gain of the voltage amplifier has to change too, along with a change in offset voltage, i.e. ground reference. IC300 is a dual op-amp IC, where R351, R352 and R355 determines the gain. R300 sets the ground reference voltage level. Apparently it is necessary to put in trimmer resistors, since practical op-amps are not perfect like theoretical ones. Also, the pH probe is worn down as time goes by, and the circuit will have to be calibrated regularly.

Several capacitors have been added to short circuit any fast changing signals as these are irrelevant to aquaponics pH measurements and any alternating currents are considered noise in this respect. It means that the pH values from the 1-Wire interface will need seconds to stabilize. D101 is included to protect the 1-Wire interface.

Since the schematic does not represent the PCB layout, a note has been written about the seemingly long wires going from the BNC connector to the op-amp. On the actual PCB the traces must be as short as possible, because the internal resistance of a pH probe is very high and any electromagnetic radiation will induce relatively high unwanted voltages in the circuit. It shouldn’t be a problem though to place IC300 close to J300.

DS2762 has a general purpose I/O pin (PIO) which can be used for debugging. D100 could be connected to this pin to be able to signal something, but it would probably need an extra transistor. As I want things to be as simple as possible I haven’t included this, but at least there’s a resistor footprint to work with now.

I want to experiment with the values of R351, R353, R354 and R355 in Qucs, as I don’t fully understand the impact of changing the supply voltage, hence the missing resistor values. But I don’t mind – Qucs turns out to be an awesome piece of software for the electronics hacker ;-)

1-Wire USB on a Long Ethernet Cable

Units on 1-Wire bus must be connected in a daisy chain, which means you’ll have a lot of different connection points along the bus cable, in my case an ordinary Ethernet cable. This has been a problem for me earlier since my cable was placed outdoors for air and soil temperature measurements, and soil moisture measurements. I actually need a connection point to the 1-Wire bus at each unit I connect to the cable, because of the daisy chain topology. In order to make these connections somewhat weatherproof I chose to solder any cable joints together and cover it with heat shrink. This has worked well and my old outdoor system collected data for almost a year, before I took it down again when I had to move to another house.

But the soldered joints also gave me problems, because it was hard to make adjustments afterwards, like moving a unit, because the cables would have a fixed length, or taking a unit indoors for repair. This can of course be solved by investing in high quality outdoor enclosures for each unit or cable joint but since this weather data collection project is a hobby there not any immediate return on this relatively large investment. However, if you are getting paid to build this, you should be aware that the system would have a much longer lifetime if you mount the units and joints in a weather proof enclosure. But let’s stick with the hobby type of project for a while.

I wanted to make it easier to modify the physical setup of the system, and one of the easiest ways to connect wires is by using terminal strips:

(There’s a DS18S20 1-Wire IC wrapped in heat shrink to the left in the picture.)

The 1-Wire bus uses only 2 wires (?…) for communication and power transfer. (I guess the name is referring to the communication part.)

A small test showed that the bus worked just fine through the terminal strip (and 17 m ~ 56 ft of Ethernet cable), which makes my life a whole lot easier, as I’m now able to modify the physical setup in many ways, without going outside with my soldering iron in the middle of the snow to replace a unit – brrr… Just bring a screwdriver.

For soil temperature measurements I have glued a DS18S20 temperature sensor onto an aluminium sheet. Note the two cables due to the daisy chain topology:

I assume that the metal sheet will give a good average temperature as is has some mass and therefore filters out high frequency temperature changes. The large area helps averaging the temperature too.

This is all of the components in the 1-Wire system so far:

  • To the left: DS18S20 temperature sensor, for air temperature measurements
  • Aluminium sheet: DS18S20 temperature sensor, for soil temperature measurements
  • In the middle: DS2760 PCB, for soil moisture measurements
  • To the right: Watermark soil moisture probe

The DS2760 PCB has been installed in my previous garden, in a cheap plastic enclosure, wrapped in a plastic bag, but the PCB survived for several months in all kinds of weather. It still looks new with no corrosion at all. The plastic enclosure has changed color due to sunlight:

I’ll also be using terminal strips for this unit and see what happens regarding corrosion.

The soil moisture sensor part of this system is a bit special because the circuit board needs 12 volts to function, which I’m injecting into the Ethernet cable using the brown wire pair, next to the 1-Wire bus carried by the blue wire pair. The extra voltage is generated by a generic mains adapter, protected by a fuse (red and black wires in the picture below):

I have mounted the sensor for air temperature measurements on a stick and covered the sensor with a small cap with tin foil on it to reflect the sun:

I also need a barrier between the soil and the soil temperature sensor (hopefully this is not a biodegradable plastic bag ;-) ):

The soil moisture sensor circuit is tied to a stick and covered with a plastic bag to provide some protection from the weather:

Again, if you want a more reliable setup you should use a weather proof enclosure, but I haven’t experienced any problems so far, although it would be an obvious upgrade to make in the future.

The NSLU2 is placed indoors to protect it against the weather, but I have to get the signals and power outside to the sensors, so I have to go through the window. Since this is a rented house I don’t want to drill large holes in the window frame, so I have removed the extra four wires in the Ethernet cable to be able to close the window without cutting any wires accidentally. Using two different sizes of heat shrink I’m able to make a pretty discreet transition from the indoor to the outdoor environment:

There was already a not so neat looking satellite coax cable going through a hole in the window frame, so adding an Ethernet cable is not big deal, although it’s beginning to look messy:

Rather discreet looking 1-Wire cable outside (the two cables in the top are existing coax cable for satellite):

I have dug a 25 cm (10″) deep hole in the ground for the Watermark soil moisture sensor and the temperature sensor on the aluminium sheet, and once I have calibrated the soil moisture sensor the hole will be filled with soil again and the system will collect data over the winter:

The air temperature sensor is also in place and ready to collect data:

Now I’m going to work on the OWFS software setup on my Debian NSLU2.