Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART), and some have several.
Description
Ah, Arduino, I remember when you were just crawling around and blinking LEDs. Now you're ready to learn how to speak! In this lesson we'll learn how to use the Serial Library to communicate from the Arduino board back to the computer over the USB port.
On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board.
You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to
begin() .
![]()
Serial communication on pins TX/RX uses TTL logic levels (5V or 3.3V depending on the board). Don’t connect these pins directly to an RS232 serial port; they operate at +/- 12V and can damage your Arduino board.
To use these extra serial ports to communicate with your personal computer, you will need an additional USB-to-serial adaptor, as they are not connected to the Mega’s USB-to-serial adaptor. To use them to communicate with an external TTL serial device, connect the TX pin to your device’s RX pin, the RX to your device’s TX pin, and the ground of your Mega to your device’s ground.
Active1 year, 3 months ago
$begingroup$
Macromedia flash player serial number 1. How can I save data retrieved from a sensor to a text file on the computer?
desNotesdesNotes
$endgroup$
8 Answers$begingroup$
you can write the sensor data to the serial port using serial-lib and write a small processing program that reads the data from the serial port and writes it to a file.
in the arduino code initalize the serial lib in the setup method
and write your sensor values to the serial interface using
in your loop method
on the processing side use a PrintWriter to write the data read from the serial port to a file
Community♦
Nikolaus GradwohlNikolaus Gradwohl
$endgroup$$begingroup$
Yet another option is to use an SD Card reader / writer, and write your file to a SD card. When you're done collecting data, swap out SD cards with your workstation computer. This approach will allow you to run your project disconnected from a computer, and will provide for non-volatile storage of large amounts of data.
Arduino Serial Output To Excel
Craig TraderCraig Trader
$endgroup$$begingroup$
The program gobetwino will log sensor values from an Arduino to a text file or spreadsheet with minimal effort. It can also automate things on the computer, add timestamps (so you don't need to program them into the arduino), etc.
endolithendolith
21.1k1818 gold badges9797 silver badges160160 bronze badges
$endgroup$$begingroup$
The simplest method is to use the Serial library and output to that. You can then capture the output to a text file using a terminal program. Hyperterminal is available on Windows, Teraterm on Linux and Z Term on OS X.
Melanie
CyberspiceCyberspice
$endgroup$$begingroup$
If you want to write sensor data directly to a file on your computer without having to copy and paste the output form the serial monitor window, then try reading the data stream directly from the serial port (which is what the serial monitor does anyway, I suspect). On mac/linux do something like:
God knows what's the equivalent on windows machines.
garageàtroisgarageàtrois
$endgroup$$begingroup$
You can create a python script to read the serial port and write the results into a text file:
Ulad KasachUlad Kasach
$endgroup$$begingroup$
I found easier and safer to use a Python script. I usually use this one based on the serial library. It's very common to use also the datetime module to add the timestamps:
G MG M
$endgroup$$begingroup$
The next step is to use either the ethernet shield or something like a WIZ810MJ board and internet enable your arduino. You can then write data to that and send it to say a web server to collate it. I do this in my vivarium temperature monitor.
CyberspiceCyberspice
$endgroup$
protected by KortukJan 12 '13 at 2:59Arduino Serial Output Buffer
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead? Arduino Serial Output To CsvNot the answer you're looking for? Browse other questions tagged arduino or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |