[argyllcms] Re: [DIY Colorimeter] Identification and communication with a device.

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Tue, 15 Feb 2022 09:10:37 +1100

Marc Clarac wrote:

Hi,

I plan on
using an AMS AS7341 color sensor, and a microcontroller I already have like
an Arduino Leonardo or Teensy 3.2.

the AMS AS7341 is an interesting device, although it probably won't
make a very accurate colorimeter due to it's limited number of
spectral bands (i.e. you can't emulate the standard observer
sensitivity curves very accurately with the limited number of bands.)

A challenge in making your own instruments is figuring out how
to calibrate them.

1) I don't understand (nor have found yet) how argyllCMS knows whether an
usb device is a colorimeter or any device it can communicate with. I know
USB devices are identified by PID and VID but I'm not sure it is enough. Is
there any documentation about the identification of a device for ArgyllCMS ?

Most of the code is in the source sub-directory spectro, with the core
definitions in spectro/inst.h. There is no comprehensive documentation,
just working code and examples. If you are writing a new driver you
should use one of the existing drivers as an example, i.e.
spectro/colorhug.c.

I've put a general overview of the API here: 
<https:/www.argyllcms.com/instlib.api.txt>,
and I'll also include it in the spectro directory in future releases.

2) I've partially read the colorhug 1 and 2 source code on github. It uses
a protocol made of bytes commands and the answers are variable length
arrays of bytes, containing the answer of the sensor. The answers sent by
the sensor are also described in the source code.
Is there any argyllCMS protocol already documented I should use and if it's

There is no standard protocol. A lot of early instruments and many of the
high end instruments use a human readable text protocol. Cheaper instruments
have tended to use binary protocols. Sticking to HID USB has advantages
in terms of driver support on MSWindows, and there is some out of the
box support for this on Teensy (although you have to delve into it
a bit if you want a custom VID/PID - I can tell you more about that
if you are really interested.) If you use HID then it's best to
formulate a protocol in terms of 64 byte messages.

I'm a bit lost for now.

Sounds like a worthwhile project if you want to learn about how
to create a USB peripheral and how to get software talking to it,
but you will have to get your head around a few different things
to make it work.

Cheers,
        Graeme Gill.


Other related posts: