Playing with Arduino

I finally managed to start playing with the Arduino again – I’ve had one for a couple years, and played with it a bit as soon as I got it, but then it sat on my shelf of unfinished projects.

My collection actually has three Arduinos – one is a Freeduino with a USB interface, and the other two are intended for use on a breadboard (a Boarduino and a Bare Bones Board). For a while, I’ve been intending to use the Freeduino to program the chips on the other boards since I don’t have the right cable to connect them otherwise, but I hadn’t realized that on the arduino.cc site, they actually have instructions for doing that. In addition, they show the most minimal setup possible – which only requires an AVR, a resistor, a capacitor and a few wires if you use the internal oscillator. How much else you need depends on what you are using the Arduino for, but it certainly makes the idea of embedding the Arduino in a project more interesting since it drops the base cost under $10.

I’m currently playing with two projects – reading a SD card, and controlling a servo. The SD card is to see if a ‘dead’ card that a friend has can be accessed via SPI. I’m assuming that the typical USB readers use something other than SPI since that is a slower mode of access, and is optional on microSD cards. I’m going to set up a breadboard with a circuit to access my test card (a 32 Mb Canon card) until I get a chance to pick up a 74AHC125. The issue is that SD cards run at 3.3V, while the Arduino is at 5V. I can use a resistor divider setup to interface to SD cards, but if I want to support SDHC cards, I need to be able to meet the 10ns risetime requirements in the spec, which the 74AHC125 should manage.

The servo is going to be controlled by the Arduino via an IR remote. I have an IR receiver module that keeps things simple – feed it power and it spits out a clean signal that you can connect to the Arduino. From there you need to decode the pulses to figure out what key was pressed, and take appropriate action.

As far as the servo goes, I have never used one before, so when I hooked one up today, I wasn’t sure how difficult it was going to be. There is a sample sketch that is provided with the Arduino IDE that sweeps the servo back and forth, and I loaded it up on the Arduino and expected to see some motion. No such luck…. no motion at all. I checked with Google, and found some forums where other people were having trouble, but nothing that appeared to be my problem.

Then I did a check on my setup – power and ground hooked up? Check. Control signal? Check. Servo voltage of 5V enough to drive it? Yup. Control signal hooked up to the right Arduino pin? Uh-huh. I finally tracked the problem down to the jumper wires I had used to connect everything. I had soldered some pins to each end of some lengths of wire to make it easy to get a good connection with the stranded wire I was using – unfortunately, the control wire had a bit of extra solder on the one side. And wouldn’t you know it, that was the side that was facing the power connection. I had a short between 5V and the control signal, so as far as the servo was concerned, there was no control signal.

Once I fixed that little issue, the servo started turning back and forth as expected. Now all I have to do is remember how to decode the IR input and make it control the servo. That shouldn’t be very hard, should it? In any case, I’m going to play with it tomorrow and see where I get. I’ll try real hard to do a decent write-up if I manage to get it working – same for the SD card reader….

Canon iP2200 – borderless printing under Linux

I picked up a Canon printer a while back – specifically a Pixma iP2200. Getting it to work properly under linux has turned out to be… somewhat challenging.

Since I run Ubuntu at home, the page at the Ubuntu wiki does a good job of getting the printer set up and working.

The only trouble is that printing photos turned out to be a problem – none of the programs I tried seemed to be able to print properly. Most of them seemed to use gutenprint (aka gimp-print) which had no driver for the iP2200 by default, and when I specified the ppd file from the Canon setup, I wound up with about 3/4 of an inch of the left side of the image on the far right of the paper. Even when I did manage to get a decent printout, I was stuck with a border on the print.

After looking into it for quite a while, I happened across a document for the iP2500 – it talked about a program (supplied with the Canon driver for the printer) called cifip2500. It supported command line options for borderless printing.

[EDIT: It turns out that if I had bothered to grab the manual Canon supplied, the information is there as well....]

Checking on my own system, I found a corresponding program called cifip2200. Running cifip2200 –help gave me this output:

Canon Inkjet Print Filter Ver.2.60 for Linux
Copyright CANON INC. 2001-2006
All Rights Reserved.

Usage: cifip2200 --gui (gui mode)
cifip2200 [switches] [file]

switches: [ --imageres 1 - 32767 ]
[ --cartridge cartridgetype ]
[ --media mediatype ]
[ --halftoning halftonetype ]
[ --quality 1 - 5 ]
[ --grayscale ]
[ --papersize size ]
[ --paperload position ]
[ --borderless ]
[ --extension 0 - 3 ]
[ --location position ]
[ --fit ]
[ --full ]
[ --percent 20 - 400 ]
[ --copies 1 - 999 ]
[ --renderintent intent ]
[ --gamma 1.4 / 1.8 /2.2 ]
[ --balance_c -50 - 50 ]
[ --balance_m -50 - 50 ]
[ --balance_y -50 - 50 ]
[ --balance_k -50 - 50 ]
[ --density -50 - 50 ]
[ --inkcartridgesettings cartridgetype ]
[ --bbox left,bottom,right,top ]

As you can see there is a –borderless option, and options to set lots of other things as well. During my first attempt, I was surprised to get lots of control characters scrolling across my screen – turns ou8-bit per color RGB/8-bit Gray/Index/8-bit per color α RGB/8-bit α Grayt that the program output is intended to be redirected to the printer (or a file). My print command looked like this:

cifip2200 –media glossypaper –papersize 4X6 –fit –picture.tif > /dev/usb/lp0

That generated a very nice picture (in this case of my dog with antlers, taken for Christmas), but didn’t work until I ran it as root, and shut down cups, since it complained that the printer was busy.

So, the full list of restrictions at the moment with this method:
1) Limited file formats based on documentation for the iP2500 version:
TIFF:Uncompressed mode only
BMP: Only 8-bit per color RGB
PPM: Only 8-bit per color RGB (binary format)
PNG: 8-bit per color RGB/8-bit Gray/Index/8-bit per color α RGB/8-bit α Gray

2) Must be run as root

3) Cups must be stopped to allow access to printer

Presumably the pstocanonij program used as the cupsFilter in the ppd file takes the postscript generated for cups, and converts it into a supported format which is then printed using cifip2200. This is supported by the fact that the bottom of the ppd file has options that match the above options very closely (except for –boderless not being present).

One thing that puzzles me is that no resolution is specified for cifip2200 – does it choose based on the quality setting, and the input file? If so, then resolution settings in the .ppd file are merely for the postscript file (and conversion to image). In any case, I have a solution for now and some more testing to do to determine how to get optimal quality. If I recall correctly, the pstocanonij code is available, so once I get everything figured out, it may be possible to add the borderless setting, either by default or as an option.

[edit: The documentation says that the default resolution is 120dpi, and gives an example of setting it to 60dpi. Seems strange considering the specs say 600-2400 dpi...]

-This is my first attempt at a post using the QTM blogging software-

Getting organized

WordPress has categories… why don’t I use them?

I’ve been randomly posting comments about day to day life, alongside photos, alongside tech talk. The end result isn’t everything I’d hoped for. I’ve added categories for humdrum day to day stuff, and tech talk, and will probably add more as I go along. That means that photos will be in posts by themselves, with the only text being actually related to the photos.

On the home front, I’ve actually managed to remove one source of constant irritation – making the printer in my office let Jenn print correctly. My office is bigger than hers, so it makes sense that the printer in is mine, unfortunately I’m the geek in this relationship. My computer tends to be… unstable. I re-install software and operating systems frequently, and that means that the printer can go away randomly for unknown reasons (from her perspective, I know exactly why it went away). I’ve been using a SMC Barricade router for years, it worked, but only barely, and didn’t have support for anything fun like Dynamic DNS or SNMP. I just hadn’t been able to convince myself to spend around $100 to replace something that was working fine. Then I had the brainstorm – I could get a router that had a USB port on it to act as a print server. Since Jenn currently wasn’t able to print, it was an easy sell.

