Thursday, June 26, 2008

2008-06 PC Infra-red Remote

After last months project burn-out I wanted a simple P.T.O.M. this time. I've started using the TV card on the PC and watching vcds etc on my PC. The TV card(s) both came with remotes and in these cold winter nights lying on the sofa these could be useful.
So how hard can it be? and the IR can control all sorts eh? oxine looked great for example so that was it. Get IR control going in the POTM.

LIRC seems to be the main project here. It looks like it supports both of the TV cards I have, One SAA7134 based and one BT878 based.

It goes: A Real Quick Run-down for fedora 9.
  • Set up the remote: Install the IR drivers and lirc. Use irrecord to create a config file for your remote control and copy it to /etc/lircd.conf.
  • Get lircd running. Configure /etc/sysconfig/lirc to use the right driver for you and then lircd to start on system boot like any daemon. (use the /dev/input/by-path device if you use devinput as the device driver. Don't use /dev/input/eventX as X can change on reboot)
  • edit (and create if necessary) ~/.lircrc. Check the application you want to control for details on lirc commands and match the commands to the keys in ~/.lircrc
  • use irexec if needed. It will trigger things if the app you wan't to control isn't looking at lircd for events itself. For example; tvtime needs irexec but gnome-radio does not. I use gnomes session management to run this.

OK What happened in detail:
First it had to track down the parts; The remote controls and the IR sensors. Found the remotes. Now check that they remotes both work aftre years in storage.
I recall a note in Silcon Chips serviceman pages saying you can check IR by looking for the IR led in a CCD device.

IE by looking at them with a web cam or digital camera and that works: Off and On.
Both remotes are good and so are their batteries.
Kinda ghostly seeing one thing in the view finder and another with your eyes.

Now find the IR sensors. Both found (yeah for my pack-rat self) and the different plugs mean it's clear that which sensor is for which card.

OK plug in the sensor and let's try to get IR control going on the existing card in my desktop PC.

Nothing. OK, check the module options for the card; I was never that sure they were right even thought the seemed to work OK with BT878 card. Check the PCI ID and find it could be one of three so try them all:

options bttv card=30 #Seems OK. No IR. The value I have been using.
options bttv card=39 #Video OK. No sound, no IR, snd_BT87x won't help with sound.
options bttv card=52 #Video OK. No sound, no IR, snd_BT87x won't help with sound.

OK that's not getting me anywhere, lets try the SAA7134 card from gnabgib. I think that was more upmarket and I've bumped into reassuring references to them while checking the LIRC docs.

Fire up gnabgib which is the machine that the card had last been used in (mothballed right now) and check the existing config (from memory it worked OK, never tried the IR though, only really used the FM card for the Concert and National stations):

relevant Modules loaded on gnabgib:
saa7134 110741 0
video_buf 23365 1 saa7134
v4l2_common 5825 1 saa7134
v4l1_compat 13125 1 saa7134
i2c_core 21825 2 tuner,saa7134
ir_common 7493 1 saa7134
videodev 9537 1 saa7134
soundcore 10529 2 saa7134,snd

relevant modprobe.conf line from gnabgib:
alias char-major-81 saa7134

Log from gnabgib of saa7134 loading:
kernel: saa7130/34: v4l2 driver version 0.2.12 loaded
kernel: saa7134[0]: quirk: PCIPCI_TRITON
kernel: saa7134[0]: found at 0000:00:04.0, rev: 1, irq: 11, latency: 66, mmio: 0x41080000
kernel: saa7134[0]: subsystem: 5168:0138, board: LifeView FlyVIDEO3000 [card=2,autodetected]
kernel: saa7134[0]: board init: gpio is 39000
kernel: saa7134[0]: there are different flyvideo cards with different tuners
kernel: saa7134[0]: out there, you might have to use the tuner= insmod
kernel: saa7134[0]: option to override the default value.
kernel: saa7134[0]: registered input device for IR
kernel: saa7134[0]: i2c eeprom 00: 68 51 38 01 10 28 ff ff ff ff ff ff ff ff ff ff
kernel: tuner 0-0061: chip found @ 0xc2 (saa7134[0])
kernel: tuner 0-0061: type set to 5 (Philips PAL_BG (FI1216 and compatibles))
kernel: saa7134[0]: registered device video0 [v4l2]
kernel: saa7134[0]: registered device vbi0
kernel: saa7134[0]: registered device radio0
kernel: saa7134[0]/audio: audio carrier scan failed, using 5.500 MHz [default]

OK, pull the card out.

Card label info:
DSE PCI TV Tuner Card XH6765

Well, that just worked. No config nothing: I thought I'd just try the remote to see and the volume and channel numbers worked on both remotes.

(Later I understood that this is becase lirc creates a fake keyboard that sends keystrokes matching keycodes of a real keyboard so numbers, enter key and volume all worked as though the keystroke came from the keyboard. I think the vol worked becase it emulates those odd-arsed mutlimedia keys )

Events are commint in on /dev/input/event7 so I'll look at irc now and see if I
can get things going more generally.

After reboot it was event6. Then on the next reboot event7 again . Himmm...

OK: Created a profile for the remote with irrecord - painless - and moved it to
/etc/lircd so that the keys are recognised and have names that mean something.

Set up /etc/sysconf/lirc.conf to tell it to use event7.

Got stuck then. Created a test ~/.lircrc for tvtime but nothing.
read read read...
OK tvtime is not a client itself. Run irexec as a daemon which connects to lirc as a client and then ~/.lircrc will be used by it and any revient lines executed.
NOTE it seems that as soon as a vaild client connects the fake keystrokes are no
longer available.

Beaut mate.

Sunday, May 04, 2008

2008-05 Bookshelfs

I really need them. I'd used Lundia but don't have room for it right now so making shelfs specifically for paperback books is the only way forward.
Let's set some goals and restrictions:
I want it modular so I can add and remove and move it.
I want to fill a certain wall with it right now.
I want it to be cheap.
I'd like an arts and crafts look to it.

Tuesday, April 01, 2008

2008-04 Garden boxes

When you have no garden and have a very sunny balcony and you are me then this is the thing to do because I miss gardening and eating things I've grown myself.
The place I live in now is on the second floor and the front balcony faces north and gets good sun
all day. I'd been keeping an eye out for a growing stuff solution to take advantage of this and satisfy this need; maybe just some herbs for a start. I finally found a strawberry planter at an Op-shop and so decided the time had come for a gardening based P.O.T.M. Here's what would be good:
  • Grow herbs for daily use.
  • Grow Salad for daily use.
  • As self maintaining as possible. (self watering?)
  • Grow some experimental veggies you can't buy anymore.
  • Platform for experimental PC maintained garden?
  • Should be enjoyable to use, make and see.
  • Make as much of it as I reasonably can reusing materials when reasonable.
  • But use cheap and common materials if I need to get it done.
As I said, found a plastic strawberry container in an op-shop for $3.00. Got a bag of potting mix from the warehouse ($6.99) and re-claimed some herbs I'd potted out at my brothers. I transplanted them semi-careful into the strawberry container fulled with potting mix, watered well and are doing fine now. Could do with a drip tray yet.
(Though seen in this photo they look a bit crook. They've been growing in there about two weeks here.)
There's Mint, Sage, Parsley and Thyme right now. I have Lemon Balm, Lemon Grass, Vietnamese Mint and French Tarragon to Squeeze in.
Not going to fit. Need. . . more. . . dirt. . .
Warehouse had a special on some seed houses. A sort of small plastic glasshouse (nice oxymoron) for $20 so I got one to keep things going in case
the cold of winter bit before I got plants into soil. It also allowed me to start collecting plants before I had anywhere for them and I thought I could grow monster amounts of Basil in it through the winter. Yeah. Basil. Awright. Checked with the neighbor (who would have to walk past it to get to her washing line) and she was cool so I got one.
Wacked the spare plants in it and it got so hot the Vietnamese Mint nearly karked it (we've been having a long hot Autumn). Moved them to the bottom of the seed house and they've been fine.

I still needed a solution to the lack of dirt. "Window boxes but big. " I thought. But that would need wood. Himmmm woooood.... Now, not many people know this but in town a good source of free wood is pallet bases.
There's been one lying by the mini-bin at work so I snarfed that. It'd been there for 3 months in the way in the car park and I was pretty sure they weren't going to chuck or claim it. Dragged it home and spent an hour or two knocking it apart and removing all nails then stacked it to see what I had to work with.
I'd hope to get two window/planting boxes out of it but after stacking the boards this way and that to get a good idea of the volume I decided to just do one. A kind of prototype and it worked quite well.
It's a bit more then 1 metre long and 30cm by 30cm. This is an unmeasured sketch, I just held stuff up and cut it to fit. The next one I'll refine and measure properly.
OK That I did and here is the one page PDF plan for you enjoyment.

I did some work on the "greenhouse" ; moving the basil into a bigger container that I hope will last the winter. Moved the tarragon into the strawberry container and tidied up some. The Lemon grass, Lemon balm and Vietnamese mint are still looking a bit fragile so they're in here too for now. I hope the basil ( and perhaps peppers and tomatoes) will go in the bottom and seedlings in the top.


Bad back and a stupid little cold have stopped me doing much more more on this. I'll put together proper plans and note on building a garden-box, add a few after photos' and that will be it for this part of this project.
I guess I will add the two boxes I'd wanted in the next few months and I'll post comments and photos if anything of interest occurs.

Final Notes:
TODO

Plant List:
Already Have:
Mint, Thyme, Sage, Lemon Balm, Chives, Parsley, Lemon Grass, Basil, Tarragon, Spinach.
Need:
Sorrel, Chicory.
Want List:
Salsify (Oyster Plant - sow in autumn.), Florence Fennel, Kaffer Lime, Rosmary,
coriander (perhaps Cilantro instead?), Endive, Chervil, Marjoram, Oregano,
Dill, Lettuce, Caraway, Cedronella, Collards, Purslane, Horse radish,
Jerusalem Artichoke, Lovage, Sweet Marjoram, Parcel.