I have an Arduino Uno that I am truing to incorporate the daylight saving time for a project. I hasve installed the DST RTC by Andy Doro version 1.1.1.
Please see the code below:
// Author : John Marchant G0RJM
// Created : 25/01/2024
// Description : A project to display the current date, time and temperature on the 20x4 LCD screen
// and create a thermostatic heating control of three zones to include frost protection.
// This has been based on the RTClib ds3231 example along with many parts borrowed
// from several other files/sketches and in collaboration with several authors from the
// Arduino Forum in particular blh64, StefanL38 and UKHeliBob.
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include "RTClib.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DST_RTC.h"
#define ONE_WIRE_BUS_1 3
#define ONE_WIRE_BUS_2 4
#define ONE_WIRE_BUS_3 5
OneWire oneWire_range(ONE_WIRE_BUS_1);
OneWire oneWire_club(ONE_WIRE_BUS_2);
OneWire oneWire_airgun(ONE_WIRE_BUS_3);
const byte range_relay = 9; // Relay outputs
const byte club_relay = 10;
const byte airgun_relay = 11;
const byte boiler_relay = 12;
float range_temperature;
float club_temperature;
float airgun_temperature;
const float temperature_setpoint_range = 22.0; // C
const float temperature_setpoint_club = 22.0; // C
const float temperature_setpoint_airgun = 22.0; // C
const float frost_setpoint = 22.0; // C
const float deadzone = 1.0; // C
const int SCREEN_ON_TIME = 30000;
const int backlight_buttonPin = 8;
int buttonState = 0;
unsigned long currentMillis = 0;
unsigned long previousMillisScreen = 0;
bool screenOn = false;
DallasTemperature sensor_range(&oneWire_range);
DallasTemperature sensor_club(&oneWire_club);
DallasTemperature sensor_airgun(&oneWire_airgun);
enum { SUNDAY,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY };
const int On_Normal = 16 * 60UL + 00; // 16:00
const int Off_Normal = 21 * 60UL + 30; // 21:30
const int On_Sunday = 12 * 60UL + 00; // 12:00 for Sundays
const int Off_Sunday = 17 * 60UL + 30; // 17:30 for Sundays
#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
// Required for Serial on Zero based boards
#define Serial SERIAL_PORT_USBVIRTUAL
#endif
LiquidCrystal_I2C lcd(0X27, 20, 4);
RTC_DS3231 rtc;
DST_RTC dst_rtc;
char daysOfTheWeek[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
byte char_temp[8] = { B00100, B01010, B01010, B01110, B01110, B11111, B11111, B01110 }; // for thermometer icon
void setup() {
pinMode(range_relay, OUTPUT);
pinMode(club_relay, OUTPUT);
pinMode(airgun_relay, OUTPUT);
pinMode(boiler_relay, OUTPUT);
pinMode(backlight_buttonPin, INPUT);
rtc.begin();
lcd.init();
lcd.backlight();
lcd.createChar(0, char_temp);
lcd.setCursor(4, 0);
lcd.print("Take it easy!");
lcd.setCursor(4, 1);
lcd.print("Working on it");
lcd.setCursor(2, 2);
lcd.print("G0RJM Three Zone");
lcd.setCursor(1, 3);
lcd.print("Temperature Control");
delay(1000);
lcd.clear();
if (rtc.lostPower()) {
// When the time needs to be set up on a new device, or after a power loss, uncomment the
// following line. This sets the RTC to the date & time this sketch was compiled
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
/*
This line sets the RTC with an explicit date & time (standard time - not DST), for example to set
March 28, 2020 at 23:58:5 you would call:
// rtc.adjust(DateTime(2020, 3, 28, 23, 58, 5));
If used load the sketch a second time with this line commented out or the RTC will reset to
this time on power up or reset.
*/
Serial.begin(9600);
Serial.println("G0RJM Three zone Temperature Control");
wire.begin();
sensor_range.begin();
sensor_club.begin();
sensor_airgun.begin();
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(__DATE__, __TIME__));
// DST? If we're in it, let's subtract an hour from the RTC time to keep our DST calculation correct. This gives us
// Standard Time which our DST check will add an hour back to if we're in DST.
DateTime standardTime = rtc.now();
if (dst_rtc.checkDST(standardTime) == true) { // check whether we're in DST right now. If we are, subtract an hour.
standardTime = standardTime.unixtime() - 3600;
}
rtc.adjust(standardTime);
}
}
//--------------------------Timeswitch Control---------------------------//
void loop() {
DateTime now = rtc.now();
int currentTime = now.hour() * 60UL + now.minute();
bool isHeatOn; // true = heating time
//------------------------Daylight Saving Setting=---------------------//
{
DateTime standardTime = rtc.now();
Serial.println("Standard Time");
printTheTime(standardTime);
DateTime theTime = dst_rtc.calculateTime(standardTime); // takes into account DST
Serial.println("time adjusted for Daylight Saving Time");
printTheTime(theTime);
delay(1000); // 1 second
}
// print time to serial
void printTheTime(DateTime theTimeP) {
Serial.print(theTimeP.year(), DEC);
Serial.print('/');
Serial.print(theTimeP.month(), DEC);
Serial.print('/');
Serial.print(theTimeP.day(), DEC);
Serial.print(' ');
Serial.print(theTimeP.hour(), DEC);
Serial.print(':');
Serial.print(theTimeP.minute(), DEC);
Serial.print(':');
Serial.print(theTimeP.second(), DEC);
Serial.println();
}
}
I get this error code and would like some guidance please.
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for LiquidCrystal_I2C.h: [LiquidCrystal I2C@1.1.2]
ResolveLibrary(LiquidCrystal_I2C.h)
-> candidates: [LiquidCrystal I2C@1.1.2]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for RTClib.h: [RTClib@2.1.3]
ResolveLibrary(RTClib.h)
-> candidates: [RTClib@2.1.3]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\johnm\Documents\Arduino\libraries\RTClib\src C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for Adafruit_I2CDevice.h: [Adafruit BusIO@1.15.0]
ResolveLibrary(Adafruit_I2CDevice.h)
-> candidates: [Adafruit BusIO@1.15.0]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\johnm\Documents\Arduino\libraries\RTClib\src -Ic:\Users\johnm\Documents\Arduino\libraries\Adafruit_BusIO C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for OneWire.h: [OneWire@2.3.7]
ResolveLibrary(OneWire.h)
-> candidates: [OneWire@2.3.7]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\johnm\Documents\Arduino\libraries\RTClib\src -Ic:\Users\johnm\Documents\Arduino\libraries\Adafruit_BusIO -Ic:\Users\johnm\Documents\Arduino\libraries\OneWire C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for DallasTemperature.h: [DallasTemperature@3.9.0 MAX31850 DallasTemp@1.1.6]
ResolveLibrary(DallasTemperature.h)
-> candidates: [DallasTemperature@3.9.0 MAX31850 DallasTemp@1.1.6]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\johnm\Documents\Arduino\libraries\RTClib\src -Ic:\Users\johnm\Documents\Arduino\libraries\Adafruit_BusIO -Ic:\Users\johnm\Documents\Arduino\libraries\OneWire -Ic:\Users\johnm\Documents\Arduino\libraries\DallasTemperature C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for EEPROM.h: [EEPROM@2.0]
ResolveLibrary(EEPROM.h)
-> candidates: [EEPROM@2.0]
C:\Users\johnm\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -Ic:\Users\johnm\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src -Ic:\Users\johnm\Documents\Arduino\libraries\RTClib\src -Ic:\Users\johnm\Documents\Arduino\libraries\Adafruit_BusIO -Ic:\Users\johnm\Documents\Arduino\libraries\OneWire -Ic:\Users\johnm\Documents\Arduino\libraries\DallasTemperature -IC:\Users\johnm\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\EEPROM\src C:\Users\johnm\AppData\Local\Temp\arduino\sketches\96DFED36EB631C459DC15A354B23E126\sketch\Three_zone_heating_controller_V1.2.7.ino.cpp -o nul
Alternatives for EEPROM.h: [EEPROM@2.0]
ResolveLibrary(EEPROM.h)
-> candidates: [EEPROM@2.0]
C:\Users\johnm\Documents\Arduino\Three_zone_heating_controller_V1.2.7\Three_zone_heating_controller_V1.2.7.ino:14:10: fatal error: DST_RTC.h: No such file or directory
#include <EEPROM.h>
^~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: DST_RTC.h: No such file or directory