Save data to file

Hi,

I’ve been looking for a way to store the data of the Serial Monitor to a file on my computer and I found a lot of topics talking about it but no suitable answer. I think this would be a great improve of the arduino program. Here’s a first try to allow the Serial Monitor to switch between writing to the screen the aquired data and writing to a file. Only three arduino java files have been modified and all modifications are starting with a comment //bay.
Maybe this could be helpful to someone…

Best regards

Base.java (77.3 KB)

SerialMonitor.java (8.02 KB)

Serial.java (20 KB)

Most proper terminal emulators allow storage to a file - no need to change anything.

How do you do that ? I haven't found anything on the web but weird scripts that try to catch what the Serial Monitor says... If you have a better solution, I'm really interested !

PuTTY, Hyperterm...

Alright but there you need to run a script in parallel to the arduino program. I thought that it would be nice if the arduino program could do this on his own.

Try this:

https://sites.google.com/site/terminalbpp/

You can even plot data with it besides simple logging. Toggle arduino reset. etc.

Thanks for the idea :D

Do you mind providing a little more information about why you wish to save serial output to a file?

My arduino is aquiring data from a circuit with a scintillation cristal in order to measure the spectrum of radioactive sources. It is displaying instantly the histogram on a lcd screen and the number of the channel of each hit is displayed in the serial output. So in order to be able to save the histogram created, I'd like a way to say to the program that it should save it into a file.

Emix,

Is this some sort of physics experiment? I am interested in more details, such as how arduino is hooked up to the scintillator.

Yes, I'd be interested in the details too. Is it an array of scintillators responding to different energies/frequencies?

+1, video too, please :D

Hi guys, it's nice to see that there are some people interested by physics ! :)

So, yes, it's a physics experiment. It's a small setup for the practical work of physics students. I only have one cristal, so the energy range is limited but good enough for the purpose of this experiment. The scintillator is connected to a PIN diode which is in turn connected to a pcb specifically designed for this experiment. The most important part of the circuit is the sample and hold feature that holds the signal detected long enough so that the arduino can read it and process it. It's quite nice and it's starting to work well but the setup is not fully finished yet, so the video will maybe come later, ^^.

So you are doing less than say 200,000 counts per second then with sample and hold? I only know how to use the detector with single or multichannel analyzers, which turn the pulses into digital signals for the next stage of things, such as counters. So you are not using these analyzers or counters but a sample and hold circuit? I could do something like this if it doesn't involve high voltage. The detector needs a few thousand volts, but the current is low, right?

In TeraTerm: File->Log and everything you see in the monitor get logged into a file of your choice..

So you are doing less than say 200,000 counts per second then with sample and hold?

Hopefully not too close to the experiment, though :)

PS: long time back I built a detector with PIN diode (7mm2 active area), without a scintillator. I get 0.05 - 3 pulses per second (needle-shaped pulses with different amplitudes, ~30uS long) based on irradiation. Looking for a good peak detector with S/H too.. :)

It's a small scale experiment for students, so the source is really weak, < 100 ?Cie and it needs a low voltage, 12 Volts.

Hi there,

So here are a few news about this experiment. It is able to acquire data from a detector made of a scintillator and a PIN diode or from a PhotoMultiplier. It will display directly the histogram of the spectrum on the screen connected to the Arduino. When the spectrum is thought to be good enough, one can press a physical button connected to the Arduino in order to save the actual histogram into a file. I find this method much more efficient and useful than using a terminal emulator and saving each entry in the file. I guess that will depend on what data you have and what you want to do with them.
Here are the final version of the files that allow to do that, maybe this will be useful to someone.

Base.java (77.3 KB)

Serial.java (20.6 KB)

SerialMonitor.java (8.06 KB)

And here are a few pictures of the setup and the detector, :slight_smile:

And one more, sorry for the number of posts, but the pictures are too big ! ^^

Have you ever got your scintillator working im trying to build one now but im having some issues. http://forum.arduino.cc/index.php?topic=232151.0

HTerm is the best, it has the connect + save data buttons right next to each other. All the main functionality you’d expect is on the main screen. Nothing to install either, it is one file.

Their homepage below has the download link at the top, it is in german, but the application is in English.