Re: 18B20 and cable length
I did something like this and it worked. I had a 10µF tantalum capacitor close to the DS18B20. I don't remember exactly but the 10k pull up was close to the sensor.
Re: 18B20 and cable length
Thanks for the advice. I've done some reading and it seems that lowering the resistor value to something like 2K, and placing that near the DS18b20 rather than the PIC should work. I'll try this later as the device is currenty controlling the heater in an incubator, amd don't want to risk the eggs getting too cold whilst I try and mod the PCB etc
Re: 18B20 and cable length
10K is too high. I have successfully run 50' with a 2.2 K driving directly from the pin of the PIC (resistor at the PIC end of the wire). There are also circuits that use transistors to more aggressively pull up for long range or multiple devices on the bus.
Re: 18B20 and cable length
FWIW the data sheet says 4k7
George
Re: 18B20 and cable length
Charlie , George, thanks for the inputs. Once the eggs have hatched (approx 4 weeks time) I'll be able to change the resistor values without any impact. I'll stick 2K2 in to all of the 4 inputs so it won't matter which input I use for the long run sensor
Re: 18B20 and cable length
Quote:
Originally Posted by
towlerg
FWIW the data sheet says 4k7
George
George, thanks for the advice. I made the mistake and installe dthe wrong value resistors. 4K7 is indeed the correct value, but I had to wait until today to try it out as I was using the habistat controller to run the reptile incubator and had to wait for the eggs to hatch. Now that's over I have changed the resistor for a 4K7 and the sensor is working fine over the cable length and the controller has been running fine all day
http://micro-heli.co.uk/controller2.jpg
Re: 18B20 and cable length
It's great that you've got it going, Malcolm. The datasheet talks about 5K as sort of a maximum value, optimal for a single device but there are all sorts of conditions where you'd want it smaller. If you are running in parasitic mode with a long lead, if you have multiple 1-wire devices on the same bus, if you are running at lower voltages (say 3.3 V), you will find you need to lower that value. The datasheet has an example circuit for effectively lowering the value to near zero while the device takes it's reading. Bottom line is that there isn't a single best value.
So if you have 1 device on the bus, running at 5V, not in parasitic mode, 4.7K is perfect. If you have a different configuration, and you have troubles, try lowering the resistor to 2.2 K. Larger values like 10 K are unlikely to ever work, as you discovered.
There's a lot of discussion online about these devices including a couple application notes that talk about these exceptions.
Re: 18B20 and cable length
Thanks for the additional info Charlie. Yes I'm running at 5v and each sensor is on it's own pin on the PIC.
The controller was installed at the weekend. It sits on a stack of three vivariums, with the fouth being a large 160cm x 50cm x 50xm the other side of the room. The cabling for heater, light and two sensors are routed in trunking over the door and along the skirting board to the unit
http://micro-heli.co.uk/vivstack.jpg
I've updated the schematic and PCB drawings to use 4K7 resistors... Where I got 10K value from I don't know !