Author Topic: Speaker simulation model for open source project  (Read 6957 times)

0 Members and 1 Guest are viewing this topic.

Offline gnuarmTopic starter

  • Super Contributor
  • ***
  • Posts: 2218
  • Country: pr
Speaker simulation model for open source project
« on: February 10, 2021, 11:16:51 pm »
I need to design a driver for a speaker to sound an alarm on an open source project.  The drive is from a PWM modulated 32.768 kHz waveform.  I'm not worried so much about the 33 kHz drive, but I would be interested in seeing how the circuit handles that.  If nothing else the speaker and the ear should integrate the 33 kHz. 

I'm interested in seeing the frequency response of the in series cap with the speaker characteristics as well as the resulting current through a sense resistor used to detect a speaker failure.  Yeah, I know, this sounds a bit extreme.  It's for a ventilator where the alarm circuit has requirements regarding this.

I've found a number of web pages that show a 5 element equivalent circuit, LR(LCR) where the parentheses enclose components in parallel and everything else is in series.  What they don't show is how to obtain the parameters for the speaker. 

I've written to the speaker maker to see if they can provide the parameters for simulation.  One of the web pages for the model show how to calculate the simulation parameters from other, equally hard to get parameters such as Mechanical Q factor, Electrical Q factor and other Thiele Parameters.  I'm pretty sure I'm not going to get Thiele Parameters for a 2" speaker (although BMS has them for some of their 500 watt products which would be about perfect other than the price).  I'm not sure I'll be able to get the passive model data either. 

The speaker I'm using has a resonance of 300 Hz and a response range of 150 Hz to 12500 Hz, impedance 50 ohms.  I could come up with values for a three element model, but that doesn't seem it would be as effective as the five element model.  Any suggestions?  I suppose without more data there's no way to come up with a fuller simulation model. 

One effect I'd like to get right is the DC response.  I would expect the DC resistance to be a lot different from the stated impedance but I have no way of estimating that.
« Last Edit: February 10, 2021, 11:50:27 pm by gnuarm »
Rick C.  --  Puerto Rico is not a country... It's part of the USA
  - Get 1,000 miles of free Supercharging
  - Tesla referral code - https://ts.la/richard11209
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12849
Re: Speaker simulation model for open source project
« Reply #1 on: February 11, 2021, 01:32:50 am »
Your GoogleFu is lacking! Try https://www.google.com/search?q=measuring+thiele+small+parameters
This result looked interesting and relatively simple to implement
https://audiojudgement.com/measure-thiele-small-parameters-using-free-software/

Hint: simply measure the DC resistance, preferably using a meter that supports four wire measurement.

Of course if you haven't got the speaker yet, you'll be a bit stuck . . . .
« Last Edit: February 11, 2021, 01:40:56 am by Ian.M »
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3176
  • Country: au
Re: Speaker simulation model for open source project
« Reply #2 on: February 11, 2021, 01:39:33 am »
T&S parameters are pretty straightforward to measure. Here's my tried and true spreadsheet that does it all for you.

https://www.diyaudio.com/forums/multi-way/24864-parameter-spreadsheet-post353269.html
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12849
Re: Speaker simulation model for open source project
« Reply #3 on: February 11, 2021, 01:44:20 am »
@Circlotron,
diyAudio attachments are members only. :( Any chance you can repost your spreadsheet here?
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3176
  • Country: au
Re: Speaker simulation model for open source project
« Reply #4 on: February 11, 2021, 01:50:50 am »
Here you go.
 
The following users thanked this post: Ian.M

Offline gnuarmTopic starter

  • Super Contributor
  • ***
  • Posts: 2218
  • Country: pr
Re: Speaker simulation model for open source project
« Reply #5 on: February 11, 2021, 03:22:21 am »
Of course if you haven't got the speaker yet, you'll be a bit stuck . . . .

Ah, the economist joke.  Castaways on dessert island, crate of canned food, can't open cans, chemist idea doesn't work, engineer's idea doesn't work, economist says, "Assume we have a can opener!" 

No, I don't yet have the speaker.  lol  :-//
Rick C.  --  Puerto Rico is not a country... It's part of the USA
  - Get 1,000 miles of free Supercharging
  - Tesla referral code - https://ts.la/richard11209
 
The following users thanked this post: Ian.M

Offline AaronD

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: us
Re: Speaker simulation model for open source project
« Reply #6 on: October 30, 2021, 05:09:03 pm »
Here you go.

I was running through some old bookmarks and found this, and I got to wondering if it would work with the raw samples of a stereo ADC instead of actual voltage.  So I took the default inputs, moved both of their decimal points to the right, and indeed got the same answers!  So if you're intimidated by calibration, then you don't have to worry about it.  Just use Audacity instead, or anything else that can simultaneously play a test signal and record in stereo.
The only oddity is that the calculated "voltage" at F1,F2 is also in raw samples instead of voltage.  Likewise if you use a fraction of full-scale, as calculated from the convenient dB or dBFS reading: that works too, given the same caveat.

You probably don't even need an amplifier between your line out and the speaker.  Normally, that would be an absolute requirement, as speakers require more *current* than a line out is designed to provide, even if you give them less voltage.  (lower volume)  But the series resistor for this test takes care of that.  If the line out can handle the resistor by itself, with the speaker shorted, then it can also handle the complete test rig.  (if a modern line out can't handle a 1k resistor, it's bad anyway, and needs to be replaced)

Then you don't have to worry about overloading a stereo line input either.  Just make sure that it really is a stereo line in (and not a mono mic in plus power for the mic), wire it up as shown in the spreadsheet, and go.



You do still need a stereo input, despite one channel being directly connected to the output, for two reasons:
  • The line out probably sacrifices a little bit of accuracy for guaranteed stability.  Not enough to notice by ear, but enough to affect this measurement.  So what the test rig actually gets is probably not *exactly* what was sent, and you care about what it actually gets.
  • You're actually comparing the two readings.  It's not absolute.  So you want the two measurement channels to be as equal as possible.  A designed-to-be-stereo input is a pretty good way to do that.



Or if you want to run this test at a higher power, then you do need an amp, and identical resistive dividers for the line inputs.  Maybe 10k/1k for a ~20dB pad.  Otherwise the above still applies: no need to get real-world units out of it; just make them equal (watch the tolerances!) and not overloaded, and call that good.
« Last Edit: October 30, 2021, 05:13:12 pm by AaronD »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf