How to Create a DAQ without Interrupting Data Streams

  • Thread starter taupune
  • Start date
In summary, the author is planning to make a data acquisition device. He has some experience with NI daq's, but wasn't happy with them. He is looking to use Pic microcontrollers and wants USB, digital I/O, SPI, I2C, CAN and ethernet. He is concerned about the speed and interface of the main executable.
  • #1
taupune
25
0
Hi,
I am wondering and been thinking and planning to make a daq for quite a while this couple of months. How can you make one?
I know how to program but a few technicalities are on my way, for example:
When I am sending data through SPI and than I need to send something through digital I/O , the spi has to stop, send my I/O data and than finish with my SPI. The problem is that, SPI has to have a certain speed , and by interrupting it to deliver my I/O data i am spoiling the bit rate of SPI or I2C ( or any serial data stream for that matter).
Another issue and probably the biggest one.
I would like to make an infinite loop that would run all the time and the type of ports that need to be used would be inputs to this main program. The reason would be , so that the end user won't have to program the specific chip and also they won't have to compile anything. He/she/it would just pick up the data type they need , and if they need any other port they can do that later at any time. So what can I use for this main program? Loops, or interrupts?

Are these all the challenges I am going to face or I will have abundantly more?

Thank you.
Looking forward to your inputs.
 
Engineering news on Phys.org
  • #2
taupune said:
Hi,
I am wondering and been thinking and planning to make a daq for quite a while this couple of months. How can you make one?
I know how to program but a few technicalities are on my way, for example:
When I am sending data through SPI and than I need to send something through digital I/O , the spi has to stop, send my I/O data and than finish with my SPI. The problem is that, SPI has to have a certain speed , and by interrupting it to deliver my I/O data i am spoiling the bit rate of SPI or I2C ( or any serial data stream for that matter).
Another issue and probably the biggest one.
I would like to make an infinite loop that would run all the time and the type of ports that need to be used would be inputs to this main program. The reason would be , so that the end user won't have to program the specific chip and also they won't have to compile anything. He/she/it would just pick up the data type they need , and if they need any other port they can do that later at any time. So what can I use for this main program? Loops, or interrupts?

Are these all the challenges I am going to face or I will have abundantly more?

Thank you.
Looking forward to your inputs.

By DAQ, do you mean data aquisition device? Like a general digital IO device?

You would not normally share serial communication lines with general digital IO -- that would confuse whatever was on the other end of the serial communication lines. At least with SPI comm, you can de-select all slave devices, and the master could then re-use the MOSI, MISO and CLK lines for some other purposes, I suppose. But with I2C comm, I don't think you would be able to effectively use the SCL and SDA lines without causing problems at the slave devices.

What microcontroller (uC) are you targeting? Have you looked at commercial DAQ units from Omega, National Instruments and other manufacturers to see what features you want to include in your device?
 
  • #3
Yup , DAQ = data acquisition device
I am planning on using Pic since they are dirty cheap, but later on, once I have some solid code, I might upgrade to arm since they are quite powerful, and not that expensive at all.

I have seen online some DAQ and the options and features they give seem to be the same ones that come from pic families. I can't afford to buy and peak what's inside.

I have some experience with NI daq's and I cannt backbite the company but I wasnt that happy with what I had. I got the cheapest though, but it was still a couple of hundred bucks ( I didnt buy it , my prof bough for some work in the lab).

The SPI and I2C have their own pins. While sme pins have dual use I don't intend to use them that way, they will have only one function their entire code, till the device restarts.I would like to have USB ( for connection to PC), digital i/o , SPI, I2C, probably CAN and even ethernet ... I know I am pushing it to far. I am a little concerned about the speed and the interface that will have with the user, i.e the main executable program.

A side question for you berkeman, is it helpful to have radio license to land a job in communication ( does it impresses the interviewer) ? I just graduated and need to keep my mind fresh.
 
  • #4
Is there a relatively inexpensive PIC eval board with the USB interface chip and connector already on it? That would seem like a good platform to use for your initial DAQ module development work.

On the amateur radio license question, I don't think having the HAM license by itself will stand out on a resume. If you were a HAM who had built a lot of RF projects on your own (especially a software defined radio, or a full-featured digital+analog radio setup), then that would stand out on a resume for general EE work and especially RF EE work. But it's the project experience that would stand out, not just having the basic license.
 
  • #5
