Hello. I need a program to control the heater in the washer. The program is to work on the principle of reaching the temperature of 60 degrees, to turn off the heater relay, reading the temperature from the ds18b20 sensor.G
If this is all you are doing for this project, I suggest using the right tool for the job. So much could go wrong using an Arduino to control a heater in a washer that is probably not going to be monitored while in use. A simple temperature switch would be much more reliable.
If this is just one part of your project, you may want to go ahead with controlling the heater with an Arduino. Turning on a relay when temperature drops below a set point is easy. Reading that temperature from a sensor can be tricky. The easiest solution is to use a part that already has a node to read it either built in or in the libraries. I’m on my phone now, so I haven’t tried to lookup your part to see how it is read or if there is already XOD support for it.
because I wrote a program written in the traditional way, but I wanted to convert it into xod and differentiate it with a display and an encoder for temperature control
the program looks like #include <OneWire.h>
#include <DallasTemperature.h>
int in7 = 7;
int in6 = 6;
OneWire oneWire (A5); // Connection to A5
DallasTemperature sensors (& oneWire); // Upload information to the library
int temp = 0;
void setup (void) {
Serial.begin (9600);
sensors.begin (); // Sensor initialization
pinMode (in7, OUTPUT);
pinMode (in6, OUTPUT);
}
void loop (void) {
sensors.requestTemperatures (); // Get the sensor temperature
Serial.print (“Temperature:”); // Display information
Serial.println (sensors.getTempCByIndex (0));
// condition for relay in7 - heater
if (sensors.getTempCByIndex (0)> = 30.0) {
digitalWrite (in7, HIGH);
Serial.println (“Relay 1-> Heater - OFF”);
}
else if (sensors.getTempCByIndex (0) <= 29.0) {
digitalWrite (in7, LOW);
Serial.println (“Relay 1-> Heater - On”);
}
// condition for relay in6 - second relay
if (sensors.getTempCByIndex (0)> = 20.0) {
digitalWrite (in6, LOW);
Serial.println (“Relay 2 - ON”);
}
else if (sensors.getTempCByIndex (0) <= 19.0) {
digitalWrite (in6, HIGH);
Serial.println (“Relay 2 - OFF”);
}
delay (500);
There are two library options for reading this sensor: Libraries — XOD
To add libraries to your XOD installation, use XOD File > Add Libraries… option.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.