Audio exciters driven simultaneously

Hi guys, I'm new in using Arduino and I need some help to start my project.

I have to coordinate 5 audio exciters simultaneously. I can't use the function tone() because it would require to use one exciter at the time. Exciters must run all together and must have the same frequency but different amplitude.

Is there someone who can help me in solving this problem?

Thanks in advance!

I have to coordinate 5 audio exciters simultaneously.

Can you be more specific here? What I understand as an audio exciters is a tailored transfer function that introduces controlled amounts of harmonics into a sound.

But with you saying:-

I can't use the function tone() because it would require to use one exciter at the time.

It would seem that what you mean by audio exciter is not what I mean by it. So can you point me to the audio exciters you have and say what sort of waveform you need to feed them with?

This is what I consider audio exciter: https://uk.rs-online.com/web/p/speaker-drivers/8765272/

It's an exciter used to make a surface vibrate. I need them to make an object vibrate.

The waveform is not important to me, it can be a sine wave or a square wave, what it is important is that all the 5 exciters emit a signal simultaneously.

You drive those things with an audio amplifier, and most amplifiers have a volume control.

You can but some [u]small amplifiers[/u],* or there are lots of amplifier chips if you're up to building them, or you can buy amplifier boards.

Since audio power amplifiers typically have high-impedance inputs (10K or more) the Arduino can drive lots & lots of amplifiers with the same signal at the same time. (You should put a capacitor in series with the output to filter-out the DC.)

but different amplitude.

Is it OK to use the amplifier's volume control, or do you need to control the volume with software? If you need software control you can use digital pots.

  • That particular amplifier is sold without a power supply so you have to buy it separately.

what it is important is that all the 5 exciters emit a signal simultaneously.

Do these need to be different frequencies?

If so look at this Driving 5 Speakers Simultaneously with an Arduino – JeremyBlum.com

Their are many other libraries that do this sort of thing as well. Each speaker will need it's own amplifier, you can not drive these things direct from the Arduino's pins.

Is it OK to use the amplifier's volume control, or do you need to control the volume with software?

I need to control the volume through software adjusting it according to parameters that are read from other pins.

The signals' frequency is the same for all the signals, the phase and the amplitude are the only things that change from one signal to another.

Is there some kind of problem if I connect all the amplificators to the same pin in order to turn them on?

If so look at this Driving 5 Speakers Simultaneously with an Arduino – JeremyBlum.com

I already found that guide but it uses different frequencies, can I do the same using the same frequency for all the signal, what do you say?

I need to control the volume through software adjusting it according to parameters that are read from other pins.

The signals' frequency is the same for all the signals, the phase and the amplitude are the only things that change from one signal to another.

So kind of you to eventually tell us what you need.

So please complete the story and say what you are trying to achieve. That will determine if you need separate amplifiers or not. Only then is it worth finding out a soloution to your real problem.

I'm trying to do an active audio isolation system. The idea is that an exciter emits a sound at a certain frequency and the other 4 cancel the sound wave that arrive near them.

What I need to do is make the 5 exciters run simultaneously producing a signal that is equal in frequency and different in amplitude.

But their is a hell of a lot more to this project than just the vibration generators is their not?

Changing the phase is simple enough but changing the amplitude means an analogue output of some sort. What range of frequencies are we talking about? What sort of Arduino are you thinking of using?

What sort of Arduino are you thinking of using?

I was thinking to use an arduino pro m0 or an arduino mega 2560, what do you think?

What range of frequencies are we talking about?

The frequency must be 100Hz as indicated in the project specifics

I think the M0 would be better than the Mega. However you might be better off with a Teensy3.6, they have a graphics based DSP libiary.
https://www.pjrc.com/teensy/td_libs_Audio.html

The frequency must be 100Hz as indicated in the project specifics

So is this some sort of assignment then?

Ok thanks! I still haven't understood what is the difference between using a DAC output pin and a PWM output pin using the function analogwrite().

