Download information from ATmega328p through USB

Hello,

I am wondering if it is possible to desing a small board with a temperature sensor and a ATmega328p that stores the temperature values as a .CSV. My question is, what is the next best alternative after the micro SD to send a .CSV for example, to a computer. Would I have to build a software tool? if so, what would be a good option to start?

One simple way is to add a dump button and receive the data over your serial monitor.

It would help to know how many temperature readings you would like to store, and how frequently you would take a reading. If it's a lot, say 100s or 1000s of readings, then you would need some external memory device to put them in between downloads.

SD cards have crazy amount of storage these days and are easy to use, thanks to the libraries that are already written for you.

If you only take readings once per hour and download once a week, then you could store the raw temperature in the internal EEPROM, then that's 24*7=168 readings at, say, 2 bytes per reading = 336 bytes per week. With the internal 1K EEPROM you could store over 2 weeks of readings.

I would generate the CSV on the fly when the download is carried out.

Thanks @markd833, and how can I this download be done from the microcontroller to the PC? can it be programed with the arduino IDE?

Use a decent terminal program on the PC (instead of Serial Monitor) that can save to file; most terminal programs will provide that functionality.

You will have to write a bit of additional code for the Arduino to send the data to the PC; e.g. using Serial.print() / Serial.println().

What you are looking for is common practice and, by the sound of things, all you need do is make sure you don't go re-inventing the wheel. There are no "alternatives" to weigh up. If you are happy to have Arduino permanently connected to your PC, i.e. act as an interface, then sending CSV data to same is the obvious choice, using a terminal to see the data live and record it. There are a number of terminals you can use, all are freebies. I use RealTerm. You can also send the data direct to Excel.

If you want your gear to stand alone, use an on-board SD card and download from it at leisure. If you can't make up your mind, do both.

I don't suppose there is any point in asking what you mean by "software tool". It sounds like technobabble, and I'm sure you are seeing these things as more difficult than they really are......

Thank you for the answer @Nick_Pyner,
I might be overcomplicating it no doubt, since I still have a lot to learn. To explain a bit more, I am trying to get to know as much as possible of embedded sistems, and for the moment I started with arduino projects, now I have designed a couple of boards with Atmel chips and burned the arduino bootloader into them via usbasp.
And now the idea that I had is the following. One of the boards that I have is a microbalance that gets temperature, humidity and frequency values of the the xtals and displays all the information on a Nextion screen and stores them in an SD in .CSV format so I can later look at it in excel. However, now I would like to know if it is possible to build a GUI that can pull the data from my board via USB for example, so I don't have to extract the micro SD card every time I want to do that.

Yes, it is for sure possible to read data from SD-Card and stream it to the Serial Monitor.
Just keep in mind, that a Arduino Uno will reboot, if you connect it to serial. But as you have your data on SD, that should not be an issue.

By the way, if you think about "Downloading" Data from SD via Ethernet using an Ethernet/SD Shield instead of Serial connection, I have a short example here: https://werner.rothschopf.net/microcontroller/202108_arduino_webserver_ntp_sd_en.htm

Thank you @noiasca for your reply,

I will look into the ethernet option!

However, after researching more into what I am looking for I think I found an interesting and maybe quite complicated but possible solution which would be using the arduino pro services and uploading all the information to the IoT cloud and from there create an API. And then creating a website with dashboards from where I can get the information from the API and display it. Then I could do this with all of my devices if possible...
Not sure if all of what I just said make sense, and it looks like I will have to learn new programming languages and will take lot of time... But has anyone done this or knows about it?

well, for me it makes perfect sense.

  • You can use the "webclient repeating" example to post data to a webresource
  • you add some php skript on your webresource to receive the data from the Arduino and persist it to a file or a database
  • you create some php skript to retrive/download data from your flat file / your database.

If this makes any sense to you and you aren't afraid of putting a page in a German-English translator, you might read https://werner.rothschopf.net/202009_iot_webserver_intro.htm

Great! I am quite excited to get this going. Thank you for the guiding @noiasca!

The DumpFile example included in the IDE examples will do this for you. No need for a GUI, just send it the filename you want. Actually, no need for USB cable either, you can download the file via Bluetooth if you want. As I said, you can also send the file direct to Excel or, probably more importantly, you can send the data live to Excel. Winkling out an SD card is only a procedure of last resort.

Further, there is no need to use a PC, you can do all this stuff using a phone, which may be more convenient..

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.