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

Memory Stick Datalogger

mschneidmschneid Posts: 3
edited 2008-08-24 17:13 in BASIC Stamp
Has anybody successfully used the Memory Stick Datalogger with a BS2? I'm having troubles getting it to fully work and wanted to see others having success.

The Demo and Test sample codes have lots in them, but I don't want anything fancy, just write to a file, never read from it, all in the same directory. Simple sample codes would be welcome.

I am trying to make a kWh reader/logger for my electric car.

Thanks, matt

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-08-24 05:57
    The datalogger is (in my experience) the most difficult piece of hardware to use that Parallax sells. About a third of my development time is spent trying to get the darn thing to work. Anyway, yes, it does work with the BS2. You are fortunate in that you only need it to write: another plus. So here are some things to consider/try:

    1: Use a USB drive with a light (at least for testing the datalogger) The light on the USB lets you know that things work successfully. If it flashes quickly, that means that you have correctly written the file (or read if you ever need to)

    2: Run the test program whenever you mess with the wiring. Check the files on the USB to make sure that the datalogger is set up correctly. If this test program doesn't work, then you know it's something in your hardware. Check the wiring.

    3: Use the test program as the basis for your program. This is easiest if you have a BS2 model with program slots: just assign the datalogger stuff to a slot. Since you are using a regular BS2, you'll need to have everything in one place. You'll find that you have no more variable space and will have to do some creative solutions. Take a look at aliasing.

    4: When using the test program, remember that you need to prepare the datalogger first. Keep all the subroutines and anything that is related to the write. This includes the opening of the file, writting the file, and closing the file. It's helpful if you have some external indication of the file open/close status.

    5: When you communicate with the datalogger, keep in mind that you'll be telling the device how many characters you will be sending it. I found it easiest to "diagram" the layout:
    5454,66,444,33
    So, for example, the first part when you send it you would give a length of four (5454), then one (for the ","), then two (66), etc...

    6: Seperate the datalogger program design and debugging from the rest of the stuff that you want to do, then sit down and just burn through as much as you can in one session. The datalogger is extremely terrible to use, but it does work and eventually can be used effectively. Just be sure to be willing to work hard hours on this.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-08-24 17:13
    I agree with SRLM that it can be quite frustrating to shuffle the ducks the way you want and get them all back in a row.

    Matt, maybe the attached program "log2vDriveEasy.bpe" will give you some help. It only writes data as you require. When started, it writes a column header to a file "capture.txt", which it creates if necessary, otherwise writes at the end of the existing file. Then the program goes into a loop where it increments a record counter and generates data (a random number for the demo), which it writes to the capture file, sleeps for a time, and then does it over and over. When you need to erase capture.txt, do so on your PC.

    One difference about this program is that the power to the USB datalogger is controlled by the program, via the power control pin on a 5 volt low dropout regulator (I use the 500mA LT1763). There are two reasons. First is that the kind of data logging I do requires conserving battery power, and USB drives are relatively power hungry (~100 mA). I generally log data at intervals of 1 minute or longer. The second and equally important reason is that powering the logger off and then on brings it into a known state and allows recovery from errors or things that go bump in the night. The logger can be quite picky. The program can be modified to operate without power control.

    The program dispenses with a lot of the startup procedures that you will see in other programs. Simply powering up and waiting for the D:\> prompt is very reliable.

    I strongly recommend that you download the latest firmware for the logger from www.vinculum.com. The current version is 3.65. They frequently upgrade the firmware, with a lot of improvements in speed of operation and compatibility.

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