Hi,
I am building a electric baseboard control system for my house. I am using an Arduino Mega 2560 Rev3 controller and I have modified my thermostats to each have a DS18S20 sensor in them. I am using the waterproof type sensors in the metal tube with the 3' wire lead.
I mocked up the system before I installed it and had everything working fine, sensors were returning temps and all was good. At this point, the sensors were wired direct to the controller, using a DF robot breakout for DS18S20 sensors that has a 4.7kOhm pull-up baked in. I have now installed the sensors in the rooms, and ran Cat5e back to the controller. I use one twisted pair for each V+, V- and Data lines, leaving one pair spare.
Initially I ran just one room to test it, there is about 40'(10m) of cat5 between the sensor and controller. On a previous project I ran over 100' of Cat5 with 3 sensors along its length and had no issues with getting sensors to work. With the one sensor installed I was getting a temperature reading as expected.
I then connected sensors 2 and 3, which have about 20' and 30' of cat5 between sensors and board, respectively.
When plugged in individually, each sensor works as expected and I get a reading, However, If I connect more than one sensor they will all return -127 (Error). If I run a simple 1-wire sketch to find sensor addresses, it would not find any sensors on the bus. The sensors are wired in a "star" configuration with the controller at the centre.
I tried a bunch of different solutions to try and fix the issue. Most recently, I replaced the DF robot breakout and wired all the sensors directly back to the one wire terminal (2) and put a new 4.7kohm resistor from the pin2 to V+. With this new set up I can now get temperatures from of any combination of TWO sensors, but if I connect a 3rd sensor, all three error to -127.
Other things:
-I've had the V+ connected to the 5v output and also wired direct from a 5v power supply. Both give the same result.
-I updated to the latest onewire and Dallas temp libraries - before I updated to the latest library I would get 0.00 degrees returned from the sensors instead of -127. Not sure on why that happened.
-I have the addresses for each probe and am calling them directly.
-void TempCheck() is where the code gets the sensor temperatures, this was all working fine during the mock up, (limited wire) so I'm assuming its not a code issue, but here it is anyways if you are curious.
-I have tried adding delays between each temperature read with no difference.
-At the probes I'm getting about 4.9v
-I have run the screen from both board and a separate power supply, same result.
-The controller is being powered from 2amp 5v source plugged into the USB port. I am reading the sensor values from the display.
If you have any thoughts as to what is causing this device limitation I would be grateful to hear them.
I had to trim down my code to fit in the post cap. all the display and keypad code was removed.
#include <SPI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
/
//VARIABLE ASSIGNMENT
#define LED 13
#define ONE_WIRE_BUS_PIN 2
//SENSOR STUFF
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);
LiquidCrystal_I2C lcd(0x27,20,4);
//Probe order - -Nursery - Probe1
DeviceAddress Probe1 = { 0x28, 0xFF, 0xE8, 0x23, 0x71, 0x16, 0x04, 0x37 }; //Nursery
DeviceAddress Probe2 = { 0x28, 0xB5, 0xD3, 0xE0, 0x08, 0x00, 0x00, 0x8E }; //Bedroom
DeviceAddress Probe3 = { 0x28, 0xFF, 0x57, 0x7B, 0x64, 0x16, 0x03, 0x2F }; //Master
//DeviceAddress Probe4 = { 0x28, 0xFF, 0x86, 0x19, 0xB0, 0x16, 0x05, 0x71 };
//DeviceAddress Probe5 = { 0x28, 0xFF, 0x87, 0x01, 0xB0, 0x16, 0x03, 0x45 };
unsigned char* Probes[] = {Probe1,Probe2,Probe3};
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
sensors.begin();
// set the resolution to 10 bit (Can be 9 to 12 bits .. lower is faster)
sensors.setResolution(Probe1, 10);
delay(200);
sensors.setResolution(Probe2, 10);
delay(200);
sensors.setResolution(Probe3, 10);
delay(200);
//sensors.setResolution(Probe4, 10);
//sensors.setResolution(Probe5, 10);
pinMode(LED,OUTPUT);
void TempCheck(){
for(int x = 0; x<3; x++){
Temps[x]=GetTemp(Probes[x]);
// Temps[x]=23;
//delay(500);
if (Temps[x] >= Sets[x]){
TempCall[x] = 0;
//state = "off";
}
if (Temps[x] < Sets[x]){
TempCall[x] = 1;
//state = "on";
}
}
}
/
Any thoughts are welcome.