I've recently embarked on my first serious electronics project using the Arduino. It's a pump controller for a solar water heater, using a relay circuit to turn on a 12V water pump based on the difference in temperature between two DS18B20 digital temperature sensors. This page has a description of what I'm doing, and wiring schematics (scroll to the bottom).
Everything is working pretty well, except the temperature sensors are often reading -196.60 when the pump is on (relay closed). When the pump is off (relay open), the sensors return correct readings every time. I suspect it's because (1) The relay is powered by the 5V pin from the Arduino, and (2) The sensors are using the same 5V power source, running in "parasite" mode (signal and power on the same wire).
I've tried using a longer sampling interval, but I get the same behavior whether the sensors are polled every 1 second, 30 seconds, or 60 seconds. I've read that the DS18B20 has an internal capacitor which allows it to hold a charge long enough to send its data across the wire--could it be that the capacitor is failing to charge when some of the 5V is powering the relay? I've also read that when these sensors have problems in parasite mode, it may help to use a lower pull-up resistance (mine's currently the recommended 4.7Kohm).
For now, I'm handling the problem in software by just ignoring the bad readings--I still get enough good readings that it works anyway--but I would like to learn about how the relay and sensors might be interfering with each other, and how to fix it. I'd appreciate any advice!


