Protecting Picaxe inputs connected to DS18B20 or other 1-wire devices

fortis

New Member
I've found useful tips here for protecting PSU's from transient surges in cars etc. but little shows up in searches re: protecting Picaxe digital inputs connected to 1-wire sensors, which might be outside on a tower or machine and exposed to EMI, lightning etc. The 1-wire buss is powered and bi-directional, so opto-isolation would have to be active and complex, more costly than replacing fried Picaxes if this is a very rare problem. I have seen suggestions about adding TVS devices from ground to the data and +5v 1-wire lines. But in outdoor data-logging applications, a battery-powered Picaxe logger might lack an external ground. What do the experts suggest? Perhaps this not a big worry in practice?
 

boriz

Senior Member
A Faraday cage is the only practical protection from lightning.



Same principle keeps microwaves inside the oven. But to protect from a direct strike, you would need a very heavy gauge cage, otherwise it would melt before all the energy had dissipated. So it’s a tradeoff. But even light shielding will be effective for most EMI. Like shielded audio cable etc.

I often use cheap AV cable from the local pound shop:

 

Dippy

Moderator
Full blown protection for 'everything' is a subject that is beyond 'the scope' of this Forum really and has thousands of documents on the subject.

Boriz has shown a Faraday cage which, in addition to shielding, causes weight-gain and a reduction in dress sense :)

Anyway...

You have already seen suggestions for vehicular supplies. They would show transient, overvoltage and HF protection. Putting your gubbins in a metal box (usually) connected to ground can improve RFI and EMI.

The protection required for external digital sensors will depend on the environment and the distance.
Ignoring close lightning, which be honest could demolish everything, you should consider what may affect your signals.
A simple TVS may protect from overvoltage, but where there is continuous 'noise' induced into the cable then you need something to improve the signal to noise ratio (S:N).
Coaxial cable, twisted-pair or an external metal conduit connected to circuit ground can help.
Maybe electronic buffering/filtering is required.
And, as you have suggested, opto links in the worst cases.
It really depends on the application and your ability to determine the requirements.

For your average domestic settings with a short length of cable it shouldn't be a problem. But if you are running your signal cable near a mains cable then you may need a rethink.

Horses for courses and as long as you aren't doing anything really drastic then you needn't panic - just try it.

And if the noise effects are rare then software parity or resending can usually get over the problem.
But if you think the external influences may be damaging then a TVS or cable shielding may do the job. If this was in conjunction with long cable lengths then I would consider buffering - whic would also protect the PICAXE inputs. But note that a simple TVS does not guarantee that your Data will be uncorrupted.

Lastly, unless your info comes from a Big Boy source then DON'T believe everything you read on Niternet. Just because n.e.one has posted it doesn't necessarily mean it is accurate. Even a 12 year old cut'n'paste expert can post - so be aware.
 
Last edited:

Andrew Cowan

Senior Member
A lightining strike would blow the DS18B20 - I assume you are just trying to protect the PICAXE.

Why not use a 'buffer PICAXE' to connect to the DS18B20? This would read the temperature, and then send it (via optoisolation) to the main PICAXE?

Would cost a bit more per sensor, but provide full protection.

A
 

fernando_g

Senior Member
EMI/RFI protection is both an art and science.

Back in the late 70's, National Semi used to publish excellent app notes which then they compiled in book. In one of those, while discussing EMI/RFI interference, they had a long checklist with items like "ferrite beads", "shielded cable", "small value caps directly across the IC pins", etc, etc.
But the one that struck me the most was the last one: "Pray".

I will add my two yen here. Besides all the useful suggestions above, one that does wonders is keeping your project inside a fully enclosed metal box. Diecast aluminum boxes seem to work very well, and they also protect the circuitry from the weather, which is something you want to do anyways.

Now, if you want to add TVS protection, a device which I've found very useful is the TL7726 Hex clamping circuit. It protects from spikes above Vdd or below ground on 6 individual lines, which makes it compact and cost effective. Check it out at TI's web site.
 

fortis

New Member
Thanks all for the advice. The suggestion of a 'buffer picaxe' by Andrew strikes me as a good idea; for whatever reason one seems to get hung up on the idea that one box/processor has to do everything. Makes sense to have a simple, inexpensive 'sacrificial' Picaxe board outside and collecting data from the 1-wire devices, then communicating by serial connection to a more expensive logger board with display, memory etc. inside. It would be relatively easy to optoisolate the relatively slow serial link. I think PH Anderson has some boards that might already provide a solution.
 

retepsnikrep

Senior Member
Boriz has shown a Faraday cage which, in addition to shielding, causes weight-gain and a reduction in dress sense :)
LOL :D

Anyway I tried and failed to cure noise problems in my hybrid car when using ds18b20 temp sensors, the I2C bus was just too vulnerable and you could not use any sort of isolation. It was a particulary harsh environment and made the average car supply look like a Quad Amp Hifi PSU.

I had to fall back to some LM335 analogue sensors in the end.
 

hippy

Technical Support
Staff member
The solution for DS18B20 and one-wire bus ( same for I2C ) would perhaps be to put the sensor and a PICAXE in its own Faraday Cage ( "metal box" ) then network to the master using more noise immune signalling.

More complicated and expensive than simply running wires to sensors, but in really adverse situations there's often not a lot of choice. If really bad, fibre optics and the like can help.

Similar to as scandens says.
 
Top