Arduino and Due Web Page

Welcome to Dave’s Arduino blog. I would like to hear from you.

Dave

 

10 Comments

  1. Dave Erickson says:

    I added a new page on the Arduino Digital Panel Meter project. The prototype is working and I am in the process of laying out a PC board. Should be a small, accurate, flexible alternative to commercial panel meters. Also a starting point for analog controller projects.

    Dave

  2. flug14 says:

    Hi Dave,

    i read yout blog about analog performance of the Arduino Due:
    http://www.djerickson.com/arduino/

    I’m working on a bio-signal amp and want to convert the amplified data at a constant sampling rate and with a minimum resolution of 12 bit using the arduino due.
    I can’t find out at what sampling rate the arduino is working and how to set up the sampling rate. AnalogRead() is working at about(?, jitter) 10kHz. That would be enough, but that’s not the internal sampling rate, I guess. Do you know how to get a constant and adjustable sampling rate at 12 bit with Arduino Due? It should work for 2 channels simultaneously. Many thanks in advance, best

    Simon

    • Dave Erickson says:

      Hi Simon,
      I haven’t done much work with Due since this last blog post. I decided that the 12 bit ADC noise was only good to about 10+ bits, and really needed 12+ bits. Averaging could help but since you are pushing both bits and speed, that may not work for you. Since I need to use an external ADC, and don’t need lots of I/O, might as well use a cheaper 8 bit Arduino. Look for my up-coming Arduino Panel meter project.

      If you just run Arduino’s analogRead() function in a tight loop, the timing will be in the KHz range, not very accurate, and any other interrupts will cause sampling jitter. The right way to get precise timing with a microprocessor ADC is to trigger the ADC from an internal timer. Either use a timer interrupt to run the ADC routine, or set up a hardware trigger for the ADC. I’m not sure which of these is best for each Arduino. Then you’ll need to write your own getAnalog() function to run as fast as possible. It will require diving deep into the processor data sheet.

      Best of luck.
      Dave Erickson

  3. flug14 says:

    Hi Dave,

    thank you very much for the quick answer
    and your thoughts on this topic.
    I’ll try to use a timer interrupt.
    The large jitter with analogRead makes it very
    diffifcult to interpret the signal afterwards,
    because the exact sampling rate isn’t clear.

    thx, best
    simon

  4. jean_baptiste says:

    Hello Dave,

    Many thanks for this blog. I have read the evaluation of the Arduino Due board an it was very useful. I wanted to speed up the A/D conversion and your solutions are great.

    Now I am faced with another task: I want to send the data via WiFi to a computer, so I bought a WiFi Shield. The thing is that the transfer occurs, but it is painfully slow (I managed to get it down to 45s for 5000 samples). I am using the client.write() command and the samples are put into a char buffer that speeds up the process.

    Do you have any tips for me in how am I capable to increase the transfer rate vi WiFi?

    Best regards,
    Jean
    P.S. I have tried also UDP, but I cannot make it work.

  5. David says:

    Hello Dave.

    This was a great read, I have some real trobble making up the Excel functions for RMS and P-P. I have searched the internet and found examples but they don’t work, not for me but I might have got it wrong through a language translation error. However would you mind posting the formula for your functions for RMS, P-P?

    Again a most interesting read,
    Best wishes David

  6. bazz says:

    Dave

    I’ve just come across your discussion about the Due’s ADC performance.
    When you changed the contents of the ADC Mode Register, did you first have to change the contents of the ADC Write Protect Mode Register? If so, how did you do it?

    My Due shows the value of REG_ADC_MR as 10380200 (SETTLING=3, STARTUP=8, PRESCAL=2) and I would certainly like to reduce the STARTUP value!

    My value of REG_ADC_WPMR = 0. No mention of the value of WPKEY or is this only added by the user when changing the register status?

    Bazz

    • Dave Erickson says:

      Hi, glad someone is interested. Good question, I had not noticed that there was an ADC Write protect function. Nope, I didn’t do anything with it, and don’t think the Arduino folks would either. Seems too deep for typical Arduino users (like me).

      Dave Erickson

  7. bazz says:

    Dave

    Why isn’t this working then? My initial value of REG_ADC_MR is 10380200 and your code should change that to 10320200 but nothing happens!

    unsigned long reg;
    Serial.begin(115200);

    reg = REG_ADC_MR;
    Serial.print(“REG_ADC_MR = “);
    Serial.println(reg, HEX);

    REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0×00020000;
    Serial.print(“REG_ADC_MR = “);
    Serial.println(reg, HEX);

    Baz

  8. bazz says:

    Dave

    I’ve modified your code slightly and it does work!

    unsigned long reg;
    Serial.begin(115200);

    reg = REG_ADC_MR;
    Serial.print(“REG_ADC_MR = “);
    Serial.println(reg, HEX);

    reg = (REG_ADC_MR & 0xFFF0FFFF) | 0×00020000;
    Serial.print(“REG_ADC_MR = “);
    Serial.println(reg, HEX);

Leave a Reply

You must be logged in to post a comment.