Shop OBEX P1 Docs P2 Docs Learn Events
Thick dad wants to help son with Analogue data Logger project — Parallax Forums

Thick dad wants to help son with Analogue data Logger project

ArchiverArchiver Posts: 46,084
edited 2003-12-24 01:26 in General Discussion
I need your help,
My son has a school project regarding programming for a
Analogue data logger.
It asks that the Stamp capture the data from a analogue I/P data
fixed rate and stores the data to be available to download to a PC
via a serial port. The data capture and downloading to be triggered
from stamp buttons.

The program will capture a fixed number of samples from one channel
from a ADC and be stored in the Stamp EEPROM. A LED will light when
sampling complete to wait for download instruction from a stamp
button via serial port to the PC.

The data capture rate will be 4 samples/second and will be tested
capturing 16 samples of a 1 Hz sine wave.
The program will allow power to be removed from the stamp between
data capture and downloading.

Can you help or pass me onto somebody who can as my son is really
hoping I can help? which at present I'm struggling with this ?

Thanks

Graham

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-12-24 00:12
    --- In basicstamps@yahoogroups.com, "l377472" <graham.evans@w...>
    wrote:
    > I need your help,
    > My son has a school project regarding programming for a
    > Analogue data logger.
    > It asks that the Stamp capture the data from a analogue I/P data
    > fixed rate and stores the data to be available to download to a PC
    > via a serial port. The data capture and downloading to be
    triggered
    > from stamp buttons.
    >
    > The program will capture a fixed number of samples from one channel
    > from a ADC and be stored in the Stamp EEPROM. A LED will light
    when
    > sampling complete to wait for download instruction from a stamp
    > button via serial port to the PC.
    >
    > The data capture rate will be 4 samples/second and will be tested
    > capturing 16 samples of a 1 Hz sine wave.
    > The program will allow power to be removed from the stamp between
    > data capture and downloading.
    >
    > Can you help or pass me onto somebody who can as my son is really
    > hoping I can help? which at present I'm struggling with this ?
    >
    > Thanks
    >
    > Graham

    I have code and a board that utilizes a BS-2, an LTC1298 (2-channel,
    12-bit ADC) and an LM34 temperature sensor and the code to run it.
    It stores up to 500 temperature samples at any interval from 1 per
    second to 1 per 4 hours, 25 minutes--you choose. Sampling is
    initiated by a button on the board and dumping the sample data is
    likewise initiated by a button on the board. A slide switch selects
    sampling or dumping. The program talks to StampDAQ which runs as an
    Excel macro on your PC. StampDAQ is a free download from Parallax.
    Once the data are in Excel, you can graph and analyze the data.

    The data in EEPROM is non-volatile, so power can be removed after
    sampling and the sample data remain intact until replaced by a new
    sample or a new program is downloaded into the Stamp.

    I would be happy to share this with you.

    Look at Column #4 Nuts and Volts June 1995 by Scott Edwards for an
    article describing interfacing to teh LTC1298 ADC chip.

    As far as writing and reading to the EEPROM, here is some BS-2 code
    that shows a way to save 16-bit sample values in EEPROM:

    SampleIntervalSec con 2 ;number of seconds between samples
    SampleIntervalMin con 0 ;number of minutes between samples
    MaxSamples con 500 ;absolute max samples allowed-
    prevents overwriting program in EEPROM

    Nsamples var word ;counter of number of samples taken
    SampVal var word 'Sample value to store
    SampValLo var SampVal.lowbyte
    SampValHi var SampVal.highbyte

    CurLoc var word ;address to write sample value in
    EEPROM
    GetSample:
    if NSamples => MaxSamples then GetSExit
    Nsamples = Nsamples + 1

    ' get a sample
    SampVal = 0 'clear
    gosub ReadAdc

    ' Do math conversion of returned ADC value to real-world value
    here
    ' Sample to save is in the word SampVal
    GetS10:
    ' Compute EEPROM address
    CurLoc = NSamples + NSamples

    ' Store sample in EEPROM
    write CurLoc, SampVal.lowbyte 'Store sample low
    byte to EEPROM
    write CurLoc + 1, SampVal.highbyte 'Store Sample high
    byte to EEPROM

    ' Save number of samples in EEPROM
    write 0, NSamples.lowbyte
    write 1 ,NSamples.highbyte

    ' pause sample interval amount of time - pause minutes
    if SampIntervalMin = 0 then Gets20

    ' pause loop
    for I = 1 to SampIntervalMin
    pause 60000 'pause 1 minute
    next
    Gets20:
    ' pause seconds
    pause SampIntervalSec * 1000
    goto GetSample 'loop
    GetSExit:
    ' Exit
    return

    You would hae to change this code to pause for 250 milliseconds (or
    less, allowing for instruction execution time)) to achieve your
    requirement of 4 samples per second.

    I built this project for my son to log temperatures on his RC car
    engine. It rides on the car collecting samples and we download the
    results after the run.

    Hope this helps.
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-24 00:21
    Graham,

    You should get plenty of help from this group.

    Do you believe you have all the parts you need? Actually, would
    probably be helpful if you post the parts you have.

    Do you have any part of the project done?

    Are there any specifications on downloading the data to the PC? Can
    the data go to a debug window?

    It is stuff like that that we need to know.

    Happy Holidays,
    Frank




    --- In basicstamps@yahoogroups.com, "l377472" <graham.evans@w...>
    wrote:
    > I need your help,
    > My son has a school project regarding programming for a
    > Analogue data logger.
    > It asks that the Stamp capture the data from a analogue I/P data
    > fixed rate and stores the data to be available to download to a PC
    > via a serial port. The data capture and downloading to be
    triggered
    > from stamp buttons.
    >
    > The program will capture a fixed number of samples from one channel
    > from a ADC and be stored in the Stamp EEPROM. A LED will light
    when
    > sampling complete to wait for download instruction from a stamp
    > button via serial port to the PC.
    >
    > The data capture rate will be 4 samples/second and will be tested
    > capturing 16 samples of a 1 Hz sine wave.
    > The program will allow power to be removed from the stamp between
    > data capture and downloading.
    >
    > Can you help or pass me onto somebody who can as my son is really
    > hoping I can help? which at present I'm struggling with this ?
    >
    > Thanks
    >
    > Graham
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-24 01:26
    Graham

    You might find helpful the Stamp-in-Class curriculum that is free for
    download on the Parallax web site. The Applied Sensors book re
    builds step by step up to a data logger as its final project. I
    have some information on A/D converters and sensors on my web site,
    <http://www.emesystems.com/BS2index.com>. A good tutorial on a
    simple data logger interface to the PC is still to be found on Scott
    Edwards' site, <http://www.seetron.com/pdf/dcpb_mnl.pdf>. How old
    is your son, and are all the parts provided and prewired for this
    programming project, or do you have to do the hardware too! It
    sounds like you have your holidays cut out for you.

    By the way, Happy holidays, everyone.

    -- best regards,
    Tracy





    >I need your help,
    > My son has a school project regarding programming for a
    >Analogue data logger.
    >It asks that the Stamp capture the data from a analogue I/P data
    >fixed rate and stores the data to be available to download to a PC
    >via a serial port. The data capture and downloading to be triggered
    >from stamp buttons.
    >
    >The program will capture a fixed number of samples from one channel
    >from a ADC and be stored in the Stamp EEPROM. A LED will light when
    >sampling complete to wait for download instruction from a stamp
    >button via serial port to the PC.
    >
    >The data capture rate will be 4 samples/second and will be tested
    >capturing 16 samples of a 1 Hz sine wave.
    >The program will allow power to be removed from the stamp between
    >data capture and downloading.
    >
    >Can you help or pass me onto somebody who can as my son is really
    >hoping I can help? which at present I'm struggling with this ?
    >
    >Thanks
    >
    >
    >Graham
Sign In or Register to comment.