Off to the store we went, and a D-Link router came home with us. Installation was simple (expect for remembering my DSL account info), and in no time at all I’d upgrade the network to be 100Mbps throughout (the SMC was 10 Mbps), and get printing working.

Due to the location of my office in the house, running cables to anywhere else and keeping them hidden is a pain. I’ve only been able to run a single ethernet cable which limits connections since it is hooked up to a computer. Since the new router actually frees a 5-port switch as well, that lets me play around with the setup. I’m going to have to play around with positioning of the wireless access point, and see if I can improve the overall signal strength in the house. I also need to think about a computer or device by the TV since everybody needs a multimedia system, right?

Fortune Cookies

Well, I’ve been messing around with various gallery plugins for the site, and I think I have at long last found a winner in Lazyest Gallery. It does (almost) everything I’ve wanted… easy upload dialog, pulling the images from a simple directory so setting up an export in my image organizer should be doable, automatic image resizing, easy adding of descriptions, and more. Still working the kinks out, figuring out what all the options do, and so forth.

The only missing piece is easily adding the images to the post with lightbox enabled as well. That will take some coding, but I think it should be pretty easy to do. I needed to work on the lightbox control anyway because it asks for way too much information – I want to tell it what image I want and have it worry about the details. In the meantime, it’s a little extra work to add an image, but really just a couple copy/paste sequences. I’m off tomorrow, so I’m hoping that I can fix that real soon.

As to the photo – we visited Chinatown in San Francisco, and one of the places mentioned in a guide I’d seen was the fortune cookie factory. It was not at all obvious, down a back alley and we almost walked right past it, but it was interesting to see the cookies being made. We got some ‘naughty’ fortune cookies while we were there, but on the whole they are a little disappointing.

Fortune Cookie Factory

Time to start posting some pictures….

Came back from a trip to San Francisco last week. Took a few pictures that might be worth posting. I added Gallery to the site, and am going to try using that. It certainly makes uploading pictures a lot easier, since I use Digikam (a linux picture organizer) to sort my images, and there is an option to export to Gallery.

Issues to resolve about using Gallery are how to integrate the lightbox preview I’ve already set up – I really like the way it works, so I’ll probably find some way of integrating the two, even if it is only to have the lightbox code use the images that Gallery sets up.

Anyway, Pic#1 from San Francisco bears some resemblance to one I took in Chicago that happens to be in the photos that rotate through the upper right.
Firetruck II

Scan results

Had a friend wondering about the quality of scans when scanning slides with a flatbed scanner. I’ve dug these up out of the archives for a reference.

Slides:
These are the only slides I’ve scanned and I took them in high school, which means that they are about 20 years old. Hopefully my photography has improved since then.

Sitting on the DockGetting Near Sunset

Negatives:

Some black and whites from a roll I shot at a friend’s wedding and developed myself.

Grist MillWedding PhotosLaughing Together

Edit:

I’ve been playing with a thumbnail creation script using ImageMagick. It’s pretty cool how much you can do. I had to do some scripting to make it fit the scaling, something that ImageMagick V6 handles with a single extra character, but until that’s running on this server, my solution will work…. long term I want to roll the thumbnail creation into the LightBoxJS stuff. Right now it asks for thumbnail, width and height. No reason it can’t get that stuff automatically.

Further edit:

I’ve update everything to use Lazyest Gallery, so the ImageMagick stuff isn’t needed

No new content, but update to the site layout

Not that long ago, I switched to the travelogue theme for my site. I still like it, but version 2 has been released. The changes are definitely for the better (for one, I can change the title without having to use photoshop…).

I expect that it will take a few days to get things configured. Until then, don’t be surprised if things are broken.

As soon as I get that done, I promise to post some real content.

The plugin can be found here. If you plan to use it yourself, there is one small change you need to make. Normally, I’d get the theme creator to fix the problem, but he seems to be gone for 2 years.

