Arduino uno Freeze after some hours or days of work

how to check if my RAM ran out ?

I assume you have taken the advice on the code , so that should be fixed ?

When you upload code , in orange, it will say at the bottom memory usage .
Check all you connections ( wobble them) replace any loose leads .

it say 36 % is used when i upload the code in arduino ide.
Does the code above looks heavy for ram ?
Where you probably suspect why the arduino uno freeze after some days of work ?

I suspect a bad connection .
It might be worth re wiring and carefully checking all connections .
Failing that , build up slowly - just run the display for a couple of days , then add say humidity to try and find when the problem occurs .

A photo of the installation would help here.

This is the photo .
I have reinstall wire connection days before
and the same results.
Does buying new dht11 fix the solution?

After few days or hours the screen display is freez and the HEATER is on all the time because arduino is freeze

You have a relay in there that you forgot to mention - if that is powered via a pin on the Arduino - then that is an issue .
The relay should have a fly back diode across the coil .

I’m sorry but the wiring a complete mess and likely to be a big part of your issue .
I’d suggest you lay it out in a logical fashion , all mounted on some sort of board.
Keep the mains connections well away from the board to prevent any interference from the switching .

Yes the relay has a flashback diode (led) parallel with the coin, and the relay is controled by pin 6.

You can’t drive a relay from an output pin, what coin ? - you have stuff here that you didn’t mention which wastes people’s time . A led is not a fly back diode . There is enough in this thread for you to study and correct .

Have a look at the layout below , which is logical and neat - you should aim for this . You could easily have a wire fall off and touch a mains connection on your ā€œ layout ā€œ The relay should be boxed with not access to live terminals .
Example

It use this schematics :

The diode should be across the coil not in series with it .
You can’t power the relay from the Arduino 5v pin .
You have no resistor in series with the led , the led performs no function in the way you have it

My final word is to start over , check and test each stage .package the relay and do some tidy wiring .
I can’t offer any more , sorry .

THANK YOU hummy for your suggestions.

The relay is 5v and consume 50mA that is not much for arduino, i have check that amperage with multimeter.

You are correct !!, i will replace led diode to diode 1N4007 in the scheme above.

You probably should get a transistor to drive that relay.
You will need a better power supply.

He has ! The relay coil is powered from the 5v pin.

As an aside for the OP I spent an hour today trying to get a GPS to work - bad DuPont lead !!

Oh….. Was still looking at the schematic.
Sorry.

I make some changes as hammy suggested.
Hope that i will have no problem, otherwise i will provide the full schematic with every detail.
Hope that it will work.

THANK YOU ALL FOR YOUR SUGGESTIONS

The problem as I see it is the OP does not have the tools or skill set to draw a schematic (the language of electronics). KiCad, a great program if free for the downloading. It will take some time to learn to use it but once you do!!! There are a lot of tutorials online to help with it.

I expect when an annotated schematic is posted the problem will be found in short order.