Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Seeking advice on a USB DAQ design.

Status
Not open for further replies.

David_

Advanced Member level 2
Advanced Member level 2
Joined
Dec 6, 2013
Messages
573
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,308
Location
Sweden
Visit site
Activity points
12,242
Hello.

I have a project in mind to build a simple but also as a capable DAQ as reasonable to interface to PC through microcontroller-USB connection, I intend to use SAM3X8E(32bit flash µC, used in Arduino Due) as a master controlling and communicating with ADC/ADCs and DAC/DACs or instead of a DAC maybe a DDS chip.

Anyway, I want to aim at 16bit for the ADC but I wonder which sample rate to go for.
I do have some basic knowledge about these things but not enough to know what choices I do have or what the implications will be and I have some questions that I could need some help with. Although there are no single topic that this fits since it touches on a couple and its no small query.
Here is a quick illustration:
daq.png

The communications between the µC and the data converters/DDS will be serial or SPI hopefully with a 4MHz speed, but how to handle the
PC - µC part...
USB protocol and drivers are far to high above my head to implement my own drivers but I can use USB - RS-232 and manage the RS-232 communication, but I wonder if its possible to somehow enable the data converters to ether talk to the µC or send directly to the PC?
As if the µC would set up the ADC for whatever it should do and then switch the communication path over to the PC or do the data have to go from the ADC to the µC and then to the PC?
Once on the PC Matlab will be receiving.

Then its the question with sample rate, I figure that the limit really is how fast the data can be passed to the PC or handled by the µC?

If I would have a 16bit DAC(hypothetical), what is the pros vs cons between using the µC and possibly a external memory to synthesize waveforms through the DAC and having a DDS chip?
I guess the bandwidth of the output for one would probably be greater with a DDS.

Then I wonder what kind of external circuits would be needed after the data converters/DDS, the ADC I can figure out but I know very little about DAC/DDS needs in that regard.

Then I thinking of how to enable uni- and bi-polar measurement options, some sort of switchable analog front end(to use the full resolution always)

There are many thoughts and I know there are no real structure jet but its a beginning, but I will get to more signal processing later.

Any and all thoughts are much appreciated.

With reagards
 

Unless you give us information about the signals you want measure and generate (amplitude, frequency, sine or square waves .......) we won't be able to advice you any chip or external circuits.

But ...

Shannon/Nyquist say that the sampling rate should be at least twice the highest frequency of your input signal.
That's to say, if the highest frequency of your input signal is 1MHz, the sampling rate of your ADC should be at least 2MSample/sec.

For the resolution, it mainly depends on the amplitude of your input signal. If the input signal has a small amplitude, a 12bit ADC will be enough to get a good resolution.

The USB driver is not a real problem, try to make your µC appears to PC as HID device by using the µC HID's driver delivered by the manufacturer.

These are some guidelines until you give us more information.
 

Sorry, I should have thought about that:)

Regarding Shannon/Nyquist frequency, this fs/2 perspective, is it true that it is generally based on the assumption that its a square wave being sampled and that if one would to be sampling a sine wave fs/2 is not good enough in order to reconstruct the wave form in any acceptable degree?
What is acceptable degree... I don't know but the resulting digital pattern should be recognized as a sine wave.
Or is there a difference in which domain that is relevant, time or freq?

As to what kind of signals I will be measuring, well I am aiming to build a kind of general lab DAQ. DC accuracy is important, I will use a very precise voltage reference.

I have not thought much about how high I should set the frequency that can be measured but I will look over what speeds are available, after writing this post.

As for the amplitude, I think I will try to have some arrangement to have some choices. In general I would like a ±5/10V range such as I can ether have it like -5V to +5V or 0V to 10V, but then I think that I could add some limiter circuit to enable signals up to 30Vdc to be measured on occasion. But that is just a recent thought, I just started thinking that since I do want to also measure very small voltages like mV maybe I should go for a 3V full scale ADC and scale the inputs to that. I can't remember the name but I found a very attractive delta sigma 16bit 4 channel simultaneously sampling ADC with a INL of 0,75LSB max and maybe 2mV offset, I will look it up again.

Regarding USB, yes SAM3X does have such a function. I know nothing about USB HID so I will have to study up on it but I know how to send data with COM ports but how does I access the data coming from a USB HID device?
I assume that the data rate will be increased if going with USB HID rather than USB-Serial?

I'm dead set on a external 16bit ADC and do my best to squeeze out the best performance I possibly can but I can still utilize SAM3Xs internal 12bit ADC. And provided a level shift circuit I could do something with its DAC as well, it's rails is 1/6 VCC to 5/6 VCC.

I would have liked to use SAM4something that has a 16bit internal dual ADC but if going with SAM3X8E I have the benefit of easy support from the arduino community, I'm not sure I am ready to implement a SAM4 all by my self jet.

What is required by a system that will be used to preform FFT analysis and such?
 

I have been reading up on USB HID and it does seem like there are much to get my head around but with time it will be no problem, SAM3X does have PDC(Peripheral DMA Controller) and DMAs and to begin with I will try to set up a PDC channel from the internal 12bit ADC to some memory and then hopefully set up a DMA to take data from that memory and send it to the USB peripheral. But I have some problems in understanding how a FIFO would be best implemented, I have found a written library or FIFO buffer class at https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist
that seems like a good candidate.
I have a arduino Due so I can experiment with the setup before going stand alone, does anyone have anything to say about FIFO buffer implementation?

Using PDC SAM3Xs ADC can operate at 1MSPS not confirmed by me but I trust whoever told me that and thats what the datasheet says so, the same person who showed me how to use the ADC PDC. I'm thinking that I should proceed using the µC's internal ADC and DAC and work out the basic functions before going with the external converters, I might be posting some questions about USB HID implementation very soon.
 

I found a very simple AVR oscilloscope project, allthough the project itself did not intrest me I did notice that the person behind it said that it could not deliver more than 100's of SPS and that the USB HID interface was a bottle-neck.

I'm looking to transmit over 1MSPS, I have tried and am trying to get to grips with HID and all that but so far I don't get it.

Is USB HID slow?
 

Sorry for replying so late, i was busy at work and studies.

1st - To get a fast FFT calculation, your µC must be a real DSP that implements "Multiply and Accumulate MAC" instruction at hardware level. That means it must be executed in 1 cycle just like any other instruction.

2nd- The Shannon/Nyquist frequency, as i know, the only condition is that your signal does not contain a sine wave with a frequency strictaly equals half sampling rate. Read this:
http://en.wikipedia.org/wiki/Nyquist-Shannon_sampling_theorem

3rd- USB HID gives you the possibility to communicate with a rate up to 64KB/sec. look here:
http://www.tracesystemsinc.com/USB_...ooks/A3_A_Closer_Look_at_HID_Class/sbook2.htm
http://www.usbmadesimple.co.uk/ums_5.htm

So to run your µC USB at full speed (12MB/sec or more) you should look here :
http://www.atmel.com/tools/avrusbseries4softwarepackages.aspx?tab=documents
(Atmel AVR4901: ASF - USB Vendor Class Application)

4th- I agree that External ADC/DAC have better specifications than internal devices of any µC.
The drawback is that you have to find how you will interface them with µC.
Let’s not forget the PCB recommendations.

I hope these comments could help.
 
  • Like
Reactions: David_

    David_

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top