For how to save the data show in monitor into a document


Recently, I use a pm2.5 sensor to monitor. I can see the real-time data in monitor, but i want to save these data to a document that i can deal at anytime. Who could give me some advice? My board is Arduino UNO R3.


The most simple way is just to click on the Serial Monitor output window, Select All, Copy, then paste to a program that allows you to save it. If you want to put it in a spreadsheet you can program the Arduino to print in CSV or TSV form.

If you want something that will automatically write the data to a file you will need to use a different terminal program than Serial Monitor. There are other options of much more full-featured applications that should have that capability. The Serial Monitor is intentionally very simple to be beginner friendly.

If that is for analyses, look into storing it in a database. There's a very convenient MySQL connector library out there.

Another option is to connect an SD card to your Arduino, and store it in a file on that SD card.

If you ditch the serial monitor and use a proper terminal programme instead, you can use it to timestamp the data using the PC clock. This involves no extra programming on your part, and could be very useful.