Speaker Issues

Hello All!

I just finished building my first Proffie saber and I’m running into an issue with the sound. When I turn on the lightsaber, all sounds are crackly and distorted. The sound files sound fine when I play them on the computer, so I know it shouldn’t sound like this. I’ve tested a few different things to try finding the problem, but I’m not getting anywhere:

  • When the saber is on, the 5v pad measures 5.1v (So I think that’s good)
  • get_volume comes back with 1000, what I have set in my config
  • running beep on the serial monitor plays the beep and it sounds fine
  • resistance across the speaker pads is ~8 ohms
  • Replaced speaker with a new one

Does anyone have any thoughts on what it could be? I’m not sure what else to try. If it helps, I’ve attached a link to a video here: https://photos.app.goo.gl/QoSYGHW31ioJhDDTA

The distortion sounds like a high pitched buzzing or rattling. I’ve also made sure that everything is tight and nothing is physically rattling on the saber to make the noise.

That’s pretty bad, and you’re right, it does sound like there is something loose in the speaker, but if you’ve already tried replacing the speaker, then that’s obviously not it.

I’ve heard that some boards have problems like this when the battery is low. I’m not sure what causes that, but have you tried charging the battery?

Another thing to try would be to replace the SD card. This doesn’t really sound like an sd card problem, but sd card problems are many and varied.

You know, I thought it was charged, but now that I tested it again, it might not be. Measuring between Batt+ and ground, I get 3.82v. But when I plug into the charger, the light turns red for a little bit and then starts blinking red. I’m wondering if its not actually charging. I just assumed the blinking red meant that its full.

I’ve tried a few SD cards now, thought the same thing, but none of them changed it at all. I also just flashed fresh firmware and used the original config, so I’m hoping its the battery, thats my last lead.

Although when I boot the lightsaber with a font with a battery indicator (Fett263 passive battery on boot), it shows it as green.

3.82v should be enough.
Still if the battery is acting weird, maybe try a different battery?

I think I figured it out. I swapped the battery for a known good one and still had buzzing, so I put the original battery back. Swapped the speaker for another type that I had and that worked fine, no buzzing at all. So I guess I just got two bad speakers.

The issue now is that the one I used to test with is an 8ohm 0.1W speaker. I dropped the volume down to 300 just to be safe. But I cant use that long term because its too quiet.

So I guess I’ll buy another speaker to see if that was it. Any recommendations? My first two were these, so I’m thinking I’d like to try something else.

Hmm, are you sure that it’s not just sounding fine because you dropped the volume?
It’s not uncommon for boards that have problems with the booster to sound fine at low volumes.

Thats something that I was wondering. Unfortunately I don’t know if there’s a good way to test without a known good speaker. Is there a way to test for a booster issue?

Most of the time, the 5v pad will not have 5 volts when the booster is bad.
However, it’s not entirely uncommon for the booster to be “weak”, meaning that the 5v sags when you’re playing sounds. Unfortunately you need something that can measure voltage quickly, like an oscilloscope to test that properly.

One alternative way to test the booster is to take a 5v power supply and hook up between GND and the 5v pad. If that suddenly makes the sound work fine, then the problem is clearly with the booster somehow.

Hmm, OK. I should be able to test with a power supply, I’ll just have to find mine.

Is it normal that the 5v pad only has 5v when sound is playing? Or is it supposed to be 5v all the time?

It is turned off when not needed to save power.

1 Like

I think I may have solved this. I tried your suggestion, hooked up a power supply at 5v to the 5v and ground pads, no change. After that I just ordered a new speaker to test and it was perfect, so I must have just gotten two bad speakers or broken them somehow. Hoping it stays working this time. The last two speakers seemed to get worse over time as I used them so we’ll see if this one works.

Thanks for your help @profezzorn !!!

What speakers are you using?

This is the new speaker. I like this one a lot, the lower end isnt as loud as the others I was using, but it sounds great. And its pre wired with a thinner gauge wire so its easy to solder on.


As an add on question, does anyone know what a safe level would be to run this speaker at? The package says not to run it above 75% or level 3 to avoid damaging it, but I dont know what that translates to in Proffie OS levels. I’m at 1200 now to keep it safe, but I’d like it a little louder. I just dont want to ruin it.

1200 in your config means 1.2 watts.
If your speaker is 2 watt, 4 ohm, then 2,000 is the theoretical safe maximum config setting. Although of course, taking the 75 percent thing into account takes you down to 1,500. So at 1,200, you’re in the right ballpark.

It may be close, but that is not what it means.

As a rule of thumb, I think this works fairly well, however, it’s not actually what happens in the code.

They have a reputation for blowing if I recall.

Oh - sorry Prof. I’m sure I’ve read several times in the past that the number refers to milliwatts. I stand corrected.
In that case though for my own interest, I would like to understand what that number does actually refer to. ???

The number is a linear multiplier for values sent to the amplifier.
Since it’s linear, halving the number means that the amplitude of the waveform is cut in half.
The power you give to the speaker is cut by a factor of four, and the decibels would be -6.

If the volume is too high, clipping will occur, which will distort the sound.
However, what is “too high” depends highly on the sounds that are being played, because of the dynamic compression that proffieOS does.

The actual function looks sort of like this:

CalculatedVolume = \frac{| InputSample | + CalculatedVolume * 255}{256}

OutputSample = \frac{InputSample * Volume}{\sqrt{CalculatedVolume} + 100}

InputSample is the sum of all the currently playing sounds.
These two formulas are calculated for every output sample.

So, what have we learned:

  1. The milliwatts are proportional to the sqare of the volume
  2. The absolute milliwatt number depends on the sounds that are playing.

To complicate things further, there are several ways to measure watts that can be applied to speaker: average, rms, peak, etc.

The absolute maximum power that a proffieboard can put out would be with a square wave. If you adjust the volume to it’s maximum, it would output 5.1v continously, which in a 4 ohm load would be 6.5 watts. According to the formula above, a volume of 2996 or higher would make this happen. (I’m going to simplify that to 3000.)

So, for square waves, we get the following formula:
MaxWatts = 6.5 * 4^{log2(Volume / 3000)}

Here is a table of values based on this formula

volume max power
3000 6.5
2800 5.7
2500 4.5
2400 4.2
2300 3.8
2200 3.5
2050 3.0
2000 2.9
1800 2.3
1700 2.0
1500 1.6
1200 1.0
1000 0.7
100 0.007

Note that these watt numbers aren’t likely to actually happen, but the might match up reasonably ok with the maximum wattage the speakers can handle.

Note that these are NOT RMS values, which are quite different.


I thought about it some more, and I realized that the InputSample actually has a higher range than I was thinking, which means that maximum power (6.5w) can occur for lower volumes if enough sounds are being played at the same time. The values listed above are true for a single waveform. For multiple waveforms, things add up…