Datalogging at higher speeds
-GRIMM-
Posts: 56
I am working on a project where i need to log speeds at fast rates (30 readings per second +) for 50 minutes. (about 220,000 readings)
The values for time and a sensor need to be recorded, so I need a device that can handle 60+ writes per second.
Currently with a parallax USB datalogger we are getting about 20-30 writes per second.
Are there any other sensors out there that can meet the speed requirements?
I read about Ramtron F-Ram but i can not find a source with a pre-mounted circuit board.
Ideally this would be the best bet, but my Surface mount soldering skills arent too great.
Any help is appreciated.
Thanks
-Steven
The values for time and a sensor need to be recorded, so I need a device that can handle 60+ writes per second.
Currently with a parallax USB datalogger we are getting about 20-30 writes per second.
Are there any other sensors out there that can meet the speed requirements?
I read about Ramtron F-Ram but i can not find a source with a pre-mounted circuit board.
Ideally this would be the best bet, but my Surface mount soldering skills arent too great.
Any help is appreciated.
Thanks
-Steven
Comments
You can also attach a single Winbond flash memory chip (8-pin ... comes in PDIP too) to 4 I/O pins and use the I/O driver in the Object Exchange. These come in capacities up to 2MBytes. I think a microSD card would be better if you have the physical room.
http://hannoware.com/ezlog/
Jonathan
Since you already have the hardware, why not accumulate 30 readings in a 32 byte,word or long circular buffer and write to the datalogger 1 per second?
RS_Jim
I think we will order the micro-SD card adapter and experiment.
RS_Jim, I am not too familiar with the propeller chip yet, how would I go about doing that?
The values being recorded come from a gyroscope (values from 0-1100 roughly) and clock time, cnt.
Thanks
-Steven
The portion of the program that fills the buffer can run in one cog while the portion of the program that empties the buffer can run in another cog. Look at FullDuplexSerial for an example of this technique with one side written in Spin and the other side in assembly.
RS_Jim
My stupid video capture uses double buffering to record 30 frames per second of video/audio to an SD card http://forums.parallax.com/showthread.php?98516-stupid-video-capture&highlight=stupid+video
You might get some ideas from that.
Perry
Im playing with it now trying to get it to the point where I can wire it up and test it when the sd card adapter comes in (Wednesday)
fat.writeLong(value)
So if Im not mistaken, it should be as simple as taking my current USB datalogger program, and replace:
logger.writeToFile(@buffer2,strsize(@buffer2),0)
with
fat.writeLong(@buffer2)
Sound correct?
No!
You need to initialize theSD device
open a file for write
then you can write to the file
when finished writing
you need to close the file
and probobably then close the device
You should really look at how my Stupid Video works
even Kye admits that fsrw is faster
also writing short blocks is slower than writing long blocks (less over head)
with "double" buffering you can receive new data while the last block is being written by the SD i/o card.
programMount(stringPointer)
programMakeDirectory(stringPointer)
programMakeFile(stringPointer)
Loop with data
fat.openFile(fat.newFile(string("testfile")), "W")
fat.writeData(@sectorBuffer, 512)
fat.closeFile
(possibly not opening/closing file every time)
%%%%%%%%%
Finish with
fat.unmountPartition
Forgot there was a little more to it than that.
I didnt realize the attachment in your video thread, I'm reading through your codes right now to try and understand it.
Thanks
-Steven
actually I think 30 readings per second is quite slow. My only concern was that the writing might run into problems because the timing of the write to the SD card would be variable and make your data not be written at exactly equal time periods.
I just got some of the parts, I will begin experimenting and let you know how it goes. First obstacle is learning how to use a 10-bit adc instead of 8-bit.
Thanks
-Steven
Im sorry I dont recall where I got this from, but the files are: ADC_INPUT_DRIVER.spin and ADC_INPUT_example.spin
I took this code and modified it to work with our 1 channel 10 bit ADC. For some reason it is not behaving as I would expect.
When using the command:
DEBUG.dec(chanmax[1]) - The channel minimum value (of the entier run)
DEBUG.dec(ADC.getval(1)) - I get 0
DEBUG.dec(Chanval[1]) - I get the channel maximum (from the entire run)
DEBUG.dec(chanmin[1]) - I get 2
I can solve this by using 'ADC.resetmaxminall' after either Chanval or chanmax to get the current value, but I would think there is a command available to not have to reset every loop.
Also, The value being output is 479, which coordinates to 1.479 (measured) volts. Is there a way to have it output all 4 digits (1479)?
Thanks!
I will begin experimenting with the uSD card soon
I am using Kye's '#SD3.01FATDemo' to get things working. I changed the pins at the beginning of the program to validate everything. I did set this:
_SD_WP = -1 ' -1 ifnot installed.
because I'm not sure what it is, and I dont see a pin with this label.
When I connect with PST i type in help and get the screen, but when I try anything card related (mount, format, etc) It just gives me: Disk IO Error
Not sure what steps to take from here, any hints?
In case it may be a concern, my pins are:
_SD_DO = 21
_SD_CLK = 20
_SD_DI = 19
_SD_CS = 18
_SD_CD = 16
3.3V, GND verified.
Thanks
-Steven
I have set _SD_CD to -1 too otherwise Kye's driver wont work for me.
I've also had to reformat many of my SD cards before they would work with Kye's newest driver. "Fast Format" wont do it neither will the format command within Kye's driver.
What ADC chip are you using?
Duane
Somewhere I can't find it now he suggested you could comment that out. I don't care about date stamps so I use the "fsrw" code.
I dont' see enough info about your ADC chip to comment on it.
I do not have an external clock. I dont need real time but i do, however, need relative time (time between readings)
I have a 6.25 MHz crystal.
I tried formatting it in all the FAT formats, not quick format. Still isnt working. I will try out fsrw tomorrow.
I was having a hard time following fsrw which is why I didnt use it at first. Trying to read through the 'Smart Video' capture files.
Thanks
-Steven
If you don't have an external clock you'll want to set _clockDataPin and _clockClockPin to -1.
Duane
The Video capture can be used without the video part for just audio recording or data recording.
You may need to change the clock settings if you do not use the standard 80MHz clock
So far i have gotten the MCP3001 working with the program linked by Perry. I'm not sure how often it is reading, but it is only putting values out in bursts to PST. Also, it is only showing the '479' from 1.479 volts instead of 1479.
also, I have the uSD card working with Kye's driver and demo, but not standalone.
Im trying to get them working together, but have a few issues. Im trying two combinations. (MCP3001 code with fsrw and the same ADC code i had with Kye's driver.
This is the first one I tried:
This is where I made it to using fsrw.
I am basically following the "Record Video" section from 'Amazing Video' and the fatengine demo from Kye to try and follow the way they create/write files.
Neither are creating the file though. Does anyone see any large errors with either of these methods?
Ill keep trying it out.
Thanks
-Steven
I've been playing with that code for a few days. I understand it is an adaptation onto the MCP3001 file. That file itself works (it outputs in bursts, is that how it measures as well?)
The file you posted works (modified it to write cnt along with the values). When i run it as it all the values are 1007, and when I change the pins to line up with the gyro, it writes cnt correectly, but then random numbers all over the board for the adc value. They vary completely, from a single digit 0, two digits, three digits, four digits.
Im not quite sure why?
Thanks
-Steven
It's a bit more commented.
Thanks,
Code:
Saved Results (Excerpt):
-1306321753,3
-1303027433,0
-1299322665,81
-1296054649,0
-1292374857,0
-1289120377,0
-1285447481,748
-1281800521,0
-1278340889,419
-1274847081,118
-1271392345,612
-1267873849,620
-1264399625,484
-1260889305,0
-1257419881,0
-1253893465,0
-1250438297,0
-1246961113,80
Code 2:
I added the ADC input program "ADC : "ADC_INPUT_DRIVER"" found on here to attempt to write it.
Verified it works as a standalone, but when used to write to the SD the results were:
-1329216274,999
-1325896850,996
-1322119666,998
-1318815090,1007
-1315067682,1007
-1311794642,1001
-1308081666,1007
-1304184754,1000
-1300900018,996
-1297360370,1001
-1293856066,1007
(Test output is 487)
Ill keep trying.
Thanks for the help
but there are several things that seem to be overlooked in questions of timing
writing small strings to the SD card is very inefficient, you need to write blocks at the size of the underlying hardware/software
binary to decimal conversion , it would be faster to dump the raw bytes to the SD. what tools are you going to use for data analysis?
the propeller clocks rolls over in a few seconds , using the "cnt" is not very informative , you probably need an external reference clock
SD cards have variable write times depending on when they need to erase a new block, size of SD card is a great factor in this. Also there are so called high speed products. I am using a generic 1Gb micro SD in an adapter.
I have made another program to address some of these problems.
I don't have an MCP3001 so I am using sigma/delta to do the a/d conversion, my experience with these has been very good, you should expect that the conversion will provide values at their rated conversion time and only need to read them when you want the most recent value.
I running the new version for full 60 minutes, there are few pauses so far....
OK all done, but the buzzing has made me tired will review the results to-morrow.
Jonnymac has posted a program to obex called Etimer that will give you 1 millisecond resolution. You could tie that together with your data from your adc and write the data to the card once per second using a circular buffer to store the data in hub ram until you write it to the card.
RS_Jim
Perry, thanks. I will run that program when I get back to my computer.
RS_Jim. I will use that program to record time instead of cnt. I did not know one was available!