Categories
Uncategorized

Woot! cc128 -> rPi -> mqtt!

Got my 2nd raspberry pi today. Coinciding with the discovery that pin 10 on the arduino board I was going to use to submit data from the currentcost cc128 meter to mqtt seems to have a duff pin 10 (which makes it rather hard to use the ethernet shield), I decided to see if I could instead have the 3.3v RS232 from the cc128 drive the 3.3v RS232 on the raspberry pi (through 2 gates of a CD4049 running from the rPi 3.3V rail to protect the rPi if something went wrong). After finding an old floppy cable to rip apart and bodging together a LEGO case (based on the design by Biz but hacked because of the  over-sized connector I’ve used for the i/o port), it was a matter of “apt-get install mosquitto-clients python-serial”, copy the script over from the server currently doing the job (which has a long unreliable USB cable to the cc128), hack it to send the data to the server rather than localhost, and voila! works first time.

Disturbingly this actually costs less than an arduino + ethernet shield. The form factor is a little more awkward though (ports at both ends of the board, no screw holes), so getting it into a case along with other bits and pieces will be somewhat more awkward; ideally it would be good to have a tall case with enough room in the upper part to hold a pcb for additional components.

rPi + cc128

Categories
electronics

Possible rough design for a better S/PDIF-> analog converter

We have this very cheap optical S/PDIF to analog converter which hangs off the back of the TV and feeds the amplifier. We use the TV for audio source switching, since all the other widgets plug into the TV (mostly via HDMI, one with component video and analog audio). This has 2 issues:

* When the converter isn’t getting any input (eg the TV is off), it generates white noise.

* Without the TV on, you can’t listen to music.

I’m contemplating building a better multi-input auto-switching S/PDIF interface, but there seem to be a few hurdles.

Firstly, none of the required chips seem to be available in PDIP packages. More disturbingly, a significant number of useful ones are no longer available in SOIC, but only in even smaller packages like TSSOP.

However, there are a couple of likely SOIC chips out there which seem to be worth investigating. There’s the CS8416, which can select between up to 8 different S/PDIF interfaces (or 4 if you don’t want to interface it with a micro), and spit out an I²S stream (and generate a recovered master clock from the input stream to drive the DAC). There seem to be a few people out there with devices built around this, so it appears to be feasible to make it work as a hobbyist.

DAC selection is a little more complicated. At first sight it would make sense to go with a matching Crystal Semi DAC, but I don’t think any of the newer designs are currently manufactured in SOIC. Eg the CS4392 – the datasheet says you can order it in SOIC, but it seems to only actually be available in TSSOP. So I’m looking at something like the Wolfson WM8521, which has the advantage of producing line-level output straight from the chip (but the disadvantage of requiring either 9V or 12V analog supply). Another advantage of the WM8521 is that it seems to be able to handle a master clock ratio of 128xFs all the way from 8kHz to 192kHz sample rates; this is important because in “hardware mode” the CS8416 can only switch master clock ratios on a hardware reset. An alternative would be the newer WM8726 which can run from 3.3V, but would need an external analog stage to get the output to line level. Or the WM8501 which has a 1.7Vrms line level output, and can run from 5V rather than 9/12V – assuming I can source one.

For the optical inputs, I’d ideally like one which runs off 3.3V and has an output pin to indicate valid data (or at least light) on the input. I’m sure I found one of these once but now I can’t seem to track it down again!

For prototyping this I think I’ll get a couple of the sparkfun SOIC-to-PDIP adapter boards and then I should be able to breadboard it – although I’m a little worried about the CS8416 PLL circuit as it seems to be fussy about capacitance. Hopefully that will just cause the PLL to take a bit longer to lock onto the signal rather than making it fail completely.

For the final object I’ll have to get a board made – I don’t think I can produce a board suitable for SOIC chips by hand.

Of course there are a million other things I should do before this, so I don’t expect it to make progress at all soon. I have however scavenged a board with SOIC chips on it from a broken printer, so I can practice soldering on that before trying it on chips I care about.