Device-Host connection. Send files from device to host.
I would like to generate a .csv with a large amount of data and be able to store it either on the SD or write that file directly to the host machine. In the SD according to the documentation I have seen that it is possible. My question would rather be if there is the possibility of being able to overwrite a file on the host machine with the data collected by LoPy.
I have a LoPy 4 + Expansion Board 3 configuration.
Thanks in advance.
@jcaron Thank you very much, I will comment on my progress soon.
@Andrés-Millán-Alcaide I'm not sure if going through the USB connection is "the best option", but we'll go with that.
A very simple way of doing this is for you to just print the collected data, and then capture the data received to a file.
If your host is running Linux or macOS, it can be as simple as
cat /dev/nameofyourserialport >file.csv.
You can probably do something similar using Windows (I think
copy COMwhatever file.csvshould do the trick).
You may need to set the serial port parameters in some situations (using
sttyon Unix/macOS or
modemon Windows -- note that on Unix/macOS you would probably need to keep the port open, so something like
(stty whateversetttings ; cat >file.csv) < /dev/whateverserialport).
This will fail if there are other things outputting to the LoPy "console". So you could at a prefix to your output so you can filter that (using
If you want to go one step further in terms of reliability (excluding any bad data, though you could still lose some), you could add a checksum to each output. In that case you'll need a custom program on the host to interpret that.
@jcaron yes, you are right, sorry for that. I am trying to collect the RSSI data from LoPy a store it into a .csv file in my host device. Probable the best option would be pass the data through USB.
@Andrés-Millán-Alcaide there are probably a million ways to do that, depending on how you want them to communicate (via the serial port/USB cable, via WiFi, via Bluetooth...), whether you want to do updates on the fly or just fetch the data at fixed intervals, the volume of data, the frequency of the updates, whether the channel used is dedicated to that or not, what environment you have on the host...
You’ll have to be a bit more specific about your needs, because as it stands there are a bit too many possible options, IMHO.