Tuesday, October 29, 2013

Project XiCam -- Part 1

Calling this project XiCam for lack of a better idea.  The concept is this:  Hack one of our old digital cameras so that I can control it from my Android tablet.  Why do this?  I'll let you know when I figure that out for myself.  My goal is to create some attachment mechanism so I can position the camera lens to the eyepiece of my telescope.  I'd like to see what options I can control over the USB port.  If I'm lucky, I might be able to manipulate settings beyond the controls provided by the on-board UI.

Samsung ST100 digital camera.
Here's what I'm working with:
  •  Samsung ST100 14.2 Mpx digital camera
    • 5x optical zoom
    • 8GB micro SD
  • ASUS TF201 Transformer prime
    • NVIDIA Tegra 3 quad-core CPU
    • 10.1" screen
    • Android Ice Cream Sandwich OS
    • ASUS  Tablet with keyboard dock.
      HP Pavilion dv4 notebook
    • 32GB micro SD
  • HP Pavilion dv4
    • Intel core 2 duo CPU
    • Ubuntu 12.04 LTS OS
    • Eclipse Juno IDE + Android SDK + ADK
Android has some good functionality for USB communication, unfortunately there's no good way to develop software on the tablet itself (I installed one of the free IDE's, which appeared to be inspired by eclipse, but there were limitations due to screen size, responsivity of keyboard, and other reasons which made that option impractical).  My general approach will be to develop some basic USB communication software on the notebook, using an emulated tablet as the target.  Once that's working, install it on the ASUS  and make sure the USB interface actually works.  Next, further develop the software to perform some basic control operations on the camera.  Then finish by adding some pretty GUI controls to control exposure and read image data into the tablet and present it on the screen.

Before I can do any of these things, I need to develop an understanding of USB protocol.  I spent the last couple of days researching this and the communication format doesn't seem terribly complicated.  However, many USB products, especially digital cameras, use proprietary formats which require their own drivers.

I ran into a big problem, likely due to installing libusb on the HP.  Mouse suddenly stopped working.  Thought it was the battery but it worked on another computer.  When I checked /var/log/syslog, it was getting overloaded with messages about not being able to enumerate the USB devices.  I tried removing libusb-1.0-0 and libusb-1.0-0-dev (the exact packages I installed), then the whole thing went to pot.  When the system rebooted after removing and updating the packages, it got stuck in some weird loop where the login screen would come up, I'd enter my password (I had setup the OS to not go to a login screen, so even that was weird), another screen would come up with error messages, but it only stayed for about 1/2 second, so I couldn't tell what the errors were, then went back to the login screen.

I couldn't find the install disk to run the live version and potentially fix the problem, but that was lost.  I found the ISO for 10.04 on an external drive, so I burned a new copy and am running that right now.  Even in "live" mode, the USB ports aren't working, so even though I can view my directories, I can't save the files to it.  Instead, I took the SD card from the camera and am tarballing the essential stuff and saving it to that.  Thankfully that works.

Eventually, I plan on doing this kind of work in a virtual machine running on Windows.  This way when I encounter big problems with the OS, I don't wind up losing everything.  Unfortunately, can't do that until I get a new computer.



No comments:

Post a Comment