2014-02-02

Using the Intel Play QX3 with the newer gspca driver and v4l

Years ago Mattel released an educational toy microscope called the Intel Play QX3, and later the QX5. This particular microscope has a CMOS imaging chip with a lower lamp for transmitted light to come through a specimen and an upper lamp for light to be reflected off of it, each of which is independently toggled on and off by software. The resolution and speed of the CMOS chip in the QX3 is quite poor by modern standards but it does function adequately for a basic educational model. Some samples of image quality attainable can be found. I happen to own a QX3 and in the past was able to use the old guides for the old driver to turn the illuminator lamps on and off in older releases of various Linux distros. As time moved on driver rewrites began and things got shuffled around. Instead of using the old CPiA driver modern distros use the gspca driver framework which still operates under Video4Linux. V4L has a control command that allows regular users to send commands to the driver via their API, available in the v4l-utils package. The old method involved sending commands directly to the device driver module as a user with root privileges.

Plugging the microscope in shows the following:
jon@leon:~$ lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 
Bus 005 Device 002: ID 0813:0001 Mattel, Inc. Intel Play QX3 Microscope 
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 003 Device 003: ID 046d:c063 Logitech, Inc. DELL Laser Mouse 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
jon@leon:~$ dmesg
[...]
[101645.604019] usb 5-1: new full-speed USB device number 2 using uhci_hcd
[101645.811040] usb 5-1: New USB device found, idVendor=0813, idProduct=0001
[101645.811045] usb 5-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[101645.811048] usb 5-1: Product: Intel Play QX3 Microscope
[101645.811050] usb 5-1: Manufacturer: Mattel Inc.
[101645.830281] Linux video capture interface: v2.00
[101645.833059] gspca_main: v2.14.0 registered
[101645.835930] gspca_main: cpia1-2.14.0 probing 0813:0001
[101646.140126] input: cpia1 as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/input/input11
[101646.140262] usbcore: registered new interface driver cpia1

To talk to the camera driver module use v4l2-ctl to list and change the various settings it has available.
jon@leon:~$ v4l2-ctl -l

User Controls

                     brightness (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast (int)    : min=0 max=96 step=8 default=48 value=48 flags=slider
                     saturation (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
           power_line_frequency (menu)   : min=0 max=2 default=1 value=1
                  illuminator_1 (bool)   : default=0 value=0
                  illuminator_2 (bool)   : default=0 value=1
             compression_target (menu)   : min=0 max=1 default=0 value=0

Flipping the lights on/off involves setting the illuminator_n controls with bool values. illuminator_1 is the lower, transmissive, light source. illuminator_2 is the upper, reflective, light source.

It is easy to turn them on/off at will from a command line.
v4l2-ctl -c illuminator_1=0
v4l2-ctl -c illuminator_2=1
v4l2-ctl -c illuminator_2=0
v4l2-ctl -c illuminator_2=1


To get the microscope working I installed Camorama and it saw the QX3 when run. A bit of twiddling with the sticky and twitchy focus controls brought in a good view of some wear on a coin, illuminated by the upper lamp. Finally, science!