Go Down

Topic: New fast data logging sketches (Read 13250 times) previous topic - next topic

Fefas

Fat16Lib,

How are you?

I am a beginner at Arduino programming, I have mostly been using the Lab View Interface to run simple projects. Now I am trying to use a MCP3201 to send info to the Arduino using the SPI.

Can you help me out with a simple code for reading the SPI from the MCP3201?

I am using a Duemilanove 328p connecting SPI using 10 to 13 pins.

I really don't need any fancy speed or logging. I would like to debug a board that we have built for a PT100, but I haven't been able to connect it through SPI.

I am reading your code for the datalogger, but it gets me more confused.

If you can I will appreciate.
Thanks

Fefas

fat16lib

If you just want simple hardware SPI access, read section 6.1 of the datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/21290e.pdf.

Fefas

Hey fat16Lib,

Thanks, I read that. I am trying to write the program, but I don't have a lot of experience on programming, just started.
From what I understood I got to receive 2 bytes, shift the 2nd byte 1 bit to the right and shift the 1st byte 7 bits to the left. Is that correct?
Can you help with the code for that?

Thanks
 

fat16lib

Sorry, I get way too many requests to help with code for things like this.

Fefas

I am sorry to hear about that. Thanks anyway.

giantsfan3

Fefas, You are more likely to get help on your problem, if you post your programming question (about bit-shifting) in the Programming Questions section of the forum:
http://arduino.cc/forum/index.php/board,4.0.html

Hi,
just did some measurements using this lib and put the results here:
Arduino writing to SD Card - Next test based on Fat16Libs fast data logging sketches
http://robertgetzner.com/PersonalWordpress/?cat=37
If you think that this is useful, just copy where it´s better placed (don´t know this forum/etc well enough).
THanks, Robert
http://robertgetzner.com/PersonalWordpress/category/computer/arduino/

giantsfan3

@Robert Getzner:
This is great. Thanks for the detailed analysis!
And I wish there was some wiki where information like this were made permanent (Perhaps the Arduino playground?).
Until then, could you please create a separate new thread/topic on the "Storage" section of the forum, and either link to, or copy and paste, the information from your webpage.
You could perhaps title the thread something generic enough (e.g., "SD card writing at high speed / sample rate") so that future searchers can find it easily.

@giantsfan3: thanks :)
ok for the post, but can´t do it today. Maybe with a title like '[Info] Example measurement for high speed ADC & SD Card writing' and maybe asking interested folks what the would be interested in to be measured further.

I looked at playground -> storagy....am unsure if my post already qualifies for the playground olymp ;) For example I didn´t add the info, which hardware I used, which SD card etc. So it´s no qualified measurement in the sense.

I´m wondering more if a kind of 'getting started with Ardiuno & SD' would help people more (After reading some of the topics in this forum....). Something along these lines
- Working example of setting up the hardware + simple sketch to basically test if it works in principle (people could also be asked to try this before posting questions ;) ) ; could be complemented over time with 'proven SD cards'
- Basic steps to analyze issues (memory consumption, frequency/data volume of updates to/read from SD)
- Decision tree along some questions ( a) volume of data to be written (b) which frequency to you want to log with...). There will also be some ends in the decision tree that end in 'Do not use an arduino, better get a digital scope...')

Opinions?

http://robertgetzner.com/PersonalWordpress/category/computer/arduino/

giantsfan3

#39
Mar 28, 2013, 04:42 pm Last Edit: Mar 28, 2013, 04:48 pm by giantsfan3 Reason: 1
Robert, As the site (http://playground.arduino.cc) states, "This is the place to post and share your own code, circuit diagrams, tutorials, DIY instructions, tips and tricks, and after all the hard work, to show off your projects."

So I think your post more than qualifies, especially because, based on seeing your blog, you have a very clear, organized writing style!

I'm sure most of the community would back you up on that.

And, if you would make a tutorial regarding Arduino & SD covering the various aspects that you mentioned, it could become a much-needed accumulation/bible of all things data-logging-related for Arduino-users. If something like that exists, at least 25% of the SD-storage-related questions on this forum could probably be avoided :)

There are numerous questions coming up all the time regarding data logging, especially faster logging (you have seen the "Storage" section of the forum already). And one of the sadly missing things is that a lot of the knowledge from the forum answers is  never accumulated into a permanent page of wisdom that future users can refer to.

While a lot of the blogs on the Internet, e.g., Ladyada's site, cover basic hardware setup of Arduino-to-SDcard, however there is a big need for authoritative tutorials on the software side of SD logging.

Fat16lib's library of course has been an enormous step, and a tutorial like the one you want to write could be a very useful instructive contribution to lots of people.

I remember I spent nearly a few weeks in my early Arduino days to achieve faster logging than a few hundred points a second; of course, now the target has been extended further!


@giantsfan3: thanks :)
ok for the post, but can´t do it today. Maybe with a title like '[Info] Example measurement for high speed ADC & SD Card writing' and maybe asking interested folks what the would be interested in to be measured further.

I looked at playground -> storagy....am unsure if my post already qualifies for the playground olymp ;) For example I didn´t add the info, which hardware I used, which SD card etc. So it´s no qualified measurement in the sense.

I´m wondering more if a kind of 'getting started with Ardiuno & SD' would help people more (After reading some of the topics in this forum....). Something along these lines
- Working example of setting up the hardware + simple sketch to basically test if it works in principle (people could also be asked to try this before posting questions ;) ) ; could be complemented over time with 'proven SD cards'
- Basic steps to analyze issues (memory consumption, frequency/data volume of updates to/read from SD)
- Decision tree along some questions ( a) volume of data to be written (b) which frequency to you want to log with...). There will also be some ends in the decision tree that end in 'Do not use an arduino, better get a digital scope...')

Opinions?



fat16lib

Be sure to look at this logger http://arduino.cc/forum/index.php/topic,153598.0.html.

It logs multiple analog pins to a text file.

It can log two or three analog pins on a Due at 1000 Hz and all Due analog pins at about 500 Hz.

All 16 Mega analog pins can be logged at 100 Hz.

Here is an example Mega file with all 16 pins read every 10 ms.  The pins are floating so the values trend to zero due to charging the ADC sample and hold cap.

Quote

PERIOD_USEC,10000
ADC0,ADC1,ADC2,ADC3,ADC4,ADC5,ADC6,ADC7,ADC8,ADC9,ADC10,ADC11,ADC12,ADC13,ADC14,ADC15,Overruns
528,466,429,402,388,372,362,352,370,356,361,350,339,346,341,342,0
407,414,409,398,389,376,365,352,352,347,349,344,335,337,334,337,0
365,380,387,386,383,376,368,354,345,342,343,340,333,333,330,332,0
345,355,364,368,371,369,366,352,343,341,342,340,335,335,333,335,0
329,333,339,343,347,348,348,338,328,326,326,325,321,321,318,322,0
329,330,333,337,341,343,344,335,328,328,328,327,324,324,321,321,0
315,315,316,318,321,324,325,320,315,315,315,315,313,313,313,313,0
311,310,311,311,313,315,316,311,307,307,307,307,305,305,304,303,0
305,304,305,306,307,308,310,305,303,304,305,305,304,305,304,302,0
292,291,291,291,292,292,293,290,288,288,288,288,287,288,288,286,0

before taking a text to the Wiki I started with a google document, which everyone with the link can edit directly or put comments in .
https://docs.google.com/document/d/1lGFHpHPfvfGxSzjU8yo5DBLjO2pM0Bl7nwp85h4pftI/edit?usp=sharing

pls have a first look, put your comments in that and then we can decide to create a (sticky?) post in Arduino:Storage to promote this document and the ongoing work on it. As soon as we collaboratively decide, that it`s kind of ready for the wiki, we can copy or link it there. Maybe over time we can identify some named editors keeping the edit access and everyone else can only comment. Let´s see how this works, it´s also the first public worldwide community document editing for me :)

And everyone please feel free to edit, modify, restructure whatever you want in this document. In the worst case we can revert to any previous version thanks to the cloud :o)

As this document is stored under my account @ google I hereby reserve all rights to remove any inappropriate, abusive or whatsoever unhelpful stuff that may come in; but of course the technical content remains owned by the community.



http://robertgetzner.com/PersonalWordpress/category/computer/arduino/

Go Up