Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Bonzo
#76461 I currently have a Nodemcu in my greenhouse which transmits the sensor data to a Pi in my house on a request from some Python code on the pi. The pi uses Python to save the data to a csv file. The pi has a webserver and uses php to select the data ( each month is in a different file ) and send that to some jquery code to build an interactive graph.

The problem with this is the pi as it is not very reliable - the wireless stops every now and again and the pi seems to hang after a few days of running. Sometimes it will re start on its own other times I need to unplug it as it is un responsive to keyboard, mouse or wireless.

Options I have thought of:
    Wireless adaptor on the PC - The PC may not always be on and it uses a lot more energy than the pi
    Micropython on the Nodemcu - I doubt there will be enough memory to save the data after a while and probably not display it in the format I want
    A pi alternative - I have no idea what would be more reliable and most are way overspecked/expensive for what I need.
    If I have a wireless datalogger that may work as I can request the csv files from that and run it through Python/php/JavaScript on the PC.
    Use my spare Nodemcu and connect it to an SD card to save the data
I know there is a lot of hardware around these days and it is a matter of picking the right piece - I should also say the Nodemcu is running from a 3.7V battery charged from a solar panel which restricts the options at that end.

This project is not critical as I only started it as it gave me something to do and I would hopefully learn a bit of Python so I do not want to spend a lot more money on it. But it would be nice to see it through so any ideas would be useful.

Note: I am old fashioned and not a fan of the cloud but that may be a way to go?
User avatar
By McChubby007
#76462 The nodeMcu could save the data in raw/binary to spiffs (using raw/binary rather than ascii/text will save space and most likely you won't use it all up), and then download the data on request whenever your pc/pi asks for it. I don't like the cloud either - too much reliance on other people's hardware and services.
User avatar
By Bonzo
#76472 Thanks for the idea @McChubby007 I did not know about "spiffs".

The PC can see the Nodemcu over the network so as you say I can modify my Python code and run it on my PC requesting the data and appending it to the relevant file.

I want the data every 15 min and I understand the nsp8266 timer is not precise so I can add a deep sleep time, wake, check the time over the net and at the correct time save the readings then back to deep sleep.

Searching for some spiffs examples I found this site https://tttapa.github.io/ which looks useful
User avatar
By McChubby007
#76473 Very good.

There are spiffs examples in the core core I seem to recall. PlatformIO (site & tools) will also have docs and examples. It is in any case easy to use. We can use spiffs for all sorts of things - store static web pages there and serve them on request to browser clients for example. Also useful for font files if you have an lcd attached etc etc.

You could use NTP for the time - that is also easily done, and I think it is now part of the core (not sure). One of the time libraries also incorporates ntp. Yes, clock ticks are not super accurate and there are limits using delay on times greater than 32bit (in units of clock ticks at 80MHz).