Can you please explain me what's the main difference between them? Which should I use in my project?

Moreover, is the guide that you suggested me still usefull in my case?

PWM for audio is restricted to 8 bits and you need a filter to smooth the signal. PWM

So for your project you will need either five timers or a bit of programming. With the D/A you get a pure voltage that needs little or no filtering. However you will need five of them and an M0 or Teensy only has two, so you will need external hardware normally SPI interface.

Perfect! I think I will get an external hardware for the other 3 DAC.

At this point there is just the initial problem to solve, how to emit a signal on all the exciters simultaneously since the function is able to work one instance at a time?

The link I posted in reply #4 shows you the basics, only instead of toggling a digital pin you maintain a count of how many times you have entered the interrupt routine. That count is restrained to the length of a look up table of your waveform, normally a sin wave. Then the value that the count points to in the look up table is output to the D/A.

To alter the phase you add an offset to the count, to alter the amplitude you multiply the sample you get by a floating point number between zero and one. Each D/A can have its own offset and multiplication factor. That way all the signals are the same frequency but with separate amplitude and phase.

Thank you very much!

Can the impedence of the amplifier interfere in the system or it is unimportant?

One last thing, in that guide, it is required the Greatest Common Factor and in his case it was correct because he has different frequencies but in my case the greatest common factor is the frequency itself due to the fact that all the frequencies are the same. How can I calculate the number of counters after which the program has to reset the counter?

Can the impedence of the amplifier interfere in the system

Which amplifier and which impedance? Normally all amplifiers have a high input impedance and a low output impedance.

One last thing, in that guide, it is required the Greatest Common Factor and in his case it was correct because he has different frequencies but in my case the greatest common factor is the frequency itself due to the fact that all the frequencies are the same.

No, the common factor is the number of entries that you have in the waveform look up table. The more entries the greater the phase adjustment resolution is.

The amplifier has 100 kOhm in input and 4 Ohm in output. How does the impedance can influence the system?

I don't understand what you mean with the waveform look up table. Also because looking at the guide, the guy increases the value from 50 to 64 due to the fact that it has to trade off. So in my opinion it is not true that the greater the value the better the phase adjustment resolution is and I can't understand what value I have to use to divide the period of the signal.

So in my opinion it is not true that the greater the value the better the phase adjustment resolution is

So that means you are not understanding a lot of what I have told you.

I don't understand what you mean with the waveform look up table.

So when I mentioned look up tables in reply #14 why did you not mention this in reply #15, you just gave the impression that you had understood it?

I did warn you that this was not a beginners project. For look up tables see:- Wavetable synthesis - Wikipedia

Maybe look at this project for the look up table bit:- http://interface.khm.de/index.php/labor/experimente/arduino-realtime-audio-processing/ He uses the PWM method for output but you can just take the sample and feed it to an A/D.

Maybe a bit more background knowledge is needed, try reading this PDF:- https://www.elektormagazine.com/files/attachment/331 written by our very own David Cuartielles.

The amplifier has 100 kOhm in input and 4 Ohm in output.

So if this the amplifiers that drive the "sound exciters", then this looks about right to me for that job.

I read all the links that you sent me and now I have an idea of what you meant. So I have to create a lookup table with the values of the sine wave (the great common division, as the guy calls it, is just the dimension of the lookup table and the greater it is, the greater the resolution of the sine wave is, correct?) and implementing an interrupt system I have to increment the counter that will be the index for the lookup table. At every interrupt, the DAC outputs the sine wave value of the lookup table corresponding at the position pointed by the counter, correct?

   /* We need to calculate a proper value to load the counter.
   * The following loads the value 248 into the Timer 2 counter
   * The math behind this is:
   * (Desired period) = 64us.
   * (CPU frequency) / (prescaler value) = 125000 Hz -> 8us.
   * (desired period) / 8us = 8.
   * MAX(uint8) - 8 = 248;
   */

In my case, how can I identify my period and the prescaler value? It is not specified anywhere