$10 GPS

pciegpsOn ebay you can find cheap u-blox mini-pcie gps units for around $10 including shipping. They are for internal use in laptops and similar (most likely hooking up to the usb bus over Mini PCIe), but it turns out that the pads on the backside expose connectivity options such as uart and usb data.

I soldered on a pin header for ease of use, and also attached a cheap ceramic antenna using double sided tape.

The UART pins will spew over standard NMEA 183 data, so it should be easy to use with both computers and microcontrollers.

On the raspberry pi you can install the gpsd and gpsd-clients packages. Connect the tx gps pin to GPIO 15 RXD on the pi (you only really need one way uart, unless you want to change settings on the gps). Also connect ground and vcc, the gps requires 3.3v and probably need more umphf than the 50mA max 3.3 pin on the pi can deliver. I connected power via a 5v pin and a 3.3v regulator. I do not know if the gps is 5v tolerant, but probably not.

Launch the daemon ( gpsd -b /dev/ttyAMA0 ) and a client ( cgps ).. Remember to disable the tty running on /dev/ttyAMA0 before you use the UART pins for something like this.

Advertisements

Pioneer SR-Link control

I have a decent (but aging) surround receiver connected to my HTPC – a Pioneer VSX-2016av. Because of it’s age it really doesn’t have any good ways to control it from a PC (USB or even serial).

As part of my home automation setup it would be great to be able to control some of the features on the receiver. Volume up, volume down, power off, power on, etc.. Most of the time I use a wireless keyboard as an interface to my HTPC (running XBMC) – and the remote control for the receiver is only really used for volume control. Would love to be able to control these directly from the keyboard.

I’ve tried to control this receiver via IR, and actually set up a microcontroller to record the IR signal from the remote today. After decoding the modulated (38 khz) pulses I was able to play back the same signal and do stuff on the receiver from a microcontroller via IR. This could work.. but you actually have to point the IR diode more or less directly at the front of the receiver – reflections doesn’t work (maybe I could try a more powerful LED?). Was thinking about mounting the LED directly on the receiver, but it looks ugly 😦

Then I noticed the SR-link (in and out) ports on the back of the receiver. It’s a system Pioneer (and some other companies?) use for linking hifi/video equipment. You can use it to relay IR control and even transfer configuration options (in SR+). So I hooked up a microcontroller to the SR input port – you can use a mono 3.5″ jack – signal is on the middle pin. Ground can be taken directly from the chassis (shield on RCA-port for example).

Spent a while experimenting with this, by listening to the SR-output port while using the remote control. The signal is high (5v) as default, and pulled low on every IR pulse. Tried to replicate this using a microcontroller connected to SR Input on the receiver – wasted a lot of time beliving the signal should be 38 khz modulated – just like IR – but alas – no need for modulation – it won’t actually work if you modulate. Finally got it working – awesome! Now i can control my receiver from a microcontroller.

My goal is to get this directly connected to a Raspberry PI (which is going to be the HUB of my home automation system). If I can I really want to skip the microcontroller – and do it directly from the rasp-pi. I ported my microcontroller code to the PI, but it seems that I can’t get the timing accurate enough (running in userland).

Microsecond timing accuracy is a bitch in linux, I guess I could do this in kernel space – but that’s a lot of effort. Guessing I’ll probably have to go the microcontroller route. Also wish I had a decent scope, so that I could see how much jitter I’m dealing with here.