thisoldgeek's posterous http://thisoldgeek.posterous.com Most recent posts at thisoldgeek's posterous posterous.com Wed, 06 Mar 2013 18:56:00 -0800 OpenWRT: Start a python script at boot time http://thisoldgeek.posterous.com/openwrt-start-a-python-script-at-boot-time http://thisoldgeek.posterous.com/openwrt-start-a-python-script-at-boot-time

The following script will start a python weather parsing script at boot time (that script not included here). Place the script in

/etc/init.d/weather

 

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=99
start() {
        sleep 5   # make sure boot process is done, no more console msgs
        echo "Weather VFD App Started"
        . /etc/profile
        echo $PATH
        python /opt/scripts/wunderground_parse.py &
}

START=99 will create an entry in rc.d named S99weather when the script is enabled.

chmod +x /etc/init.d/weather

/etc/init.d/weather enable  #places entry S99weather in /etc/rc.d/

 

The profile command is [dot] [SPACE]/etc/profile. This will invoke the environment variables which otherwise wouldn't be included at boot time. Those variables will include the

LD_LIBRARY_PATH

and other env variables.

This can also be started with /etc/init.d/weather start. You can stop the init script from starting up with 

/etc/init.d/weather disable

You could optionally add other commands to this startup script.

See the entry at the OpenWRT wiki.

 

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sun, 24 Feb 2013 19:38:00 -0800 Python: Call a function from outside a Class (in another Class) http://thisoldgeek.posterous.com/python-call-a-function-from-outside-a-class-i http://thisoldgeek.posterous.com/python-call-a-function-from-outside-a-class-i

Warning! I'm a noob to python and the following may not be the best way to solve the problem. It may even contain errors!

I wanted to create a python class that would contain most of the functions I needed to interface a Samsung VFD to a raspberry pi. The VFD connects to the pi using SPI. To make things a little cleaner, I wanted to initialize SPI from within my main class, called SPI_VFD in the code shown below. I also needed to call the functions spi.writebytes and spi.xfer2 (from the module spidev) from within my SPI_VFD class.

In initial testing, here's what worked for me:

import spidev

class thisspi:
    spi = spidev.SpiDev()

class SPI_VFD:
     def __init__(self, callspi):
         self.myspi = callspi
         self.setspi()
     def setspi(self):
         self.myspi.spi.open(0,0)
         self.myspi.spi.mode=3

#instantiate spi connection
s = thisspi()

# initialize SPI_VFD class, passing the spi instance
vfd = SPI_VFD(s)

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Fri, 22 Feb 2013 15:41:00 -0800 SPI for Samsung VFD on the raspberry Pi http://thisoldgeek.posterous.com/spi-for-samsung-vfd-on-the-raspberry-pi http://thisoldgeek.posterous.com/spi-for-samsung-vfd-on-the-raspberry-pi
TL;DR version - use spi.mode = 3

For an Internet radio project, I wanted to display "Now Playing" information on a beautiful Samsung VFD sourced from adafruit.com. Adafruit has provided a nice arduino library for this display which I used as a starter set to translate into/build a python SPI-VFD class for the raspberry Pi.

I'm a complete noob at python but I tackled the translation of C code to python without too much trouble. I got things going in fairly short order after some google searches, was able to print "Hello, World!" However, the VFD was behaving a bit oddly on a few commands, the cursor. Well, you have to have a cursor to get to the second line, right? 

Initially, I found a very useful thread on the raspberry Pi forum from poster bgreat on setting up a Nokia LCD to work with the Pi. That didn't fit my use case because it used more connections for SPI than the Samsung's three wires. It did give me a model of how to code for SPI on the Pi in general, however. The posting thread is also good for getting background on how to install/activate hardware SPI on the Pi.

But I hit a wall for a couple of weeks on fixing the cursor. I did a lot of searches based on guesses as to what the problem was. TTL voltage? Tried a 74HCT244 TTL up converter, same cursor result.  Under-current flakiness? Used a 2A power supply and separate, powered hub. Same. Some kind of SPI under-run, tried sending extra dummy bytes, still flakey. Think, think, think!

