Tuesday, May 5, 2015

The Silence of the RAMs

It's sure been a while since I last posted. It really is amazing how much less time I spend on this hobby once the sun starts poking out from the clouds. But I have been making some strides with Robie.


So the last time I cracked open Robie's shell to reveal his fragile silicon innards I had two objectives in mind; 1. improve the mounting situation with the PCB's and 2. install the amp so that Robie could have some audio.

As you can see from the photo, I used some nylon standoffs to keep the PCB's from touching each other. Previously I had used some leftover metal standoffs from an old PC motherboard. But I didn't like the idea of using metal standoffs and I didn't have enough to make firm contact in enough places. So basically it was a really dicey mount job before. In the areas that I didn't have room for a hole in the PCB's I stacked up some double-sided tape. Now I have a lot more confidence that nothing is going to short out and set my house on fire.


Goal #2 of course was to get the audio amp wired up. The amp is a cheap LM386 board that I ordered off of eBay. My first attempt didn't go so well.

I stripped off an old headphone cable and connected the left channel to the LM386 inputs. When I booted up the RasPi the static noise was horrific and unbearable. So obviously something wasn't right. After a few searches on Google I came to the conclusion that I needed to add a capacitor between the power leads. I had a 500uf kicking around, so I gave that a go. On the next boot, the noise situation improved slightly but the noise was still unbearable.

After lots more head-scratching and Googling, I decided to switch power inputs. The Pi itself is running off of 5v, which according to the specs *should* be enough for the amp. But I have the motor controller running off of a slightly higher voltage (7v if I remember correctly). So I thought it was a worth a shot.

Wow. That did the trick. All of a sudden the audio was clear as day. Huzzah! Problem solved! Robie now has audio...

...or so I thought. It turns out that the Raspberry Pi's audio out uses the PCM channel. The same PCM channel that the WS2812 LED's use. So you can only use one or the other. Not both at the same time. 

I've tried numerous ways of getting the PCM channel to switch between audio and LED's without much luck. It seems that once you go in to audio mode you are stuck there until next boot. So I may have to simply do without audio on this project. Another option might be to use an Arduino for the LED functions. I'll mull it over :-/