Recording the data generated from the com port in arduino

Hi,

I have built a small arduino duemilanove based temperature sensor (LM35), it works fine. I can see the output on the com port too. Now my main intent is to record the data and plot it using some software. I know how to plot but I was wondering if I could record the data generated by the sensor and that is available to me on the COM port into some excel file automatically? Has any one done this, can you suggest some way of doing it?

Thanks..

Gobetwino is probably your best bet - http://mikmo.dk/gobetwino.html

dxw00d: Gobetwino is probably your best bet - http://mikmo.dk/gobetwino.html

thanks, I guess that is the only way to go about it since I haven't had any other suggestions come in. I was wondering if you have any experience in using it and if I could directly PM you if I have any questions?

For situations like yours, I use Python to record to a CSV file.

Utility stuff...

import collections
import csv
import datetime
import serial

class WindowAverage:
  def __init__( self, amaxlen=20 ):
    self._observations = collections.deque( maxlen=amaxlen )
  def update( self, value ):
    self._observations.append( value )
  def average( self ):
    total = 0
    count = 0
    average = None
    for observation in self._observations:
      total = total + observation
      count = count + 1
    if count > 0:
      return total / count
    else:
      return None
  def reset( self ):
    self._observations.clear()

class SimpleAverage:
  def __init__( self ):
    self._total = 0
    self._count = 0
  def update( self, value ):
    self._total = self._total + value
    self._count = self._count + 1
  def average( self ):
    if self._count > 0:
      return self._total / self._count
    else:
      return None
  def reset( self ):
    self._total = 0
    self._count = 0

class DeltaCalculator:
  def __init__( self ):
    self._v0 = None
    self._delta = None
  def update( self, value ):
    if self._v0 != None:
      self._delta = value - self._v0
    self._v0 = value
  def delta( self ):
    return self._delta
  def reset( self ):
    self._v0 = None
    self._delta = None

Logging....

def FinalTest():
  isp = serial.Serial( 'COM10', 9600, timeout=1 )
  try:
    average = SimpleAverage()
    window = WindowAverage()
    with open( 'C:\\Temp\\Tune.csv', 'w', newline='' ) as csvoutput:
      writer = csv.writer( csvoutput, dialect='excel', quoting=csv.QUOTE_NONNUMERIC )
      writer.writerow( ['Observation','Window','Average'] )
      isp.write( '!'.encode() )
      try:
        isp.readline()
        isp.readline()
        isp.readline()
        isp.readline()
        while True:
          line = isp.readline().decode( 'ascii' ).strip()
          if line.startswith( '---' ):
              print( line )
          elif line != '':
            value = float( line )
            average.update( value )
            window.update( value )
            print( '%.0f' % value, '%.1f' % window.average(), '%.1f' % average.average() )
            writer.writerow( [value,window.average(),average.average()] )
      finally:
        isp.write( '!'.encode() )
  finally:
    isp.flushInput()
    isp.close()
    isp = None

FinalTest()

Sorry, but I don't use Windows, so I've never used Gobetwino. I'm pretty sure the guy that wrote it posts on here when people have questions about it.

If you have hyperterminal available, I think an option is to save the com port input to a file. You might save the input as a comma delimited file that might be of use.

I just use shell scripting (good ol' BASH) in Linux to save it to a text file. I use spaces as delimiters and slice it up using cut (BASH again) to make sense of the text.

Here's a pretty good option http://www.aggsoft.com/serial-data-logger.htm, a tutorial with charts: http://www.aggsoft.com/asdl-excel-real-time-charting-export.htm

HDowns: Here's a pretty good option http://www.aggsoft.com/serial-data-logger.htm, a tutorial with charts: http://www.aggsoft.com/asdl-excel-real-time-charting-export.htm

This certainly looks very useful... is there any "cracked" version available that I can use or $65 is the only way out? I only need it for my senior design project ...i.e. for about six month duration and I do not care for it thereafter.. lol

Thanks for the reply and the code but I am not familiar with Python so I do not think I will be able to go that way. I downloaded the Gobetwino and I am able to get it running. It reads the data from my com port and gives me the recorded readings in a notepad file. I would like to plot this data realtime (as it is being generated) for which I was wondering if there is any way for excel to be "connected" to the notepad file so that, as the data is generated and logged by Gobetwino in to the notepad file, excel copies it data? Once i am able to get excel to copy this data continuously, I can get it to plot it... Any idea(s)?

Check the GoBetwino docs and supplied samples.

You can dump data dierctly into Excell from GoBetwino (if your speed requirements are not too high).

MikMo: Check the GoBetwino docs and supplied samples.

You can dump data dierctly into Excell from GoBetwino (if your speed requirements are not too high).

Wow really? Can you please tell me how? The manual that came with the link that i downloaded the GObetwino was not that informative. By default it saves stuff in the notepad. If you can give me a short instruction set on how to do it, I will try to..