I kept getting an error about upgrade-functions.php , which turned out to be because the initial install has a function called travelogue2_install (located in plugins/travelogue2-install.php) that is only supposed to be called once. It adds a table to the database called t2.

In functions.php (in the travelogue2 theme directory), the call to this function checks to see if the table exists before calling the install function. Unfortunately, the table it looks for is called travelogue2. Since the other references to the table refer to t2, changing the check to be t2 as well makes the theme stop generating errors.

As well, the archive.php file calls an undefined function called af_ela_super_archive – you can just comment it out (put // directly in front of it).

Update:

I had added Lightbox support myself to the previous theme. Instead of doing that again, I figured using a WordPress Lightbox plugin made more sense. Since I followed the setup without changing anything in my original implementation, all the previous lightbox enabled posts work just fine.

Next on the list is a image handling plugin and I should be all set for the short term.

No photo – site change

Found a really cool script here: Lightbox

Added it to my site tonight – click on any of the pictures starting with the wierd ‘rental car’ and you can see it in action.

I like letting visitors view the larger version, without leaving the page. I need to see about making it check that the file is valid, right now if it isn’t, you wind up having a hard time getting back to the page.

More photos coming soon. I promise. Just have to get settled in at the new job.

Updates – life & software

MERRY CHRISTMAS!

No Photo today – maybe later. I just upgraded the software running the blog to WordPress 2.0, not much is likely to change as a result.

— UPDATE 18:20 —Whoops, guess the site is going to change… clicked on a different theme and decided to go with it for a while. Worked out how to update the polaroid image with some help from here.

— END UPDATE —

On the other hand, something likely to cause major changes are the stuff that is happening in real life. I’ve resigned at Virtek, and will start a new job in January with a company called Navtech. No travelling required, but I switch to 12 hour shifts and a continental schedule (days – 2 on, 2 off, 3 on, 2 off, 2 on, 3 off, repeat for nights). Shifts run from 8 to 8, which seems reasonable to me.

The last few weeks have been a little hectic at Virtek – trying to get as much as I can wrapped up before leaving. I hit Belfast, Manchester, Glasgow, Dallas/Fort Worth, Rome and Lisbon before Christmas. It’s really the first time in ten years of travelling that I wound up with jet lag. I’m chalking it up to my ankle – I’m still rebuilding the muscles, and travel puts a heavier than normal load on it when I’m lugging my laptop bag around airports and areospace plants.

Got a few decent shots in Rome that I’ll start uploading tomorrow (or later today if I get a chance). Didn’t get too many shots elsewhere, not enough time, or light.

Hope everyone had a good Christmas. In case I forget to mention, it looks like Chicago for New Year’s. A little chilly, but lots of stuff to do. With any luck, I’ll actually be able to take pictures there.

WordPress 2.0!

Time for me to start getting things in order around here. A few things have happened – my host (fuzzymonkey.net) upgraded the server I’m hosted on, and I made a mistake setting up the DNS address which knocked out the site for a couple of days. Hopefully I’ve got everything fixed on that front.

I decided to make two changes.

1) Change the location of the blog. The blog was previously at www.dragonsbyte.ca. Since I figure on eventually having books for sale listed, and potentially other stuff going on as well, it seemed like a good idea to move it to it’s own location. From now on, you can reach it at blog.dragonsbyte.ca.

2) Upgrade to WordPress 2.0. I noticed the release announcement, and figured as long as I was upgrading to a beta version, I should put it into a new directory, which led to change 1) in part. Since I didn’t upgrade the current blog, both are currently active. I’ll be working on getting all the old info moved over at some point.

Now I just need to see what all the changes actually are for 2.0. It’s looking pretty slick so far… with any luck there are things to make it easier to post a picture a day. I know there ar

e ways to post via e-mail, I just need to configure it. Oh, and there is already a upload image
option in the post entry area. Guess I need to add one….
Sunflowers

WOW!!!! Upload the picture, drag and drop into the post… set the size, link, etc… very cool. It even looks like it keeps track of all the pictures you have uploaded and lets you use them whenever you want.