LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MyRio ANC feedback measurement problem

Solved!
Go to solution

Hi, I've been working out how to apply an example from digital filter design toolkit (Active noise control with feedback neutralization for compactRio and two modules) to MyRio and got everything right to the point that the programme can seemingly run everything just as it would with the original hardware.

The trouble was that during the Feedback Path and Secondary Path Modeling phase (you will see explanation of this part in the "Active Noise Control with Feedback Neutralization (RT).vi" under MyRio in the attached) the noise produced by the control speaker, which is used to estimate the feedback path between the speaker and the two microphones, was very weak. Because of that, when I turned up the volume too much, the noise would become distorted, and the programme would be unable to do active noise control (it would make high-pitched noises, even when there was no sound). I used an oscilloscope to measure the signal MyRio sent to the control speaker, and it turned out it was only 13mv, compared with 8mv when MyRio was turned off. I modified the "Active noise control...(FPGA).vi" on the MyRio and multiplied the sound output 100-fold, in hope that the noise would not lose quality. However, the sound of the control speaker, while less distorted, still appeared to be random, and labview was still unable to estimate feedback response, and so the noise cancellation still didn't work. 

In short, I remade a compactRio active noise cancellation programme into a MyRio programme, substituting the relevant portions of code. I provided MyRio with two microphones and a speaker, and they all work, judging by the graphs and sounds they produce. However, the sound is sketchy and the feedback measurement carried out by the programme doesn’t seem to work.

Do you have any idea how to fix this?

Some portions of the code might be stuck in the AdaptiveFilters.dll, a library which the ANC application often refers to. Maybe the programme was devised exclusively for compactRio?

Is it possible, that MyRio generates sound in a different way, so that methods in the adaptive filters don’t work well for it?

Was the programme designed to generate a sine wave or white noise or anything specific?

 

I run Labview 2018 on Windows 10 with FPGA, MyRio, Digital Filter Design Toolkit, Real-Time component and MyRio with 2018 versions of the same toolkits. I used a hs250 amplifier, a middle price range Akira speaker, two working jack microphones plugged into right and left channels of audio input, and all the other hardware was tested before it was used.

 

0 Kudos
Message 1 of 8
(1,357 Views)

I couldn't easily follow your code, including seeing where you do the A/D and D/A conversions.  I don't know what the resolution of the cRIO for whom the code was designed, but I'm guessing at least 16 bits.  The myRIO is 12 bits.  Could this "factor of 16" have an effect on your code?  What about the sampling rates?

 

Bob Schor

0 Kudos
Message 2 of 8
(1,314 Views)

I tried different settings for the table inside active noise cancellation (FPGA).vi, like trying out I8 instead of I16. It didn't change anything. I figured out, that the table plays different sounds and then compares them with the actual sound, but it works poorly. I'm not even sure if the programme takes latency into account, and there might be 20ms or so (relatively quite a lot) coming from the amplifiers I use. I didn't find any place where the programme would test the latency, so it might not keep up with what it plays.

Anyway, I bought 2 electret microphones to make sure that microphones were not at fault.

Also, the MyRio has a built-in AD converter. The only difference between the original compactRio programme and the one I'm trying to run is that the input nodes are for MyRio and there is no block of code setting the data rate of NI 9233, which was originally used for data acquisition. There is no such option for myRio apparently. 

I wonder if the original programme had other references to compactRio, for example references to an errors.lib file. Then I can't really change them, but the programme was in an examples folder, so it should be modifiable.

If anyone attempted the "ANC with feedback control" project please let me know, because I have doubts if I'm doing this properly.

I'll keep you posted if I find a fix.

0 Kudos
Message 3 of 8
(1,270 Views)
Solution
Accepted by topic author jakubgrad

Okay, it turned out that a few factors were at play here.

Firstly, the microphones were not well-suited for MyRio. They had too much distortion and too weak signal. I turned to electret microphones with preamps (I went with a pair of Max4466’s). Apart from that, the cables were not shielded enough and the bunch generated ground loops of 60 and 120 hz, which MyRio took as signal from microphones. Higher harmonics resulted in high-pitched cracks and clicks. I also had to make some changes to the ANC (FPGA).vi because the programme didn’t read the signal properly.

0 Kudos
Message 4 of 8
(1,212 Views)

Dear jakubgrad,

 

I chanced upon your post and I am facing almost similar points you mentioned with my experience of using the Active noise control example with feedback neutralization. Could you share your code and changes you made to the ANC (FPGA) vi? I seem to be able to cancel out tonal noise such as 1kHz, 700Hz ..etc. Sometimes I still get the feedback you mentioned, but I am not sure if the microphone I am using may be an issue (B&K Type 4966). Nonetheless, I am reaching out to purchase GRAS microphones to see if that may resolve the problem.

Also, have you been able to successfully cancel broadband noise (or band-limited white noise) cancellation in your experience? Thanks for sharing!

 

0 Kudos
Message 5 of 8
(1,061 Views)

Hi, first of all thank for reaching out!

