0

I have problem because I need to read values and then save them in a .txt file, but Arduino doesn't have a physical connection with my computer. It only has a connection with a computer using Ubuntu without Arduino IDE or other programs. Also, I don't have an ethernet connection and SD card. I need only to have this data stored. The best way is to send them at the end of cycle to a special text file. Has anybody faced that before?


I'm thinking about writing a bash script for reading all values sent by serial and then save them, but how do I get that information from serial?

migrated from electronics.stackexchange.com Oct 2 '18 at 16:34

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Also, it’s unclear what you mean when you say “Arduino doesn’t have physical connection with my computer” and then “it only has connection with computer using Ubuntu”. The two statements contradict each other. – Blair Fonville Oct 2 '18 at 13:38
  • There are many examples you can find online of simple serial capture to a file. Bash may not really be the best choice as serial ports aren't just simple files (typically needing at minimum configuration), but something like python with pyserial can work well. – Chris Stratton Oct 2 '18 at 15:16
  • How much data is it? Perhaps it can be stored in eeprom, and retrieved later via the serial. – Jot Oct 2 '18 at 16:43
2

Any serial terminal emulator application can connect to the Arduino. Select one that has log-to-file capability and open its log file after you've connected it to your Arduino's /dev/tty... device.

Start the Arduino and let it collect & send the data to your terminal program. Close the terminal app's log file (easy step to forget - ask me how I know :) and there's your data.

0

The Arduino IDE provides a built-in serial monitor functionality, which emulates a serial port over USB. There are many tutorials available for its use.

However, as best I recall the Arduino serial monitor does not allow you to save a log file. If you don't want to write your own code to do this you can use a different terminal emulator, such as putty.

  • 1
    No, serial port emulation is not a function of the Arduino IDE. It is a function of drivers in (or for various older versions and clones) added to, the host operating system. – Chris Stratton Oct 2 '18 at 15:13
0

Like what Chris mentioned in the comment, you can use pyserial to do it. You can even add timestamp to your data and append them to the same log file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy