Go Down

Topic: Reading 250,000,000 values from sensor and storing it on SD card (Read 24005 times) previous topic - next topic

v_m_a

ok.. i ll read examples of analog data logger and SdFat library and then code :P


fat16lib

Quote
ok.. i ll read examples of analog data logger and SdFat library and then code

The SdFat examples won't help the data logger example is only good for about one sample per second.

You want to take data 50,000 times faster.  This is the difference between a cow walking around in a pasture and a Mars or Moon lander at max speed.  I don't think your cow will jump the Moon.  You can't do this with stock Arduino programming.

Quote
ADC speed:
http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/

This article is for the AVR ADC so doesn't apply to Due.  The Due ADC is over 20 times faster than the AVR ADC.   

The problem is that the Arduino Due analogRead function will never be adequate for the time jitter you need.  You need a lot more than reading a few hobby level Arduino programs.


fat16lib

#63
Jul 08, 2014, 09:20 pm Last Edit: Jul 08, 2014, 09:30 pm by fat16lib Reason: 1
Here is the ($24 from Future Electronics)  STM32F429 board I am using http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090.

It's almost trivial to solve your problem with this board if you are a skilled STM32 programmer.

The board has an 8MB RAM device that is accessible by the DMA controller.  You just setup a timer, the ADC, and a DMA channel and acquiring up to 4 million samples is almost automatic.  The board has three ADCs and each ADC can digitize samples at 2.4 million/sec.

The three ADCs can run in interleaved mode to digitize one channel at 7.2 million samples/sec.

Too bad you don't have the skills to use this board.  It kills Due at 180 MHz,  2 MB flash, 256 KB fast RAM, and 8 MB SDRAM.

v_m_a

Yeah.. this MCU has cool features..much btr than arduino DUE.. but I dn have that long to complete this assignment..

The thing that I am unable to understand is .. what is the problem with arduino due.. I can use unsigned short int and store 48000 values in one second easily.. the only problem is due to some reason the code repeats twice or thrice..
tough I don't see any glitch in the logical part of the program.. You said my code was junk !! :p Please tell me how can I improve it..

So if I make my code   better.. arduino should be able to solve the purpose.. Isn't it..


v_m_a

I ve also got Raspberry pi if it is easier on that..though i ve never used it till now .. !!

fat16lib

Quote
I ve also got Raspberry pi if it is easier on that..though i ve never used it till now .. !!


Quote
The Pi does not include a hardware analog to digital converter, but a external ADC (such as the MCP3008) can be used along with some bit banged SPI code in python to read external analog devies. Here is a short list of some analog inputs that could be used with this setup.
https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview

Raspberry Pi won't come close for your needs.

Mr_arduino

You know v_m_a everyone started out as a beginner at some point in their lives.
However (in part) the way to take yourself from beginner to more advanced is to actually listen to what people have to say. I have seen some instances where people have given some suboptimal advice on this forum but that is rare and if that is the case someone else can correct that. The issue here is you have a what appears to be in your opinion an important project that sounds like it is for the school that you go to. If I had an important project with a deadline and I had your current lack of programming ability I would try to avoid relying on other people to do all the work for you. I would only post a question as a last resort. I would do my own research and improve my own skills. How I learned to code was I had a goal in mind and I told myself I want to do this. So what did I do? I used my favorite search engine and found out that there were tutorials that could teach me how to do what I want. For example if I want to read a file on the PC and I am using c I could search for "C file tutorial" (without the quotes) and this was the first result. http://www.cprogramming.com/tutorial/cfileio.html I am already familiar with this stuff I just used this as a simple example. It took me around ten seconds to find that by the way. I do hope you continue to program (assuming continue implies improving and learning) and I am sure a few years down the road you will check your post history and think something to the effect of "wow what was I thinking?". I admit I can say that I have had that experience. So when fat16lib tells you that your program is junk (which may be holding back) and you ask how you can improve that is good to hear but you need to be also asking yourself that not just other people expecting them to do everything for you also keep in mind that multiple members have given you helpful suggestions that you have ignored. You know I have not read the datasheet for the SAM3X8E much as I do not know own anything that contains one or have any plans for it but I think an interrupt driven code using dma is your best bet. You should be the one reading the datasheet not I. I read the datasheet for my projects.

Go Up