In my googling, I tripped over a posting reference to 3-WIRE mode in SPI. Hmn... The Samsung VFD uses only three SPI connections. Look at the data sheet, there's just a quick, passing reference to "three wire serial interface" and nothing else said.  OK, let's experiment!

I saw a test program on mitchtech.net that included source  code to set SPI mode with a variety of parameters. Those parameters triggered a memory of an answer on stackoverflow.com about some Py object bindings. OK. So first, not knowing what I'm doing, I stupidly try the command: 

spi.mode = 1

thinkng the mode is either on/off. The python interpreter accepts that, but I still get the same flakey results. Go back and look at the SPI test program again. There's a case statement for mode  that clearly says "3  #3-wire mode". Doh! Missed that.

Try:
spi.mode = 3

Success!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sun, 10 Feb 2013 14:34:00 -0800 Raspberry Pi SPI to Samsung VFD http://thisoldgeek.posterous.com/raspberry-pi-spi-to-samsung-vfd http://thisoldgeek.posterous.com/raspberry-pi-spi-to-samsung-vfd

P405

Did a crude translation of the adafruit SPI_VFD arduino library to python on the raspberry Pi, with the target being the Samsung 20T202DA2JA vacuum fluorescent display.

I'll do a longer write-up when I have time. You need to install spidev as a prerequisite.

The key to getting output is sending a series of integers in a call as below:

def text(string):
     L = [VFD_DATA]
     for char in string:
          L.append(ord(char))
     spi.writebytes( list(L) )

text("Hello, World!")

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Tue, 01 Jan 2013 17:33:00 -0800 Parrot DF3120 to Raspberry Pi via VNC http://thisoldgeek.posterous.com/parrot-df3120-to-raspberry-pi-via-vnc http://thisoldgeek.posterous.com/parrot-df3120-to-raspberry-pi-via-vnc

Parrot_df3120_to_pi_vnc

The Parrot DF3120 is a small, cheap digital picture frame that at one point could be had for around $25 USD. About the time Hack-A-Day featured it for it's ability to run a small Linux, I picked up a couple of them. Nowadays (January 2013), they're hard to get.

The two Parrot's lay in inventory, waiting for a project. Now, I'm exploring a use for them. They might have some uses with raspberry pi as an auxiliary display.

I mostly used Nathan Chantrell's instructions for setting up the DF3120 for Linux and getting started with VNC.However, I couldn't get the VNC server started on the raspberry pi with Nathan's command, kept getting an error message:

vncserver: geometry 320×240 is invalid

Over on the cjb.im blog, there was a slight addition to the command, which worked for me:

vncserver -geometry 320x240 -depth 8 :1

The picture above is the result of the first connect to VNC on the Parrot.

Unfortunately, I couldn't get htop to work as Nathan indicated, kept getting invalid display error for xterm.

Below is a picture of console access (Serial?) from one of the original sources of information for hacking this device:

Df3120-console

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Tue, 25 Dec 2012 09:15:00 -0800 Update: Makezine MonoBox Speaker http://thisoldgeek.posterous.com/update-makezine-monobox-speaker http://thisoldgeek.posterous.com/update-makezine-monobox-speaker

P399

In an earlier post, I showed the LM386 amp I made from the Makezine tutorial. This post covers the actual speaker build.

I used a small wooden "cigar" type box with a loose lid that held some kind of Tommy Bahama product. I followed the Makezine MonoBox instructions and used a dremel to cut out a circular hole for the speaker, after first tracing the speaker onto some paper. The result was pretty rough and ugly, with some wavy spots and some flat spots. Didn't like that at all.

I was casting about for some kind of covering to hide and smooth out the edge of the hole. First tried glueing split heat shrink but that was a disaster - it didn't take curves without kinking up and didn't glue well. What I finally hit on was using sugru, an old go-to tool for me. I shaped the sugru around the edges and gave the top a kind of a peak with a slightly inward tilt. While still not perfect, this gave the edges a more finished like, as if a gasket had been applied.

I liked the original build idea of using brass finishing washers. It turned out that when I drilled the holes for 4/40 screws to hold the speaker in, the exterior wood splintered horizontally. I needed something to cover that and the washers worked prefectly. I also found some size 4 brass acorn nuts that worked nicely on top of the washers and made it more interesting.

