QX5 USB microscope

From LinuxTVWiki
Revision as of 21:37, 15 June 2013 by Firestorm v1 (talk | contribs) (Added ubuntu info and v4l-ctl syntax that is current with a working scope (Old info does not work, but preserved))
Jump to navigation Jump to search

The QX5 USB microscope is a computer-only microscope with magnification power of 10x, 60x and 200x. The QX5 is sold by Intel Play. Intel Play claims that the QX5 is not supported under GNU/Linux, but in fact the cpia2 kernel module supports it well.

The Cpia2 driver was recently ported to v4l2 and version 2.0 of the driver was released in September 2005; in February 2006 it was accepted into Andrew Morton's 2.6.16-rc4-mm2 experimental kernel branch; cf. submission patch. It will likely make it into the 2.6.16 kernel.

This driver comes with two small applications: mview, a modified version of gqcam to view the output, and qx5view, a viewer that also controls the lights on the qx5 microscope. MJPEG Tools MJPEG Tools can be used to record.

Until the driver reaches mainline, you will need to get the latest version of cpia2 and qx5view from the cpia2 CVS in order to use the QX5 with a 2.6.x Linux kernel.

To build and load cpia2, you only have to do

make install
modprobe cpia2

You will then be able to start qx5view which should detect your microscope.

Oops! qx5view doesn't compile since kernel 2.6.38 or so, but the QX5 does work as a capture device in vlc as /dev/video0. The lights can be controlled from the command line while vlc is running using:

lights off: $ v4l2-ctl --set-ctrl=lights=0

top light only $ v4l2-ctl --set-ctrl=lights=1

bottom light only $ v4l2-ctl --set-ctrl=lights=2

both lights $ v4l2-ctl --set-ctrl=lights=3

If you'd like a gui to control lights and other QX5 features try qv4l2 while vlc is running. v4l2-ctl and qv4l2 are parts of the v4l-utils package in Debian Wheezy. This all worked with kernel version 3.1.0-1-686-pae.

Ubuntu 12.04LTS+ and Intel Play Microscope

This was for the most part already working in Ubuntu 12.04LTS. The only exception was the installation of v4l-utils with "sudo apt-get install v4l-utils". I already had VNC present on the system and got it up and running quickly:

  • Open VLC
  • Click on "Media"
  • Click on "Open Capture Device"
  • Set "Video Device Name" to /dev/video1 (or whatever is appropriate for your system)
  • Click on "Play"

You should now have a window output with what the scope sees.

Capturing images is done via Video->Take Snapshot (saves to ~/Pictures directory)


For controlling lights:

You will need to specify --device=/dev/video1 if your computer has a built-in webcam. My laptop has a built-in webcam using /dev/video0 so all my instructions below will use /dev/video1. Omitting --device=/dev/video1 will make it default to using /dev/video0.

use v4l-ctl --all to query the device. The output should show something similar to below:

$ v4l2-ctl --device=/dev/video1 --all
Driver Info (not using libv4l2): 
	Driver name   : cpia1
	Card type     : Intel Play QX3 Microscope
	Bus info      : usb-0000:0f:00.0-2
	Driver version: 3.2.46
	Capabilities  : 0x05000001
		Video Capture
		Read/Write
		Streaming
Format Video Capture:
	Width/Height  : 352/288
	Pixel Format  : 'CPIA'
	Field         : None
	Bytes per Line: 352
	Size Image    : 262144
	Colorspace    : SRGB
Video input : 0 (cpia1: ok)
Streaming Parameters Video Capture:
	Frames per second: invalid (0/0)
	Read buffers     : 2

Next, use --list-ctrls to list the device's controls (outputs to device) We are interested in "illuminator_1" and "illuminator_2" below.

$ v4l2-ctl --device=/dev/video1 --list-ctrls
                     brightness (int)    : min=0 max=100 step=1 default=50 value=50
                       contrast (int)    : min=0 max=96 step=8 default=48 value=48
                     saturation (int)    : min=0 max=100 step=1 default=50 value=50
         light_frequency_filter (menu)   : min=0 max=2 default=1 value=1
                  illuminator_1 (bool)   : default=0 value=0
                  illuminator_2 (bool)   : default=0 value=0
             compression_target (menu)   : min=0 max=1 default=0 value=0


Now, all we need to do is use v4l2-ctl to turn them on!

v4l2-ctl --device=/dev/video1 --set-ctrl=illuminator_1=1   (for stage/lower light)

v4l2-ctl --device=/dev/video1 --set-ctrl=illuminator_2=1   (for scope/upper light)

Using "=0" instead of "=1" will turn off the respective light.



External Links