Skip to main content
Arduino

Return to Answer

clarified tasks to be interleaved
Source Link

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

A single board apporach

Since the SD write of the 512 block takes <1mS you could also look a combining these two processes into on board.

Read/buffer/parse fill the 512 block. When it is full, block for 1ms while the SD writes that buffer. This approach will reduce accelerometer sampling frequency. See Simple Multitasking Arduino for how to interleave the tasks for reading/parsing the GPS with sampling the accelerometer and writing the SD card

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

A single board apporach

Since the SD write of the 512 block takes <1mS you could also look a combining these two processes into on board.

Read/buffer/parse fill the 512 block. When it is full, block for 1ms while the SD writes that buffer. This approach will reduce accelerometer sampling frequency. See Simple Multitasking Arduino for how to interleave the tasks for reading/parsing the GPS with sampling and writing the SD card

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

A single board apporach

Since the SD write of the 512 block takes <1mS you could also look a combining these two processes into on board.

Read/buffer/parse fill the 512 block. When it is full, block for 1ms while the SD writes that buffer. This approach will reduce accelerometer sampling frequency. See Simple Multitasking Arduino for how to interleave the tasks for reading/parsing the GPS with sampling the accelerometer and writing the SD card

added single board approach
Source Link

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

A single board apporach

Since the SD write of the 512 block takes <1mS you could also look a combining these two processes into on board.

Read/buffer/parse fill the 512 block. When it is full, block for 1ms while the SD writes that buffer. This approach will reduce accelerometer sampling frequency. See Simple Multitasking Arduino for how to interleave the tasks for reading/parsing the GPS with sampling and writing the SD card

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger)

This project, High Frequency, Long Duration Datalogging, uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

A single board apporach

Since the SD write of the 512 block takes <1mS you could also look a combining these two processes into on board.

Read/buffer/parse fill the 512 block. When it is full, block for 1ms while the SD writes that buffer. This approach will reduce accelerometer sampling frequency. See Simple Multitasking Arduino for how to interleave the tasks for reading/parsing the GPS with sampling and writing the SD card

Post Undeleted by matthew
Expanded solution with more detail
Source Link

"create a Buffer"Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers how to 'create a buffer'buffering serial input, parsing GPS data and how to check for buffer overflowsbuffering serial (text/debug) output. It also has a detailed examplesReading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of Reading and Parsing Instrument Data - GPS his SdFat Arduino library, uses a pre-allocated and A Real World GPS Example erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger )

Also seeThis project, Simple Multitasking Arduino High Frequency, Long Duration Datalogging , uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for how30days. It uses an interrupt to usecollect the loopTimer ADC data and two 512byte buffers it for collecting the incoming data and writing to see how fast/slowthe SD card.

Applying these two projects to your situation you loop is runningcould

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

"create a Buffer"

Arduino Serial I/O for the Real World covers how to 'create a buffer' and how to check for buffer overflows. It also has a detailed examples of Reading and Parsing Instrument Data - GPS and A Real World GPS Example

Also see Simple Multitasking Arduino for how to use the loopTimer to see how fast/slow you loop is running.

Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?

You don't state how fast is fast enough nore how long you want to record the data for. Particularly for the Accelerometer data.

This suggested solution will log ~800 Accelerometer samples/sec (7 x 16bit ints) continually for 30 days.

There are two problems i) reading and parsing the GPS and reading the Accelerometer ii) storing the data on the SD card.

Reading/parsing the GPS data takes time. This tutorial, Arduino Serial I/O for the Real World covers buffering serial input, parsing GPS data and buffering serial (text/debug) output. Reading the accelerometer data is much faster, leave it in binary form.

Storing data on the SD card can be very slow. Bill Greiman's AnalogBinLogger example in an earlier version of his SdFat Arduino library, uses a pre-allocated and erased SD file and special block writes to minimize the SD latency. https://github.com/greiman/SdFat (code for the earlier version with AnalogBinLogger )

This project, High Frequency, Long Duration Datalogging , uses an Uno/Mega to store 512byte blocks of data to an SD card in less then 1mS each block, continually for 30days. It uses an interrupt to collect the ADC data and two 512byte buffers it for collecting the incoming data and writing to the SD card.

Applying these two projects to your situation you could

  1. use on Mega2560 to read/buffer/filter/parse the GPS data and interleave it with the Accelerometer data and buffer it for binary transfer to the second Mega2650 via Serial (115200baud) i.e. ~11.5Kbytes/sec. For 7 x int16_t accelerometer variables that would be about 800 samples/sec over the serial connection in binary format. The standard Mega2560 64byte TX Serial buffer should be sufficient.

  2. In the second Mega265 you need to modify the UART interrupt handler for one of the UARTs to fill the current SD buffer instead of the normal receive buffer. When the buffer is full the interrupt swaps it for a second buffer as in the high speed logger project above.

The second Mega would also have a command and control Serial input to prepare the SD card and start/stop the storage.

Post Deleted by matthew
Source Link
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /