I have 4 DS18B20 Digital Temperature Sensors connected to my Arduino on the same digital bus. I'm NOT using parasitic power, I have the ground and 5V connected on all 4 while reading the data from the center pin and the 4.7k Resistor across the signal and power pins. This setup worked fine with the sensors directly on the proto board, I was able to read all 4 sensors no problem. Now, I've put 3 of the sensors on ~10 metre cables using Cat5 Ethernet cable and when I run the same sketch, I always get good data from the sensor still on the board, but the sensors on the cables give intermittent results; sometimes they read correctly, other times I get an error for one or more of them.
Any ideas what's going on?
-Is Cat 5 cable inadequate to the task?
-Are the cables too long and/or too small gauge for the Arduino power the sensors?
I can live with much shorter cables, but I was trying to maximize my options WRT placement options.
Thanks.
Multiple DS18B20 Digital Temperature sensors erratic output
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- spork99
- Posts: 48
- Joined: Mon Jul 25, 2011 3:27 pm
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Multiple DS18B20 Digital Temperature sensors erratic out
Long wires can be a problem. Maxim has a white-paper on the topic: "Guidelines for Reliable Long Line 1-Wire Networks"
http://www.maximintegrated.com/app-note ... mvp/id/148
http://www.maximintegrated.com/app-note ... mvp/id/148
- spork99
- Posts: 48
- Joined: Mon Jul 25, 2011 3:27 pm
Re: Multiple DS18B20 Digital Temperature sensors erratic out
Thanks!
I think I see what I've done. I've inadvertently created a "star" network, the worst type of network for One wire devices according to the paper…
I'll try with shorter cables and if that doesn't work, I'll set them up on different buses.
I think I see what I've done. I've inadvertently created a "star" network, the worst type of network for One wire devices according to the paper…
I'll try with shorter cables and if that doesn't work, I'll set them up on different buses.
- spork99
- Posts: 48
- Joined: Mon Jul 25, 2011 3:27 pm
Re: Multiple DS18B20 Digital Temperature sensors erratic out
OK, shorter cables were a miss, I had the same kind of issues, so I guess I need to set them up on separate buses. The problem is there are a zillion examples of setting bunches of DS18B20's up on the same bus, but I haven't found a good example of how to set up multiple buses of one sensor each…
Sorry if I'm a pain, I know I'm a total noob at this
Sorry if I'm a pain, I know I'm a total noob at this
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Multiple DS18B20 Digital Temperature sensors erratic out
To set up multiple busses, just declare them on different pins:
Code: Select all
#define ONE_WIRE_BUS_A 2
#define ONE_WIRE_BUS_B 3
#define ONE_WIRE_BUS_C 4
// Setup oneWire instances to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWireA(ONE_WIRE_BUS_A);
OneWire oneWireB(ONE_WIRE_BUS_B);
OneWire oneWireC(ONE_WIRE_BUS_C);
// Pass our oneWire references to Dallas Temperature.
DallasTemperature sensorsA(&oneWireA);
DallasTemperature sensorsB(&oneWireB);
DallasTemperature sensorsC(&oneWireC);
Please be positive and constructive with your questions and comments.