I mentioned in a previous post that I would be taking a break from this project until sometime this summer. Well it's summer now, I'm in Canada, and I have the necessary time to resume development. I have started programming just a couple weeks ago, and now have something worth showing. It's a basic demo of audio wirelessly streaming from my phone over bluetooth to the carbt, and then over FM radio, working almost automatically.
Starting fresh is the reason why it took so long to reach this point again. With all the changes made to Raspbian, Pulseaudio, and Bluez, I could not transfer much work from previous prototypes. Fortunately, the changes they made to Raspbian Jessie made the process just a bit less painful. I loosely followed this guide to get bluetooth audio working, and added my own fixes and performance adjustments.
Of course, none of this goes without any problems. Audio playback quality in the car was terrible, and only coming from a single side. At first I thought Pulseaudio or alsa was stuck in some kind of mono mode, but they did not report any problems and no experimental changes helped. Playback on a portable radio did sound better, but was still only coming out of one speaker. This sort of narrowed the problem down to the FM transmitter. Fm transmitter settings are easier to change, so I started there.
Older FM playback tests sounded fine besides a high pitched whine in the background, which is the result of an incorrect crystal frequency setting. The QN8027 accepts both 12MHZ and 24MHZ crystals, but defaults to 24. I have used the 24 for prototyping, which worked perfectly, but ended up using the 12 because of form-factor availability. I did make sure to test the 12 before to make sure it works, but nothing more. Correcting the crystal setting fixed the noise problem, but apparently created the low quality, mono-only problem.
I decided to research how FM radio stereo transmission works to see if that would get me any leads. Pilot frequencies and MPX gave me something relevant to work off of, so I went back to the QN8027 datasheet to look for anything related. The QN8027 has a setting for adjusting the pilot frequency deviation, called GAIN_TXPLT. Setting that to its minimum fixed the mono problem, and radios will now receive stereo audio from it. However, the audio quality is still bad, so I continued looking for more frequency related settings. The only other relevant setting controls overall transmission frequency deviation. No harm in messing with that, and I'm running out of leads anyways. The first change made everything worse, but after more adjusting, the low quality problem was fixed. Now why did a supported crystal value change make this whole process necessary? Hell if I know. Maybe the crystal I used was way out of spec, or the sad excuse for antenna circuitry made everything terrible to begin with.
The last problem was relatively minor, intermittent, and had to do with USB. All I have been able to determine is that something is wrong with the integrated USB hub, and only the last port will work reliably. It isn't a game breaking problem since I only need one working port, but it is kind of limiting. I wish the Raspberry Pi Zero had at least another USB port or something.
Hardware problems aside, it is time to continue with software configuration and programming. I'm starting with basic TFT GUI stuff today, and then continuing with automation and everything else. The thought of having to get the read-only fs working at the end of all this is frightening. Anyways, keep an eye on this project's GitHub repo, as I will be updating it as I progress.