Recap: in the last part, the two prominent issues are (1) lights dimming with speaker sounding; and (2) hissing noise in the speaker. We concluded that for (1) we need bulk capacitance, and for (2) it seems to stem from switching noise.
First, mount the bulk capacitor C11. This is originally intended to resolve the light's dimming, but — it actually reduced the hiss, while the dim persisted! What is happening?

Let's check the theory. Here is the power supply and the audio filter circuit:

The DC-DC converter works at 320 kHz. The LDO's datasheet specifies 50 dB PSRR without a graph. The amplifier IC specifies a minimum of 60 dB. The filter is a first-order high-pass followed by a first-order low-pass, the passband from 16 Hz to 7.2 kHz, with an overall unity gain.
Does the hiss come from switching noise? The filter alone provides an attenuation of 20 log10 (320/7.2)) = 33 dB. LDO's PSRR at this high frequency will be lower, but still in the range of bels. This combined attenuation is likely sufficient to supress the switching noise coupled into the audible signal.
Furthermore, the hiss appear only when the light and the speaker are both plugged in, and not with the speaker alone. This renders the original hypothesis highly improbable.
Returning to the workbench: our test tone is a 375-Hz sine wave (which comes from the 24 kHz sample rate divided by a wavetable length of 64 samples). Somehow I noticed that, to the ear, the hiss is the same pitch class — i.e., it is a few whole octaves above 375 Hz. By simple elimination, the exact frequency is likely at 375 Hz × 24 = 6 kHz — which coincides with the PWM frequency of the light. This surely is no coincidence; when the PWM frequency is changed in the program, the hiss changes its pitch accordingly. Hence, we can conclude with confidence that the hiss originates from the LED's high-frequency power draw coupled into the LDO's output, which correctly predicts that the bulk capacitor will reduce this noise.
Now that the root cause has been identified, we know how to fix the problem. Either add a filter at LDO's input, or increase the PWM frequency beyond the filter's passband. For the dim (power dip), we need more bulk capacitance, of course!
... Or do we? Does the speaker take that much current? Let's inspect the current coming out of the battery. In the following tests, all signals are kept running while components are plugged/unplugged. The LEDs are driven with fixed duty cycles (intensity), and audio alternates between sounding, idle, and hard shutdown. The current draw in these three states are measured.
| Plugged in | I1 (A) | I2 (A) | I3 (A) |
| None | — | — | 0.02 |
| LED (1/8 duty) | — | — | 0.11 |
| LED (1/2 duty) | — | — | 0.28 |
| Speaker | 0.53 | 0.48 | 0.02 |
| Speaker + LED (1/8 duty) | 0.54 | 0.49 | 0.11 |
| Speaker + LED (1/2 duty) | 0.54 | 0.49 | 0.28 |
There certainly is a problem. Why is the current draw fixed at 0.48 A when the speaker is plugged in?
The oscilloscope brings us a step closer.

What is this 23.5-kHz triangle wave?? (To be continued...)
Ayu
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.