How best to sample two sensors with different sample rates

Discussion in 'General Electronics Chat' started by emoney123, Oct 6, 2016.

  1. emoney123

    Thread Starter New Member

    Jun 4, 2012
    6
    0
    Hello,

    I have two sensors, one a magnetometer that samples at a max rate of 160Hz (I need the max rate for my application) and an accelerometer that has multiple sample rates that can be set. I would like to sample the accelerometer at 500Hz. If the magnetometer amplitude reaches a specific threshold I need to analyze the accelerometer data at that moment. What would be the best way to go about doing this as to not corrupt data or loose samples.
    Thanks
     
  2. wayneh

    Expert

    Sep 9, 2010
    12,083
    3,021
    What are the outputs of your sensors, analog voltage or digital stream?
     
  3. emoney123

    Thread Starter New Member

    Jun 4, 2012
    6
    0
    Sorry, I should have included that. They are both digital sensors.
     
  4. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,761
    1,099
    How long does the analysis take? Is there sufficient time to do it in between reading samples from the other magnetometer?
     
  5. emoney123

    Thread Starter New Member

    Jun 4, 2012
    6
    0
    Yes, there is sufficient time however I would like continuous data from the accelerometer not just after the magnetometer reaches threshold.
    Thanks
     
  6. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    So you are asking what controller to use for processing this data?
    Do you want it to go to a PC or a microprocessor?
     
  7. emoney123

    Thread Starter New Member

    Jun 4, 2012
    6
    0
    No, I have a controller I just am a little confused at how to sample both sensors together without syncing them somehow. I can't just send up both sensors data at the 160Hz rate for the magnetometer becuase it is the below the nyquist of the accelerometer data rate. Maybe I'm looking at this the wrong way.
     
  8. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    I am confused. :confused:
    You said the sensor data is already digital at each sensors' sample rate.
    So why are you concerned about that?

    Or are you trying to send both data streams through one set of wires?
    If so there's nothing wrong with oversampling the magnetometer data if that's the easiest.
    You will just get several samples with the same reading.
     
Loading...