ESP32: How to send files from internal flash to PC
ESP32: How to send files from internal flash to PC
I am working on a project where an esp32 takes Voltage and current sensor data of a house. I am storing these sensor values in a text file(CSV format) in the esp32 internal flash memory. I want to transfer the CSV file my PC via LAN/Wifi/COM(Priority-LAN -due to distance issues) so that I can perform further analysis on them.
Can we access PC's filesystem using micropython? How can i attempt to transfer files via wired/wireless medium to PC hard disk?
Thank you
Can we access PC's filesystem using micropython? How can i attempt to transfer files via wired/wireless medium to PC hard disk?
Thank you
-
- Posts: 169
- Joined: Fri Aug 19, 2016 11:55 am
Re: ESP32: How to send files from internal flash to PC
If you can live with initiating the transfer from the PC side (it sounds like you want the opposite), the WebREPL is the easiest way to transfer files wirelessly from and to ESP boards, using either the HTML or command-line client.
If you need to initiate the transfer from the microcontroller side, then some kind of HTTP POST would probably be easiest, but I have no experience with that.
To transfer files over a serial connection (also initiated from the PC side), there are several options, rshell and ampy being among the more popular ones.
If you would rather transmit measured data continuously than collect it in a file, look into MQTT.
If you need to initiate the transfer from the microcontroller side, then some kind of HTTP POST would probably be easiest, but I have no experience with that.
To transfer files over a serial connection (also initiated from the PC side), there are several options, rshell and ampy being among the more popular ones.
If you would rather transmit measured data continuously than collect it in a file, look into MQTT.
Re: ESP32: How to send files from internal flash to PC
hi Christian,
Did you make more progress with https://github.com/micropython/micropyt ... -492205467
This sounds like it would be really useful for the device-initiated case described here?
Did you make more progress with https://github.com/micropython/micropyt ... -492205467
This sounds like it would be really useful for the device-initiated case described here?
Re: ESP32: How to send files from internal flash to PC
I tried the slimmed down version of a ftp lib https://github.com/SpotlightKid/micropython-ftplib.git
And it worked so far.
And it worked so far.
-
- Posts: 169
- Joined: Fri Aug 19, 2016 11:55 am
Re: ESP32: How to send files from internal flash to PC
Yes, you are right, if the PC can be online all the time that could be used too.jimmo wrote: ↑Tue Aug 06, 2019 2:54 pmDid you make more progress with https://github.com/micropython/micropyt ... -492205467
This sounds like it would be really useful for the device-initiated case described here?
No, I haven’t spent any time on it since then. I did get a little farther than the comment you quote – it does work over a serial connection now – but got stuck on making it work over WebREPL, see two comments down. Let’s see if I can make some time for that…
Re: ESP32: How to send files from internal flash to PC
Have you considered sending the data using MQTT in real time?
I am doing something similar with temperature readings, using Node-Red to receive the MQTT messages and pass them to an InfluxDB database for analysis with Grafana.
I was pleasantly surprised how easy it is to set up MQTT on MicroPython.
I am doing something similar with temperature readings, using Node-Red to receive the MQTT messages and pass them to an InfluxDB database for analysis with Grafana.
I was pleasantly surprised how easy it is to set up MQTT on MicroPython.
Re: ESP32: How to send files from internal flash to PC
Roberthh wrote: ↑Tue Aug 06, 2019 4:30 pmI tried the slimmed down version of a ftp lib https://github.com/SpotlightKid/micropython-ftplib.git
And it worked so far.
Thanks. I'll look into it.
Re: ESP32: How to send files from internal flash to PC
Christian Walther wrote: ↑Tue Aug 06, 2019 2:33 pmIf you can live with initiating the transfer from the PC side (it sounds like you want the opposite), the WebREPL is the easiest way to transfer files wirelessly from and to ESP boards, using either the HTML or command-line client.
If you need to initiate the transfer from the microcontroller side, then some kind of HTTP POST would probably be easiest, but I have no experience with that.
To transfer files over a serial connection (also initiated from the PC side), there are several options, rshell and ampy being among the more popular ones.
If you would rather transmit measured data continuously than collect it in a file, look into MQTT.
I was trying a microcontroller initiated transfer. I was thinking about storing it into files so that i can arrange the data day wise and so on.
- mkcastillote
- Posts: 4
- Joined: Mon Mar 16, 2020 10:35 am
Re: ESP32: How to send files from internal flash to PC
Hello Roberthh, how did you managed to install the micropython-ftplib? I am using NodeMCU (ESP8266), and also I already tried different programming platforms for my NodeMCU (ESP8266), like 'uPyCraft', and 'ampy'. Please teach me how to install the micropython-ftplib. Thank you!
Re: ESP32: How to send files from internal flash to PC
You can upload the respective .py or .mpy file to the device, using ampy or rshell or pyboard.py. In the repository I linked there is a special version for ESP8266.
Since I build my own firmware image including an ftp server and other tools as frozen bytecode, I probably used ftp for it.
Since I build my own firmware image including an ftp server and other tools as frozen bytecode, I probably used ftp for it.