View previous topic :: View next topic |
Author |
Message |
championx
Joined: 28 Feb 2006 Posts: 151
|
ONE-WIRE problem |
Posted: Tue Dec 10, 2013 6:37 am |
|
|
Hi guys! im testing a one wire circuit. It measures 4 temperatures and get the serial number from a DS2401. The thing is when i use a long cable, it only works with 2 sensors, when i connect the third it wont work anymore.
It seems that the long cable is causing some degradation in the data signals. It has to work in parasite mode.
Do you have some sugestion??
thnaks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Tue Dec 10, 2013 6:45 am |
|
|
comments.
What value do you have for the pullup resistor?
In the datasheet you'll read it has to be smaller for more devices and greater distances.
What is a 'long cable'?
Similar answer here.To get the signal further, you ned more 'drive', hence smaller pullup value.
Which PIC and voltage?
Again...a 5V PIC can go further than a 3V PIC.
As for 'single wire' communications, I can go 15 miles(yes, miles), using common transistors and I know there's a 'relationship' to speed vs. distance.
Have you run a test program to confirm all 4 sensors work 'locally' and don't have a break in the wire between 1,2----3,4 ?
hth
jay |
|
|
championx
Joined: 28 Feb 2006 Posts: 151
|
|
Posted: Tue Dec 10, 2013 6:52 am |
|
|
Hi temtronic, thanks for your answer!
What value do you have for the pullup resistor?
In the datasheet you'll read it has to be smaller for more devices and greater distances.
I tested with 4k7, 3k3, 2k2.
What is a 'long cable'?
Similar answer here.To get the signal further, you ned more 'drive', hence smaller pullup value.
im using a 20 meters cable bus. But each sensor has a 3m cable.
Which PIC and voltage?
Again...a 5V PIC can go further than a 3V PIC.
Im using 5v pic.
Have you run a test program to confirm all 4 sensors work 'locally' and don't have a break in the wire between 1,2----3,4 ?
There is no problem with the cable and sensors, all are working ok.
[/b] |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Tue Dec 10, 2013 7:48 am |
|
|
hmm....head scratching....
I use 3k3 using 5V PICs but less than a metre of wire...
Depending on the gauge of wire you're using you might have too high a voltage drop, thus not getting proper ones and zeros.
Maybe replace the sensors with resistors that will draw 1.5ma and toggle the pin to see the voltages for 1 and 0 .Just use 1 resistor at the furthest point.
Which PIC and port pin are you using ?
If I get time I'll grab 100'( 30m) of 22ga soild(aka BELL wire) and run some tests later today.Good excuse to not go out inot -10C weather! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Tue Dec 10, 2013 7:54 am |
|
|
downloaded the datasheet...as I use the DS18B20-P which is similar...
...another problem could be too much capacitance, thus the siganal
degrades. the cure is to use low capacitance cable NOT cheap 'BELL tell'' wire.
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Tue Dec 10, 2013 9:51 am |
|
|
"There is no problem with the cable and sensors, all are working ok."
No they are not. Otherwise you would not be posting.....
First look at:
<http://www.maximintegrated.com/app-notes/index.mvp/id/148>
Then your puilup needs to go a lot lower. Something around 1K2R is required to power 4 devices like this. The 1B20, has a high power pulse requirement on the bus. There is a balancing act that lower the resistor too far and the bus won't pull down low enough (probably around 750R), but raise it too high and insufficient power will be available for the devices. Real solution is active pullups, but this is more complexity. On paper, you should just about scrape in around the 1K2 to 1K area.
Look at Maxim AN4255.
Best Wishes |
|
|
championx
Joined: 28 Feb 2006 Posts: 151
|
|
Posted: Tue Dec 10, 2013 1:11 pm |
|
|
Thanks Ttelmah. I'm posting because i have a problem in certain condition, but if i test every component isolated it works ok.
Thanks. I will test it with 1k resistor. |
|
|
championx
Joined: 28 Feb 2006 Posts: 151
|
|
Posted: Tue Dec 10, 2013 2:39 pm |
|
|
with a 680ohm resistor it works fine. Just for you to know.
thanks! |
|
|
|