DS18B20 vs. "El Sid" PV pump

I am trying to remotely monitor temperature to control a 12v/5w circulation pump. So far it is mostly working. I have one temperature sensor on the end of 30ft of 18awg 4-wire "sprinkler" cable using the non-parasitic mode. A second sensor is on a different end of the same wire but only 5ft away, and a third sensor attached direct to the prototype board. The arduino triggers the pump via a 2n3904 transistor which drives a 12v relay. The whole setup is running from 12v switchmode supply with separate leads feeding the Arduino and relay/pump. Before I added the transistor/replay/pump into the mix, I had tested the temperature sensors and had zero failures during a few weeks of testing. Now that I have the pump in the circuit, there are about 6 or so failures (Random temperatures from -60f to 1930f which all seem to occur only when the pump is active. The pump runs for maybe 10 or so minutes at a time but temperature readings are done from one of each of the sensors every 3 seconds. The failures are far and few between. Any ideas where I should look?

You say:

The whole setup is running from 12v switchmode supply with separate leads feeding the Arduino and relay/pump.

Does that mean separate gound wires, too?

I'd look to see where the motor and relay return current is going, making sure it doesn't go down the same wires as the return for the sensors / Arduino.

Mike

You might also put a volt meter across the power and see if it sags when the pumps go on.

The pump ground runs directly to the pump from the power supply. The pump positive connects the pump to the power supply thru the relay contacts. The 12v positive then jumps over to one leg of the coil. The relay is configured to be N.O. until the arduino requests the pump to turn on. The other leg of the coil is pulled to ground by the 2n3904 transistor. Prior to this message, the transistor ground was supplied by the Arduino shield. I just moved it to a third ground direct to the power supply.. The current that was passing thru that wire was a measly 34ma which is the coil current of the relay. Time will show if that has any effect. There is no voltage sag at the power supply. it has 25a of available current @12v & the pump only needs 5w @ 12v. It's an inductive/ frequency drive motor so the more voltage available the faster it runs.

Testing today revealed the following: I had 4 failures during my testing. at least today, it was always the sensor at the furthest point from the arduino (Previously I had seen one of the other sensors failed maybe once during a day). It always failed when the pump was on... but neither immediately after the pump turned on or before it turned off. The pump runs for maybe 10-20 minutes at a time and each failure was some time roughly a few minutes after the pump turned on.

I should try putting a small capacitor across the relay contacts to suppress any turn on spikes. However it looks like something is being picked up on the sensor wire. The choices are either to prevent the pickup or suppress it once it has been picked up. You might try connecting the sensor up with screened cable and running the motor power cable as far away from the sensor cable as possible. You could add a very small capacitor across the sensor input wire at the Arduino end. It needs to be small so as not to interfere with the normal working of the system but big enough to do some good. I would also put two catacher diodes from the sensor input to each of the supplies again at the Arduino end to clamp any positive and negative spikes that are picked up. If trouble still persists then a low value series resistor should be placed in line with sensor input with the capacitor on the Arduino side. These things are tricky but can be overcome - best of luck.

I do have a clamping diode across the relay. I can add a 330uf or similar cap from coil to ground.

For the capacitor at the sensor cable, might something like a .1uf work?

What are catacher diodes? Zener? When you say connect to each of the supplies, do you mean one between sensor and ground and one between sensor and vcc? Or one each from sensor to vcc and sensor to +12v

When you say low value series resistor… do you mean less than 100ohms? or less than 1 ohm?

I do have a clamping diode across the relay. I can add a 330uf or similar cap from coil to ground.

Yes but that is probably not necessary, but also something like 0.1uF across the relay contacts themselves, as close to the contacts as you can get, this will quench any possible sparks from the motor load.

For the capacitor at the sensor cable, might something like a .1uf work?

I would have thought that would be too big, you have to make sure you don't degrade the signal edges. I would try 10nF to start with but see what you can get away with and it still work.

What are catcher diodes? Zener? When you say connect to each of the supplies, do you mean one between sensor and ground and one between sensor and vcc?

Yes, they are just ordinary signal diodes not zenners, arranged so that normally no current is flowing through them. (that is cathode to signal line anode to +ve & anode to signal line cathode to 0v) These prevent signals getting bigger than or less than the power rails of the Arduino. If the signal is greater than the +ve supply the diode conducts and stops it getting higher than 0.7V above the supply. Similarly a -ve spike gets clamped to just -0.7v. Pickup signals can often do this and mess up the receiving circuits.

When you say low value series resistor.. do you mean less than 100ohms?

Yes try 47R to start with.

It is a bit of a black art but with the application of a few standard techniques you should get it going.