I drilled a hole for my 2.1mm ID barrel power connector and 1/8 inch audio input on the side of the box. I don't really know why I preferred the right side of the box instead of the back. Guess it's because I'm right-handed and hold the box steady with my left while I insert cables.

When I tested out cable inserts, I realized that I hadn't accounted for the thickness of the box walls, about 1/4 inch. This meant I had to attach a longer 2.1mm barrel connector to my battery holder to make good contact. It also meant I didn't have enough space to attach the nut for my 1/8 in audio connector. So, both the power connector and the audio connector were hot glued in. I held the pieces in place with their connectors inserted to get proper alignment for the holes.

With the speaker installed, the top fit loosely on the base and could easily tilt from one side to the other, wouldn't stay level. To seal the lid in level, I used hot glue, first applying it to the problem side and letting it set. Then I went after the opposite problem side (the tilting side) and did the same, letting it set. Finally, I glude the other two sides at the same time, taking care to lay down an even bead of glue and covering any gaps between the lid and the base.

I have yet to figure out how to put a handle on this box. I bought some nice satin nickel handles for $4 US but their screws were far too long to attach to this small box. I didn't have any shorter screws with the same diameter. I tried glueing the handle in place, but it just wouldn't take.

Even without the handle, the box looks good. And, it ROCKS!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Fri, 21 Dec 2012 20:13:00 -0800 HTC EVO 4G Digitizer & Screen Replacement http://thisoldgeek.posterous.com/htc-evo-4g-digitizer-screen-replacement http://thisoldgeek.posterous.com/htc-evo-4g-digitizer-screen-replacement

Before_and_after
I find a lot of discarded technology on my daily walks with my dog. So far, I've found one camera, a Samsung BlackJack 2 phone and most recently, an HTC EVO 4G cell phone.

I found the EVO on the street next to a restaurant with the heavily cracked digitizer as shown in the before ("From this...") picture above. I replaced the screen at a cost of about $8.00 with install kit, shipped from ebay using the video show here as a guide. Unfortunately, I wasn't careful enough pulling the old digitizer away from the bezel. Too much pressure from the broken screen caused cracks in the LCD under the screen.

So, ordered a new LCD at about $22.00 shipped. I repeated the same procedure and resused the digitizer screen, being more careful to go very slowly with the nylon removal tool around the edges. I also learned from the first install attempt not to use the removal tool around the very bottom of the screen. That's where the fine copper cable slides through a small hole to attach to the phone mainboard. You can bend and crack this cable easily with too much force.

If you are doing this repair, make sure that you get the correct size of cable for the LCD. There are two sizes: narrow and wide. The narrow ones are relatively rare. You can check which one you need by taking the phone apart and looking at the back of the LCD. If the model shown is 2WCA, you need the wide flex version.

Depending on your experience level, this repair should take about an hour. I worked very slowly and carefully, having never done this before, and took about an hour and 45 minutes to make sure everything was correct.

One thing to be careful of is removing the flex cables from the mainboard. The referenced video made the removal of the cables seem very straightforward. I found this was more difficult than the video indicated. Also, the clamps holding the tiny cables in I thought were quite fragile. I made efforts to be careful and I broke the camera cable clamp off completely and the LCD cable clamp slightly in one corner. However, both of these still work.

When I powered up the device and tested the camera, I got an odd sepia/brown tone to photos, even on the LCD.Thinking this was some kind of photo effects filter, I started poking around in settings. Didn't see any obvious filters, but I did see a setting to "Reset to defaults". This fixed the problem!

