ESP32: How to send files from internal flash to PC

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
akushva
Posts: 8
Joined: Fri May 03, 2019 10:08 am

ESP32: How to send files from internal flash to PC

Post by akushva » Tue Aug 06, 2019 8:26 am

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

Christian Walther
Posts: 56
Joined: Fri Aug 19, 2016 11:55 am

Re: ESP32: How to send files from internal flash to PC

Post by Christian Walther » Tue Aug 06, 2019 2:33 pm

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.

User avatar
jimmo
Posts: 636
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: ESP32: How to send files from internal flash to PC

Post by jimmo » Tue Aug 06, 2019 2:54 pm

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?

User avatar
Roberthh
Posts: 1636
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32: How to send files from internal flash to PC

Post by Roberthh » Tue Aug 06, 2019 4:30 pm

I tried the slimmed down version of a ftp lib https://github.com/SpotlightKid/micropython-ftplib.git
And it worked so far.

Christian Walther
Posts: 56
Joined: Fri Aug 19, 2016 11:55 am

Re: ESP32: How to send files from internal flash to PC

Post by Christian Walther » Tue Aug 06, 2019 7:21 pm

jimmo wrote:
Tue Aug 06, 2019 2:54 pm
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?
Yes, you are right, if the PC can be online all the time that could be used too.

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…

User avatar
ghayne
Posts: 27
Joined: Sat Jun 08, 2019 9:31 am
Location: Cwmllynfell, Wales

Re: ESP32: How to send files from internal flash to PC

Post by ghayne » Wed Aug 07, 2019 9:23 am

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.

akushva
Posts: 8
Joined: Fri May 03, 2019 10:08 am

Re: ESP32: How to send files from internal flash to PC

Post by akushva » Mon Aug 12, 2019 6:09 am

Roberthh wrote:
Tue Aug 06, 2019 4:30 pm
I 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.

akushva
Posts: 8
Joined: Fri May 03, 2019 10:08 am

Re: ESP32: How to send files from internal flash to PC

Post by akushva » Mon Aug 12, 2019 6:13 am

Christian Walther wrote:
Tue Aug 06, 2019 2:33 pm
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.

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.

Post Reply