I have a development board for PIC already, but it uses serial , which is not of big concern to me at the moment. So what would be your suggestion at developing my main prrogram? Should it run interrupts or using a loop to check the status for any new inputs?

How can I avoid interrupting sending some serial data, in order to send a digital i/o signal? I thought of parallel programing but an old TA of mine advised me to stay away or I will get a let of mess and i won't ever be able to do it, which I agree.

Thanks for the HAM tip. Doing a software radio is in my to do list, but will take some time. :(
 
  • #6
As far as polling or interrupt structures for your DAQ, the main questions to ask are:

What kind of timing do you want (new data every xxx us) - or do you even care?
What kind of resolution for your ADC are you running?
What is the timing overhead of the data acquisition (each ADC reading takes xxx us, etc.)?
How many inputs do you intend to carry? (x analog and x digital)?
What kind of speed do you want to carry for your communication?

Based on the above you can start to break down how you want to execute the code. If you don't care if the sampling occurs at precise intervals, than polling works best. For consistency's sake, I would most likely use an interrupt structure, but you could always start with polling and change the code later.

Remember that the number of channels and resolution will alter how long it takes to sample your inputs. In addition, depending on your communication protocol and speed, you might end up sending 'old' data multiple times prior to getting new data.

If you go the interrupt approach, be sure to check the interrupt priority between the communication interrupt and the data acquisition interrupt.
 
  • #7
I would like to have the serial communications ( SPI, I2C) the fastest, probably above 1MHz, and the digital I/O ... i want them fast , but don't have to be as fast.
Oh, about precision, I want it to be as accurate as possible. Thats one design criteria. For analog, I might include 1 input at about 1-10 khz.

One issue i will face for sure. What can I do in such situation: 1 mb of data going through SPI , and sometime in the middle of data transfer , a digital pin has to latch.I will I handle it? If i stop the SPI data, the speed and timing will go bad, and if i wait till data is finished ... well by that time the digital signal would be waste. How can I handle this?

Thank you.
 

Related to How to Create a DAQ without Interrupting Data Streams

1. How do I choose the right DAQ for my experiment?

Choosing the right DAQ (Data Acquisition) system depends on various factors such as the type of signals you need to measure, the number of channels required, and the desired measurement accuracy. It is important to carefully consider your experiment's requirements and consult with experts or read product specifications to select the most suitable DAQ for your needs.

2. What are the essential components of a DAQ system?

A typical DAQ system consists of a sensor or transducer to convert physical signals into electrical signals, a signal conditioning circuit to amplify and filter the signals, an analog-to-digital converter (ADC) to convert analog signals into digital data, and a computer or data logger to process and store the data.

3. How do I connect sensors to a DAQ system?

Sensors can be connected to a DAQ system using various methods such as direct wiring, terminal blocks, or plug-in connectors. The type of connection depends on the type of sensor and the type of input channels available on the DAQ system. It is important to carefully follow the manufacturer's instructions and use appropriate cables and connectors to ensure accurate measurements.

4. Can I use multiple DAQ systems for one experiment?

Yes, it is possible to use multiple DAQ systems for one experiment. This can be useful if you need to measure different types of signals or if you need a large number of channels. However, it is important to synchronize the systems to ensure accurate data collection and avoid any timing issues.

5. How do I calibrate a DAQ system?

DAQ systems should be calibrated regularly to ensure accurate measurements. This involves comparing the system's readings to known reference values and adjusting the system's settings if necessary. Most DAQ systems come with calibration procedures and some may require special calibration equipment. It is important to follow the manufacturer's instructions and document the calibration process for future reference.

Similar threads

Replies
7
Views
1K
Replies
5
Views
990
  • Electrical Engineering
Replies
22
Views
4K
  • Electrical Engineering
Replies
4
Views
2K
Replies
7
Views
2K
  • Electrical Engineering
Replies
7
Views
2K
  • Electrical Engineering
Replies
2
Views
1K
  • Computing and Technology
Replies
3
Views
1K
  • Electrical Engineering
Replies
13
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
Back
Top