For $30 in repair costs and a little time, I have a fairly nice extra device with WiFi (but no cell coverage, don't need it), Android 2.3, Pandora, Google Maps, Google Mail, Music player and quite a few goodies. It's kind of like getting an iTouch-class device for cheap.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sat, 15 Dec 2012 18:01:00 -0800 Nokia 5110 LCD on raspberry Pi http://thisoldgeek.posterous.com/nokia-5110-lcd-on-raspberry-pi http://thisoldgeek.posterous.com/nokia-5110-lcd-on-raspberry-pi

I'm just taking baby steps here, trying to duplicate the work of others. I compiled a C program from binerry.de that talks to the 5110 from the GPIO's on the Pi.

These Nokia graphical screens are cheap, about $10 at adafruit and eBay, and they're used enough that there's starter sets of C and python out there.

Eventual goal is to have a display powered by python. Idea is to output current song from mpd, along with other interface info, for a wifi radio.

Photo

Sent from my iPhone

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sat, 08 Dec 2012 12:14:00 -0800 Controlling pianobar Pandora client with keyboard shortcuts http://thisoldgeek.posterous.com/controlling-pianobar-pandora-client-with-keyb http://thisoldgeek.posterous.com/controlling-pianobar-pandora-client-with-keyb

I've been wanting to get pianobar, a CLI for Pandora, installed on a raspberry pi as a stand-alone player. This post talks about "baby steps" on the way there, a work-in-progress.

First, since I'm running Ubuntu 10.04, I had to install from source. Make sure you have the following dependencies:

sudo apt-get install install build-essential

sudo apt-get install libjson0-dev

Download from the pianobar github and untar/unzip.

cd to the pianobar download folder

Do the following:
make

sudo make install


Test it out just by running:
pianobar

This should bring up your stations and start playing, if you have your login configured properly.

You can find a list of commands by pressing the "?" key. Obviously, you can enter these commands in the same terminal session as pianobar.

But, as a step toward getting a raspberry pi interface going, I wanted to be able to send the commands from some other terminal session. That would sort of emulate sending from a python program and/or serial connection.

To do this, you need to create a FIFO file.  Here's how:

cd ~/.config/pianobar

mkfifo ctl

Now, when you issue the commands (from another terminal session):

echo "i" > ~/.config/pianobar/ctl       # for example, song title

You will get back info on the playing song, although this will be in the original terminal session.

More on this at the Copper Thoughts blog, and a better way to do actual keyboard shortcuts.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Fri, 07 Dec 2012 16:07:00 -0800 Makezine MonoBox Speaker http://thisoldgeek.posterous.com/makezine-monobox-speaker http://thisoldgeek.posterous.com/makezine-monobox-speaker

P385

Tried to make an LM386-based amplifier in the past from a couple of designs and the results were unsatisfactory.

This is a nice build with excellent tutorial-style documentation. The amp worked well just off a 9V battery and sounded good.

Recommended!

See the article at Makezine.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Thu, 06 Dec 2012 13:38:25 -0800 Fixing stuttering/high CPU mpd on Pogoplug http://thisoldgeek.posterous.com/fixing-stutteringhigh-cpu-mpd-on-pogoplug http://thisoldgeek.posterous.com/fixing-stutteringhigh-cpu-mpd-on-pogoplug Recently got a special on pink pogoplugs, two at $12.95 each. My friend John also bought, and he clued me to the fact that these were labelled B01 on the outside, but were really E02 models as shown on the device itself.

I quickly had Debian Squeeze on the box using Jeff Doozan's script, then upgraded to Wheezy. Since I like to set up boxes as music players, I added mpd and mpc to the install.

I was listening to music in no time. However, there was a problem. My favorite classical music streaming station is KVOD from Denver, cpr.org. Of the five classical streams I had in my playlist, they were the only one to stutter every few seconds - the other stations played fine.

After hours of trying different things to fix the problem, I finally hit on a combination of factors that somebody had an answer to. I noticed that ONLY the problem stream showed high CPU in top, and also
had the stutter.

If you look in mpd.wikia.com/wiki/Tuning, you'll see references to samplerate. One suggestion was to change to:
samplerate_converter "internal"
I tried that and it immediately fixed the problem, at the cost of reduced sound quality.

There are other suggestions on the Tuning page, so check there for more detail.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sun, 02 Dec 2012 16:17:00 -0800 ATTINY45 Angel Bell http://thisoldgeek.posterous.com/attiny45-angel-bell http://thisoldgeek.posterous.com/attiny45-angel-bell

P40

This is a mod of Jeremy Blythe's raspberry Pi solenoid alarm bell. I turned it into a kind of Christmas decoration/art thingy, prototyping on an arduino and then moved it to an Attiny45 for implementation. The sign is just an acrylic photo holder with a printed message. US visitors will recognize the reference to the inescapable seasonal movie, "It's a Wonderful Life".

The sketch is trivial. It's just the arduino Blink example with a HIGH for 80ms, then LOW. The low has a random delay of 30 seconds to 2 minutes.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Tue, 20 Nov 2012 15:20:00 -0800 Direct rsync from DeltaCopy on Windows 7 to Ubuntu http://thisoldgeek.posterous.com/direct-rsync-from-deltacopy-on-windows-7-to-u http://thisoldgeek.posterous.com/direct-rsync-from-deltacopy-on-windows-7-to-u

I'd been meaning to set up rsync from my music server, a Windows 7 computer, to my ubuntu backup server for quite some time. I'm more familiar (though not very) with rsync in ubuntu than the DeltaCopy Server for Windows.

So, today I finally got rsync.exe going under DeltaCopy.

Here's the process in a nutshell.

First Install DeltaCopy
        * Set up the service
        * Set up the client with no authentication


Go to a terminal/Command Line in Windows

Run rsync.exe directly from DeltaCopy installation
        cd d:\DeltaCopy   (where rsync.exe is installed)
        use the following form of the command
        rsync.exe -n -arvz /cygdrive/d/music/iTunes/Purchased/ username@192.168.0.nnn:/music/iTunes/Purchased     [Note: -n = dry run, remove to run it for real!]

where /cygdrive/d/music/iTunes/Purchased/                       =====>  source
      username@192.168.0.nnn:/music/iTunes/Purchased     =====>  target

The trailing slash after /cygdrive/d/music/iTunes/Purchased/ <==  is VERY important when you already have a directory structure set up on the target. It means DON'T create a new folder/directory.

Conversely, it you leave the trailing slash OFF, a new folder/directory WILL be created.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Thu, 08 Nov 2012 11:06:03 -0800 PiTX Raspberry Pi Power Controller http://thisoldgeek.posterous.com/pitx-raspberry-pi-power-controller http://thisoldgeek.posterous.com/pitx-raspberry-pi-power-controller

P35

Jason on his blog (http://www.boeeerb.co.uk/pitx-an-atx-style-solution-for-the-pi/) described an innovative approach to controlling the power on a raspberry Pi.

I've already corrupted the file system on my Pi by just pulling power, so this was a great idea!

Here's my first prototype based on Jason's work. This version uses a DC 2.1 barrel connector to a 5V 1A wall wart, a DPDT 5V NTE R40 relay, some tactile buttons from adafruit.com all soldered together on an adafruit perma-proto board.

The large tactile buttons are color-coded green for go/start, red for shutdown/stop. The shutdown button is hooked into GPIO 18 on the Pi, where a running python script checks for signal. On high, the script executes a shutdown.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Sun, 14 Oct 2012 20:20:00 -0700 Getting CMedia USB Sound to Work with MPD on the Raspberry Pi http://thisoldgeek.posterous.com/getting-cmedia-usb-sound-to-work-with-mpd-on http://thisoldgeek.posterous.com/getting-cmedia-usb-sound-to-work-with-mpd-on

This assumes that you have a working installation of mpd and mpc and you can get sound out of the analog port. Using 2012-09-18_wheezy.img, the analog sound still has loud pops when you change streaming stations in mpd, plus noticeable hiss in the background of quiet passages.

To get the CMedia USB Sound dongle (looks like this one available at Newegg) working, you need to install alsamixer (if not already installed) via the command:

sudo apt-get install alsa-utils

Once that is installed, you need to modify the appropriate section of /etc/modprobe.d/alsa-base.conf so it looks like this:

# Keep snd-usb-audio from beeing loaded as first soundcard
#options snd-usb-audio index=-2
options snd-usb-audio index=0

Setting the index to 0 allows the USB Sound dongle to be loaded first. Index=-2 prevents that.

Then, in /etc/mpd.conf, you want to change the sound section like this:

# An example of an ALSA output:
#
audio_output {
    type           "alsa"
    name         "My ALSA Device"
    device        "hw:0,0"    # optional
    format         "44100:16:2"    # optional
#  mixer_device    "default"    # optional
    mixer_control    "Speaker"    # added 2012-10-04 for USB Sound dongle
    mixer_index    "0"        # optional
}

"Speaker" is how alsa-mixer refers to the device (alsamixer partial screen show below):

 Card: C-Media USB Audio Device                       F1:  Help               │
 Chip: USB Mixer                                      F2:  System information │
 View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  │
 Item: Speaker [dB gain: -26.69, -26.69]              Esc: Exit              

If you have problems, examine the output of mpd from /var/log/mpd/mpd.log by tail. When I was troubleshooting this, the log was helpful. Here are some sample messages which pointed me in the right direction:

Oct 14 19:46 : avahi: Service 'Music Player' successfully established.
Oct 14 19:46 : mixer: Failed to read mixer for 'My ALSA Device': no such mixer control: PCM

I tried using PCM because that is the associated with the first installed sound card. Making the changes shown for alsa-base.conf to allow the USB Sound card to start first changes the alsamixer output to Item: Speaker from Item:PCM

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Thu, 04 Oct 2012 14:16:00 -0700 Open WiFi settings on raspberry Pi http://thisoldgeek.posterous.com/open-wifi-settings-on-raspberry-pi http://thisoldgeek.posterous.com/open-wifi-settings-on-raspberry-pi

If you are trying to connect to an open wifi router with your Pi, change the following settings in

/etc/network/interfaces. These settings worked with Raspbian 2012-09-18-wheezy-raspian.

 

# my wifi device
 auto wlan0
 iface wlan0 inet dhcp
        wireless-essid [ESSID]   # your router SSID
        wireless-mode [MODE]  # usually mode is "managed"

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Wed, 03 Oct 2012 20:20:42 -0700 LCD and Pandora on raspberry pi http://thisoldgeek.posterous.com/lcd-and-pandora-on-raspberry-pi http://thisoldgeek.posterous.com/lcd-and-pandora-on-raspberry-pi

P32

Went to town on the raspberry pi this week while I stayed with my friend John in Eureka.

The picture shows my new Pi in a laser cut case I made at TechShop SF last week. On top is a TextStar tiny LCD showing one of 4 screens, this one the wireless USB adapter's IP address. See the post at jeremyblythe.blogspot.co.uk, "Raspberry Pi with TextStar Serial LCD Display" on how to set this up with python.

I used adafruit's nice Occidentalis v0.2 release for the main software, based on Raspbian Wheezy Debian. This has a lot of good packages already built in, including ssh. I just used my Mac Terminal program to set the Pi up over Ethernet initially.

To get pandora going, I used pianobar. The install is simple:
sudo apt-get install pianobar
Set up the config file for automatic login and you're good to go.

To get streaming radio on the Pi, I installed mpd, the Music Player Daemon. This is an easy install also:
sudo apt-get install mpd mpc
See the article at www.t3node.com/blog/streaming-audio-with-mpd-and-icecast2-on-raspberry-pi for setup.

Getting the Pi to work with the popular mpd iPhone client, MPoD, was a bit of a challenge. MPoD could see the Pi via avahi/bonjour, but not connect to it. John found out you have to have bind_to_address for "local host" commented out for MPoD to be able to connect to it.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Mon, 03 Sep 2012 06:43:00 -0700 Make a micro SIM adapter from a full-sized SIM http://thisoldgeek.posterous.com/make-a-micro-sim-adapter-from-a-full-sized-si http://thisoldgeek.posterous.com/make-a-micro-sim-adapter-from-a-full-sized-si The rumor mill is pretty confident there will be a new iPhone announced on September 12, 2012. I knew I was eligible for an upgrade and wanted to get the new iPhone when it came out. What to do with the old iPhone? I checked gazelle.com for their prices on an unlocked iPhone 4, about $172 for good condition at the time I checked. But eBay had them going well north of $300.

So, I priced my iPhone 4, which I thought was in very good condition, at $350 Buy It Now / $250 auction reserve. BAM! Sold in 35 minutes.

Now, what do I do for a phone until I get the new iPhone? Hmn... I have an old Samsung BlackJack II locked to the AT&T network, that should work. Except for the size of the SIM - the iPhone 4 uses a micro SIM, and the BlackJack used a full-sized SIM. I had a dead, previously used AT&T standard-sized SIM from yet another phone. I decided to cut the full-sized SIM into a kind of tray adapter for the micro SIM. There are actual commercial products like this available on Amazon, but I didn't want to wait for shipping.

First, line up the contacts of the micro SIM approximately where the same contacts are on the full-sized one. Draw an outline for cutting, I used a fine point Sharpie. This doesn't have to be very precise, just an opening big enough to hold the micro SIM. Then, using a box cutter or Xacto knife, first carefully score the outline all the way around. Then slowly and carefully cut deeper into the outline. Work slowly, you don't want to break the plastic. Add Scotch tape to hold the micro SIM in place. The whole process should take about 15 minutes.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Mon, 13 Aug 2012 16:03:00 -0700 SiliconDust HD HomeRun Prime CableCard Set-Up http://thisoldgeek.posterous.com/153292960 http://thisoldgeek.posterous.com/153292960

My current DVR solution, BeyondTV, was ageing and appears not to be the long-term focus of Snapstream, so I went shopping for a new solution that had some legs. I have the Extended Basic tier with Comcast and due to encryption of the "channels" above 30, I was only able to record about half of the content I was paying for. I could get HD local channels nicely with my twin Hauppauge 2250's, but couldn't record the likes of History Chnnel, Discovery and others.

Turns out my local Fry's had a special on the SiliconDust HD HomeRun Prime networked-attached cablecard tuner for $30 less than the current Amazon price. Newegg and Amazon reviews were favourable. The downside was dealing with Comcast to get the required cablecard and get the card activated once installed. Forums were full of postings of long waits, both in-store to pick up the card and hours spent on the phone to Comcast Tech Support to get the card activated. 

Decided to bite the bullet, figuring the possible short-term pain would be worth the long-term gain. Turns out, things went quite smoothly. Maybe not butter, but at least cake.

Visited the local Comcast store at 9:21 on a Monday morning. The walk-around greeter told me it would be about 10 minutes wait. Yeah, sure!  I had to recant my cynicism when I walked out of the store with Multistream cablecard in hand at 9:31.

The rep at the Comcast store-front told me to insert the card SLOWLY and call the number at the bottom of the invoice ASAP after install. Do both of those things, and I'm waiting on the line, when I notice the invoice says you can activate over the Internet at comcast.com/activate. OK, I can try that whiIle I'm waiting. The three-step activation has me done in about five minutes and says wait 45 minutes for activation to complete, so I ditch the phone call.

The HomeRun Prime works with Wndows Media Center under Windows 7. While I'm waiting for the activation to complete, I install the HomeRun Prime software on one of my three Windows boxes. As one of the last steps in the install, I did a channel scan expecting no channels to appear. But, no - channels start appearing in the HomeRun config tool! So, in my case it looks like activation took less than 30 minutes. Cool.The odd thing was, the web page that the HomeRun config utility takes you to (a 192.168.0.* address on your network under DHCP) indicated no channels were downloaded to the three tuners even after activation was complete and I could view channels in WMC. I refreshed a couple of times and still got the same report back, no channels.

Get to work on configuring WMC. Go to Tasks/Setup/TV and begin. PlayReady ( for DRM content) and DCA (Digital Cable Assistant) download if they are not already present in WMC. At one point, WMC tells me that my computer is unable to receive digital channels, but I keep going. Don't know what WMC was trying to tell me, but after waiting for the Program Guide to download, my spot checks showed I could view even formerly unavailable content just fine. 

The only slightly rough spots were when I set up the HomeRun on a WMC machine previously configured for the Hauppauge 2250. First, the DCA wanted a Product Activation Code and they weren't talking about the Windows OS. They meant the HomeRun product code. A little googling turned up a valid product code in the SiliconDust forums:
263DJ-2Y9YT-6X9G6-W28DB-697TF
This is for the forum entry: http://www.silicondust.com/forum/viewtopic.php?t=10080

The other problem I had was due to my previous tuner installs with the twin Hauppauge HVR-2250's. Although WMC would recognize all of the installed tuners including the HomeRun, the Program Guide information looked like it only used the 2250's which were not able to receive the encrypted/non-clear QAM channels. To fix this, I went back into the TV tuner setup and picked the manual option, then set up ONLY the HomeRun tuner.

In summary, for me this was a fairly straightforward set-up; perhaps I just got lucky this time.

Pro's:

  • can watch TV through WMC on any computer in the house with HomeRun software installed
  • fairly straightforward set-up for HomeRun
  • self-activation with Comcast actually worked and was painless (quelle surprise!)

Con's:

  • the HomeRun seems to only show SD content; the Hauppauge HVR-2250 also shows HD local channel offerings
  • a little laggy in WMC when you first start up, say a few seconds of unsynchronised lips/audio

 

UPDATE:

I was confused on the HD offerings due to different presentation styles. On the HVR-2250, local HD channels are interleaved with SD channels like so: 2 (SD), 2.1 (HD) and so on. The CableCard presents the local HD channels and other content in the 700's-800's band of channels.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy
Mon, 09 Jul 2012 14:02:00 -0700 Getting ATTINY45 to work at 8MHz with Arduino-1.0.1 and USBtinyISP http://thisoldgeek.posterous.com/getting-attiny45-to-work-at-8mhz-with-arduino http://thisoldgeek.posterous.com/getting-attiny45-to-work-at-8mhz-with-arduino

Working on a project to get an IR remote to work with an ATTINY45. The stock '45 comes with fuses set for 1Mhz.

I had a problem with the remote codes not being recognized and needed a way to see exactly what was going on. ATTINY doesn't natively support SoftwareSerial, but you can include the library for that. Problem is, the lib wants to run at 8Mhz or above. There is a way to easily change the fuses so the '45 runs at 8MHz,  using the 1.0.1 IDE and an add-on mentioned by the Hi Low Tech Group of MIT (here).

Make SURE you get a version of the ATTINY download that contains the folders variants and boards.txt and place them in the folders mentioned in the Hi Low blog above. Start arduino-1.0.1.  On my Ubuntu system, I need to run the USBtinyISP under sudo, so I navigate to the folder the arduino program lives in and type in sudo arduino-1.0.1 from the command line to start the IDE. Plug in  the USBtinyISP and set it in Tools\Programmer. Follow the instructions on the blog to "Burn Bootloader" after choosing Tools\Board\ATTINY45 (internal 8MHz clock). This normally won't show the results of the fuse burning command. To verify the fuses are being burned, before running "Burn Bootloader",  under File\Preferences, check the box for "Show verbose output during    upload".

To get the fuses and program burned onto the ATTINY45 chip, I mount the chip on a small breadboard and attach the pins to the USBtinyISP like so (from Maarten Damen's blog):

  • ATtiny Pin 2 to USBTinyISP SCK
  • ATtiny Pin 1 to USBTinyISP MISO
  • ATtiny Pin 0 to USBTinyISP MOSI
  • ATtiny RST pin to USBTinyISP RESET

and +5v to Vcc. GND to GND.

Here are pinouts for the ATTINY45 and the USBtinyISP. The pinout shown is for the ATTINY25, which is the same as the '45/'85.

 

Attiny25-pinout

Adafruit_usbtinyisp_pinout_6and10pinstd

To show where the *.hex program is located after a compile, check the box in File\Preferences\"Show verbose output during compile". On my Ubuntu system, this is located in /tmp/buildnnn.tmp/program_name.cpp.hex (where nnn = some alpha-numeric identifier). I compile from the command line like so:

user@mybox:/tmp/build3204698977405188542.tmp$ sudo avrdude -c usbtiny -p t45 -U flash:w:program-name.cpp.hex

If everything went well, you should see something like this:

sudo avrdude -c usbtiny -p t45 -U flash:w:attiny45_serial_example.cpp.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9206
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "attiny45_serial_example.cpp.hex"
avrdude: input file attiny45_serial_example.cpp.hex auto detected as Intel Hex
avrdude: writing flash (3894 bytes):

Writing | ################################################## | 100% 11.50s

avrdude: 3894 bytes of flash written
avrdude: verifying flash memory against attiny45_serial_example.cpp.hex:
avrdude: load data flash data from input file attiny45_serial_example.cpp.hex:
avrdude: input file attiny45_serial_example.cpp.hex auto detected as Intel Hex
avrdude: input file attiny45_serial_example.cpp.hex contains 3894 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 7.21s

avrdude: verifying ...
avrdude: 3894 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/901724/bob_profile.JPG http://posterous.com/users/1kLnYQjaRXeV bob murphy thisoldgeek bob murphy