In both the ANC (FPGA) and ANC (RT) vi's I created additional user inputs to experiment with different settings, among them the choice between different look-up tables (screenshot) for acquiring data for feedback path and secondary path estimation. I haven't been able to finish the project since I had to move; I might come back to it within the next few months, but I'm probably going to start from ground-up since the code I ended up working with is quite messy. With that in mind, could you share your code as well? Mine hasn't worked for tonal noise cancelation as far as I've tested it. I attach the most edited version of the project I've created.

0 Kudos
Message 6 of 8
(1,010 Views)

Dear jakubgrad,

 

Great to hear back from you!

I did not do much changes to the original project example, except adding IEPE excitation to my microphones using the cRIO MOD1/MOD2 setup. Which might not be necessary for your case since you are using the a different setup (myRIO). I also mainly changed the step sizes on the LMS and FXLMS during operation and this changes the cancellation response quite drastically.

 

For my experimentation, I was able to cancel tonal frequency noise using 2 active powered speaker (same speaker model - just some random brand) and 2 B&K microphones (identical tyoe 4966 model). Sometimes, I get very loud distorted feedback from my cancellation speaker. I found that changing the step size for the FXLMS (not the LMS) helped to manage this abit, but even then, with very small step size (5E-5), I may still get really distorted output from the cancelling speaker. I am not sure why, but when it does cancel the tonal noise (single frequency <1kHz), it does it quite sucessfully especially for lower frequencies like 200Hz, 300Hz.. etc. But when it doesn't cancel, it gets very distorted. Something as simple as accidentally moving the cancelling speaker, or changing the volume of the speaker, or even my hands going near the microphones causes the instability mentioned. 

Nonetheless, I am trying several methods such as adding lowpass filter just before the AO output to see if it helps (more on why later). I'll let you know if there is any success.

 

Beyond single tonal frequency, I seem to be able to cancel multi tonal disturbance somewhat successfully as well, 2/3 tonal frequencies (I've only trialed tonal frequencies below 1kHz). 

However, I have no luck in cancelling broadband frequencies or bandlimited white noise. The cancelling speaker does not respond at all. I am not sure if the project example is meant to perform under such noise disturbances. Mostly I get the really loud distorted feedback when I attempt such cancellation.

 

I have a few thoughts as to my problems and I am not sure if you'd find similar problems in your experiments? I think the loud distorted feedback is caused by other noise introduced to the reference speaker and the error microphones tries to cancel them by driving the cancelling speaker to very high amplitude, and because it doesn't respond, it continues to drive it till distorted levels. I am not sure if these noise are introduced from; harmonics caused by the main external noise speaker or some other vibrations near the microphones, or due to grounding?

 

Secondly, I wanted to ask about your LUT and feedback path modelling, when you are at the feedback path modelling stage, does your speaker tend to create some noise and then abruptly stops and starts again at regular intervals? It is happening to my setup, although I still get cancellations at tonal frequencies. But the noise created by the cancelling speaker during the feedback path modelling feels wrong.

 

If anyone else have some experience in using the Labview ANC example, could you chip in and let us know your thoughts about the problems? Thank you so much!

 

 

0 Kudos
Message 7 of 8
(999 Views)

Hi, thanks for the reply and advice!

 

You can check if you have ground loops or other distortions coming from the hardware by looking at the “Power spectrum of residual noise” in the ANC phase when no speakers are playing. If you get a spike in 60 or 120hz, that could be ground loops or your electrical supply polluting your signal.

Loud distortions might come from the feedback from the room, such as reflected sound of the speakers. Otherwise, when harmonics appear in your “Power spectrum of residual noise”, it is a sign that the microphone is overloaded with sound and produces additional frequencies (harmonic distortions) that are simply not there, for which the error speaker tries to compensate, thus creating positive feedback loop.

Distortions after moving the speakers might appear because the distance between the microphones and speakers has changed, and the feedback path and secondary path modelling is now wrong.

I think adding low pass and high pass filters might be a good idea but never in the “Feedback path and secondary modelling” phase, since by default the programme uses also lower frequencies from the “Look-up table” to measure the feedback path. You might experiment with the look-table to be specifically in your range of sound. In any case, if you add a filter for frequencies in this phase, I think it might later overcompensate for the reason that certain frequencies are quitter than they in fact are. In the active noise control I think it might be worth it to add a high pass and low pass filter for the input.

In my opinion, upwards of 1khz is too high to be effectively cancelled actively. A 1khz wave is 3.4 cm long, so already it should be pretty hard to cancel it with normal-sized speakers. Even more so with the white noise. As far as I understand it, white noise/broadband noise cannot be cancelled in any case because it is random, and the adaptive filter used in ANC is an optimization algorithm that tries to predict noise rather than cancel it immediately when it reaches the microphones.

I no longer have the setup to see if the speakers stop at any moment during the feedback path and modelling stage. I don't remember if it made pauses when I was testing it. Maybe the look-up table from which it produces sounds has frequencies that can’t be played by the speakers? Or maybe the programme makes breaks before repeating the sounds from the table? Again, maybe you can find out by experimenting with the table.

0 Kudos
Message 8 of 8
(978 Views)