0

I'm looking to build a battery powered NodeMCU (using Lua) for simple data logging. I want to use rtctime.dsleep and I don't want to have to turn on the radio stack each time I take a measurement. So the plan is to wake from sleep, take a measurement and save it to a file.

I have this working fine and I thought that downloading the data file to another computer (Raspberry Pi in this case) would be easy. Unfortunately it is not. This is because the file is bigger than can be held in a string AND the fact that you can't do one thing at a time. I have tried HTTP PUT and POST and websockets, but they all try to send multiple requests at once.

So, my question is: Is there a reliable way to download a large file from the NodeMCU to another computer?

dda
  • 6,030
  • 2
  • 25
  • 34
  • please specify the interface – Piglet Dec 25 '16 at 12:18
  • I was initially a little confused by the use of the term "download". What you attempt to do is "upload" to me as NodeMCU is the client and the RaPi is the server. Never mind...what do you mean by "they all try to send multiple requests at once"? – Marcel Stör Dec 25 '16 at 14:26
  • 1
    In any case my approach would be to read chunks from the file and send the off using the `net` module like it was proposed here: http://stackoverflow.com/a/36167994/131929 – Marcel Stör Dec 25 '16 at 15:18
  • Thanks guys, I want to move a file from the node to a server. But as it is battery powered and using deep sleep it needs to do its own scheduling. For my other nodes I simply display a web page and had my database server poll it (i.e. the scheduling is don off the node). Using deep sleep implies that the scheduling needs to be done on the node. So sending a file on a HTTP incoming request won't work in this situation. – capella_ben Jan 19 '17 at 21:44
  • The problem I have is that all of the modules in nodeMCU are event based and if you have a bunch of, say, websocket sends then they all get sent at once and overwhelm the destination (and some get lost). I have done some more work and MQTT is the only one that seems to be OK in that the broker seems to be able to handle receiving all of the requests at once. (I did have some problems with MQTT early on, but these seem to be better now). Thanks for your help. – capella_ben Jan 19 '17 at 21:51

0 Answers0