Shop OBEX P1 Docs P2 Docs Learn Events
Memory/Datalogger Issues — Parallax Forums

Memory/Datalogger Issues

TerrasondTerrasond Posts: 8
edited 2010-06-12 21:33 in Accessories
My company has need of a sensor capable of sensing and recording movement for extended periods of time. We are curently trying to work from a Basic Stamp 2 board, but have not found a very wide selection of external, mass memory storage devices (dataloggers?)·that are compatable with the BS2.

The two Memory·dataloggers we looked at were:
  • Micro-SD Card Adapter
  • SD Card Adapter

Are we just using the wrong stamp for the job? Or are we just overlooking a storage device?

Thanks for any advice or help.

Riley

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-08 00:37
    Parallax makes and sells their Memory Stick Datalogger which uses a USB mass memory device available in multi-GB sizes cheaply. There is sample code for the BS2 available on the Parallax webstore page for the datalogger.

    I would suggest one of the other BS2 models because of the additional memory available (like the BS2p). The BS2 will work, but the other models may make the work easier. You may want a external real-time-clock for timekeeping

    You might also consider using a Propeller with an SD card. The Propeller can act as the SD card controller and can easily do timing for time/date stamping of the data. A number of people have described using both a Basic Stamp with the Datalogger and a Propeller with an SD card for extended period datalogging.
  • TerrasondTerrasond Posts: 8
    edited 2010-06-09 17:17
    thanks mike, very helpful. We opted for the USB memory Stick Datalogger (as i mentioned on the other post).

    I assume there are ways of recoding dates and times for the data if the data logger is communicating with the DS1302 Timekeeping Chip?

    We would like mm/dd/yyyy hh[noparse]:mm:[/noparse]ss.000 if that is possible...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Riley
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 17:50
    The DS1302 provides the date and time information in BCD form (see the datasheet for details) and you'd have to format it the way you want it ... not a big deal. There's extensive demo code available via a link from Parallax's webstore page for the DS1302. The Datalogger expects a string of characters that gets copied to the memory stick file and, once you have the date / time information, it's easy to format a string using the SEROUT statement any way you want it.
  • TerrasondTerrasond Posts: 8
    edited 2010-06-09 17:54
    We already had downloaded the democode, we just havn't had a chance to look at it. Thats positive, sounds like we already have the resources we need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Riley
  • TerrasondTerrasond Posts: 8
    edited 2010-06-09 20:36
    One other question we we hoping to answer was,
    Is there a simple way to establish a frequency for sampling, 1HZ or 10HZ for example?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Riley
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 22:17
    It depends on how accurate you want the sampling rate. The Stamps have no direct access to the microprocessor's clock, but the PAUSE statement provides a quite accurate pause in milliseconds. The problem is that the Stamp can't do anything else while it's waiting at a PAUSE and the amount of time it takes to do other things is not that exact. If you know how long it takes to get a sample of data and how long it takes to write it to the datalogger, you can use a PAUSE to "fill up" the remaining time in the sampling interval. This will vary somewhat, particularly because the time for the datalogger to write out the data may vary a little. The time needed to format the data also may vary a little depending on the data values.

    The DS1302 can provide you with a very accurate 1Hz clock, but to get an accurate 10Hz clock, you may need some external hardware. It all depends on what you want.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-06-09 22:19
    Riley,

    With the BASIC Stamp you probably won't get a better rate than 1Hz...Mainly because you'd have to time it off the RTC (external) and most are limisted to 1Hz resolution. Using a Propeller you could get faster and still maintain accurate resolution, but it also depends on how much data you're writing as it takes a finite amount of time at a given baud rate to transmit all the data as ASCII text (formatted).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-06-12 21:33
    Some RTC chips such as the DS1307 have an auxiliary output that can be configured to put out a 1 second square wave, 1/2 second high and 1/2 second low. That heartbeat makes it easy to sync to the seconds. If you have a BS2p series Stamp, the pollwait command can be especially useful. But with any Stamp the heartbeat pin can be polled

    ' for DS1307
    DO
      DO:LOOP UNTIL heartbeat   ' wait for hb pin to go high, 1/2 second
      DO:LOOP WHILE heartbeat  ' wait for hb pin to go low, 1/2 second
    ' read RTC, take sample, log and display here
    LOOP
    



    With the DS1302, the program executes a tight loop reading the seconds register, and when that rolls over, break out and take a sample, then back to waiting for the next rollover. This uses an auxiliary variable, "seconds0" to track the rollover...

    ' for DS1302
    DO
      HIGH DSce
        SHIFTOUT DSdta,DSclk,LSBFIRST,[noparse][[/noparse]$BF]     ' burst mode read $BF command to DS1302
        SHIFTIN DSdta,DSclk,LSBPRE,[noparse][[/noparse]second,minute,hour,date31,month,day7,year]
      LOW DSce
    
      IF second<>second0 THEN    ' only display when seconds change
       ' Take data sample here, log it and show it on display.   Show time...
        DEBUG CR,HEX2 month,"/",HEX2 date31,"/20",HEX2 year
        DEBUG 32,HEX2 hour,":",HEX2 minute,":",HEX2 second
        second0=second   ' track old seconds for change
       ENDIF
    LOOP  ' back to wait for time rollover
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.