Jump to content

Solar Dude

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Solar Dude

    Multiple DS18B20 Sensors

    I'm making progress, but now I'm having difficulties creating multiple Dallas Temperature sensor objects. I tested all of my sensors by plugging them into pin 2 and they all work. I just don't know how to pass the OneWire reference into the class for multiple Dallas Temperature sensor objects.
  2. Solar Dude

    Multiple DS18B20 Sensors

    Hello All, I am fairly new to Arduino and I am trying to set up a program to control 3- Hydronic Circulators for a solar water heating project using 3-DS18B20 Temperature Sensors. My Arduino Uno gets angry when I try to Verify my sketch. I am trying to use multiple sensors to control multiple circulators and I'm not sure how to define each one. I provided my sketch just to help understand what I'm doing. I started this sketch based on the DS18B Tutorial.. Thanks in advance!! #include <DallasTemperature.h> #include <OneWire.h> int Solar_Panel_Circulator = 8; int Floor_Heat_Circulator = 9; int DHW_Circulator = 10; int temp_sensor_Solar = 2; int temp_sensor_Floor = 3; int temp_sensor_DHW = 4; int Alarm = 5; int lowerLimit_Solar = 150; int higherLimit_Solar = 200; int lowerLimit_Floor_Heat = 80; int higherLimit_Floor_Heat = 85; int lowerLimit_DHW = 50; int higherLimit_DHW = 150; OneWire oneWirePin(temp_sensor_Solar); OneWire oneWirePin(temp_sensor_Floor); OneWire oneWirePin(temp_sensor_DHW); DallasTemperature sensors(&oneWirePin); void setup(void){ Serial.begin(9600); //The Circulators & Alarm as outputs pinMode(Solar_Panel_Circulator,OUTPUT); pinMode(Floor_Heat_Circulator,OUTPUT); pinMode(DHW_Circulator,OUTPUT); pinMode(Alarm,OUTPUT); sensors.begin(); } void loop(){ Serial.print("Requesting Temperatures from sensors: "); sensors.requestTemperatures(); Serial.println("DONE"); temperature1 = sensors.getTempFByIndex(0); temperature2 = sensors.getTempFByIndex(1); temperature3 = sensors.getTempFByIndex(2); digitalWrite(Solar_Panel_Circulator, LOW); digitalWrite(Floor_Heat_Circulator, LOW); digitalWrite(temp_sensor_DHW, LOW); digitalWrite(Alarm, LOW); Serial.print("Temperature is "); Serial.print(temperature1); Serial.print(temperature2); Serial.print(temperature3); if(temperature1 <= lowerLimit_Solar){ Serial.println(", Solar Circulator is Activated"); digitalWrite(Solar_Panel_Circulator, HIGH); if(temperature2 >= higherLimit_Solar) Serial.println(", Alarm is Activated"); digitalWrite(Alarm, HIGH); } if(temperature2 <= lowerLimit_Floor_Heat){ Serial.println(", Floor Heat Circulator is Activated"); digitalWrite(Floor_Heat_Circulator, HIGH); if(temperature2 >= higherLimit_Floor_Heat) Serial.println(", Floor Heat Circulator is De-activated"); digitalWrite(Floor_Heat_Circulator, LOW); } if(temperature3 <= lowerLimit_DHW){ Serial.println(", DHW Circulator is Activated"); digitalWrite(DHW_Circulator, HIGH); if(temperature3 >= higherLimit_DHW) Serial.println(", DHW Circulator is De-activated"); digitalWrite(DHW_Circulator, LOW); } } delay(1000); }
×