Using RTC and HUMI-01

I am attempting to use a Nano as a Greenhouse controller, and I can write code to use the DS3231 Real Time Clock and it works great and runs a long time no issues. Then I can write code to use the OSEPP HUMI-01 Temperature and Humidity sensor, again, it works great, no problems. But, when I attempt to use the code for both in the same program, the Nano reboots itself every three to four minutes.
I have used three different Nanos and three different DS3231 and four different HUMI-01 units, and I am getting the same results every time, but inconsistent restarts.
I have tried using different pins for the sensors and clock and that makes no difference either.

. I am using an Acer Z270, well, I will attach the pertinent information about my system.

Even though I have written the software (USING SOME PUBLIC DOMAIN MATERIAL) to handle four relays and a water detection sensor, I have not included that code, but I left the function names.
attached is the code I wrote to use the Nano as a greenhouse controller.

code and result.txt (15.7 KB)

code alone.txt (12.9 KB)

You waste a lot of RAM with holding all these strings in the main memory. Learn to use the F() macro.

Please post a complete wiring diagram and detailed information about how you power the system. I guess you have a power problem, the voltage probably drops and the brown out detector resets the unit.

I doubt that this code produced the posted output. You check some time variable but you don’t update them in the main loop. With this code the time would be printed once and never again until the Nano reboots for whatever (probably hardware) reason. Post the actual code!

Thanks for the tip on memory, I am just learning Arduino and electronics. I know electrical wiring and programming, but not electronics. I read everything Arduino has on the F() macro, but the reality is, the only reason I am using output to the serial screen is for troubleshooting the issues I am having getting these things to work together, so once the software works, I will be removing all the Serial.print statements so the completed project will not need any F() macros, but good info for future projects. The greenhouse does not have a computer to connect to and I have no desire to put a screen out there, I plan on interfacing using my cell phone through Bluetooth or wifi, so, I may need to use the F() macro there when I get that far, but that is a ways off if I cant figure out why these boards keep resetting with just the two peripherals.

As for the wiring, and power, the power is from the USB2 port on the front of my computer, 5v, and I have the HUMI-01 wired to 5v, Gnd and D4, and the RTC module wired to A4, A5 and 3.3v and gnd. So I seriously doubt that the issue is power, if the computer couldn't support another 1.5 amps then I seriously need to rebuild my box, but I just built it in October and I have 1000 watt power supply, so that is not the issue either. I just got these components yesterday, all brand new out of boxes from Amazon. The Nanos are by Elegoo, the HUMI-01 by OSEPP and the RTC is a DS3231.

As for the code, I was editing it to make it fit in the message box, and failed to restore everything I had removed when trying to make it fit in the post box instead of as an attachment, I posted the functional code, and am attaching a diagram of the actual wiring.

BTW: The DHT11 is a very inaccurate sensor. I would use a better sensor for controlling a green house as and error of 10%RH is a bit to much for such a controller.

You should run the DS3231 on 5V if the I2C bus is run on 5V (as it seems to be in your wiring diagram, internal pull-ups). Providing higher voltages on the I2C bus than the Vcc level may damage the chip.

In your wiring there's no pump, lights and the like as you have in your code. Is that code part just fake?

I still have the impression that you might run out of memory as the serial prints are using to much RAM and you're using the RAM wasting String object (although this is definitely not necessary). I'd guess that using the F() macro might at least make the setup resetting less often. It's worth a try.