Data from DHT11 temp sensor and timestamp from DS1302 on SD card

I want to collect data from DHT11 sensor every 5 seconds, add timestamp from DS1302 RTC module, and save it to sd card. But I get empty *.txt file with no data.

ht11-log.xodball (9.0 KB)

A defer node between cht11 & sd-log might help. You are just starting RTC read the same time you start sd-log in current config. I would think you would get old data logged if that was the only problem, though…

1 Like

You mean something like this. I still get empty file.

Hi. I still can’t solve my problem.

@unosoperator
Debug the program. Separate it into pieces, rtc, thermometer, sd-log. Using watch and tweak nodes test each of this part and find out what isn’t working. Start with the sd-log. Try to change the filepath and shorten the filename.

2 Likes

Every module work fine separately. Looks like problem is to connect data from both modules.

Connect the “OK” output of DHT-11 to “GET” of ds1302.

Library updated is @0.0.7

1 Like

In debug mode. Value in red circle change rapidly between “+XOD;100:83:0” and “+XOD;101:83:0”. Still, file on sd card is empty.

Looks like your board reboots and probably there is a problem either with memory allocation or a short lifetime of some variable.

Please, attach the xodball, so we can inspect the problem.

1 Like

ht11-log.xodball (9.5 KB)

1 Like

Maybe there is a problem with join and concat
Sprobujcie ten program moze jest problem z join i concat! Pozdrawiam

ht11-log.xodball (13.5 KB)

2 Likes

Thanks. I tried your file but I still get empty txt . I can save on sd card only date and time, or only temperature and humidity but not all of them. Also tried this, but with no result:

Remove the defer, and on the output of join use " pulse-on-change to W

1 Like

cesars, that way there isn’t even empty file, sd stays empty.

I’ve inspected your xodball and this sketch works fine, but only on the microcontroller with enough memory (Arduino Mega). When I uploaded it to the Arduino Uno I got the same behavior.

The reason is sd-log (actually, SD library inside) uses a HEAP memory, and if your sketch (this one, not any sketch) uses more than 50% of dynamic memory on your board, I bet this not enough left for the HEAP.

The simplest solution: use a more powerful board with a lot of dynamic memory.
The complex one: write a node/library without using a default SD library and without consumption of HEAP memory :nerd_face:

Please, mention to me if the suggested solutions won’t work or you found the better one.

P.S.
Which board model do you use?

2 Likes

@brusher I have Arduino Uno and Nano.

This is use of memory on Uno. Right now I noticed that low memory warning:

I think I wont be able to do this , because my skills are very low in programming. Everything more complicated than “blink” led write in Arduino IDE gives me a headache. Thats why I moved to XOD. Looks like I need to use Mega board for this project.

Anyway, thanks you guys for help.

1 Like

In your example above, the watch node on the join is only showing “watch”. This implies it does not have any data to output, which would explain why you are not getting any data logged and using pulse-on-change never creates the file (there is never a change). This is still only a symptom of the root problem (which @brusher has tracked down to an out-of-memory issue), but it is a hint that there is a serious underlying issue if a join with input data doesn’t have any output…

2 Likes

I remove sd card node and everything work perfect:

… and after adding sd card node, even not connected to anything:

Did you try to use another pin for CS, for example D4?

1 Like

Yes, but with no luck.