Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with using multiple piezo sensors with DAQ

Solved!
Go to solution

Hey there,

 

For a drum program, i have 2 piezo buzzers connected to the DAQ, In the code I have it set up so that a different sound sample would be assigned to each sensor. However initially when i ran the code, i hit one sensor (a1), it plays that ok. When i hit (a0), its kind of random. It sometimes plays the sample assigned to a0 or a1 or plays on then the other.

 

Then from messing around with the DAQ assistant i changed the input signal range and found that the a1 input played the a0 assigned sound instead. My mind is boggled.

 

Attached code.

 

Thanks in advance,

 

Emile

0 Kudos
Message 1 of 13
(4,467 Views)

Hi Emile,

 

Looking at your code, I can see you are sending your queue to two consumer loops.  Currently, one loop will dequeue the 1st element, then the other loop will dequeue the next one, and so on.  I think this may be why you are not getting the expected sound file for the drum sensor being activated as you will only be outputting a sound file for every other set of daq samples.

 

In the attached VI's I have stripped out your processing and am simply passing the producer loop iteration number into the queue to illustrate how the elements are being dequeued and where.

Dequeue1.vi illustrates how the elements dequeue in alternating consumer loops.

Dequeue2.vi illustrated one solution that passes the data into both loops.

 

I hope this helps, but please post back if you have further questions.

Sheela Sujeeun

Applications Engineer
National Instruments UK
Download All
0 Kudos
Message 2 of 13
(4,449 Views)
Hi Sheela, Thank you for your reply. Unfortunately the version of LabVIEW on this computer is an older version which is 8.5.1. And I am not able to open the VIs. :( Emile
0 Kudos
Message 3 of 13
(4,440 Views)

Hi Emile,

I hope you had a good Easter break. 

My apologies for the 8.6 versions, and for your having to wait the long weekend for these versions.  I hope these illustrate my original point.

 

Sheela Sujeeun

Applications Engineer
National Instruments UK
Download All
0 Kudos
Message 4 of 13
(4,421 Views)

Hi Sheela

 

Thanks, I had a good Easter break. Hope you had a good one too.

 

I modified the code from with the way it is shown from the Dequeue 2 VI you gave me. I still have the same problem.

 

Perhaps it might have something to do with the "split signals" block not seperating the signals the way i want it to?

 

Also i notice from the waveform graph the when i hit one sensor i see a voltage change from one of the sensors, but when i hit the other sensor I see a voltage change from both sensors and from that i can see how im hearing the 2 samples.  But i dont know why there's a change in voltage in both sensors when i hit one sensor.  The wires from both sensors are completely seperated.

 

Thanks again for the help.

 

Emile

0 Kudos
Message 5 of 13
(4,369 Views)

And here's the slight change i made.

 

 

0 Kudos
Message 6 of 13
(4,368 Views)

Hi Zerroth,

 

I cannot see anything wrong with your code. You can verify that the split signals function is working correctly by putting graphs on each of the output signals just to check that you only see on channel per output.

I am wondering if this might be a hardware/connection issue.  Which DAQ device are you using?  How do you have the sensors connected - which pins are you connecting to?

Sheela Sujeeun

Applications Engineer
National Instruments UK
0 Kudos
Message 7 of 13
(4,364 Views)
Hi Sheela, I put the graph on each output and when i hit either one of the sensors. You see both responses reacting but not in the same way as in one peak is larger than the other. The DAQ device im using is NI USB-6251. In the DAQ assistant the Terminal Configuration is set to Differential. One piezo is connected to pins 1 and 2. The second piezo is connected to pins 4 and 5. There is also ground wires connected from pin 2 to pin 3 and from pin 4 to pin 5. Thanks again, Emile
0 Kudos
Message 8 of 13
(4,350 Views)

Hi Emile,

 

Sorry for the delay in getting back to you.  The channel crosstalk that you are seeing is due to the connections you have made to the AI GND pins.  By connecting up in this way, you have created a hybrid between differential and referenced single ended wiring modes.  The connection to ground you are making allows the signal on one channel to transfer to the adjacent channel.  So I would recommend removing the ground connections, and see how that goes. 

For some further information on wiring modes, please see this devzone article: Field Wiring and Noise Considerations for Analog Signals 

If you have any further questions, please post back.

Sheela Sujeeun

Applications Engineer
National Instruments UK
0 Kudos
Message 9 of 13
(4,309 Views)

Hi Emile,

 

How are you getting on? Were you able to solve the problem?  If you have any further questions, please do post back.

 

All the best

Sheela Sujeeun

Applications Engineer
National Instruments UK
0 Kudos
Message 10 of 13
(4,256 Views)