Serial protocoll and color sensor


#1

Hi,
I’m missing a possibility to use the communication protocol to interface to the color sensor evaluation routine of dobot. How can I use the sensor with the serial communication protocol? Somehow Blockly must have use the solution to this question…


#2

First of all let me say that I’m absolutely disappointed by the lack of support you’re giving. It is one thing if written material is not complete… But in such a situation it would be vital for your project to react more promptly in the support forum.
As you have not reacted until now and our project is under heavy time preasure I started analyzing the color sensor problems myself. I’ve studied the DLL source files backward engineering the code to understand which serial commands you’re using with the color sensor. I’ve also used an USB tracking software to record the USB traffic during runtime of DobotStudio V1.4.9 as well as V1.4.12. I also analyzed the PCB of the color sensor in order to understand the way you have used the TCS32000 Chip. But even taking this effort I was unable to get the solution because you’ve totally mixed up versions of the sensor and versions of the DobotStudio. This resulted in a situation in which I cannot even get the sensor running with your blockly smaple code. The old sensor which is still delivered in Germany is the TCS32000 style sensor. EIO18 is used to turn on and of the LEDs. EIO17 is connected to the OUT pin of the sensor at which your firmware needs to get the frequency of a square wave signal to get the sensor value for one of the key colors red, blue or green. Which value is controlling the output frequency is controlled by the S3/S2 pins of the sensor chip which are connected to the serial TX/RX pins of the 10 pin communication connector. This means your firmware somehow needs to use these pins to give the digital values 00 (red), 01 (blue) and 11 (green). This can definitly not done by the serial communication protocol as these two pins are not EIO pins. Thus it seems the only way to get the sensor value is to leave that job to the firmware. But somehow you need to start the firmware function to retrieve the 3 colorvalues by measuring the frequency at EIO17. I would have had a chance to find this out if I would have had a running example in Dobot Studio by simply recording the USB traffic during this function. But both Versions of DobotStudio do not deliver correct color values (which other users also have complained about here in the forum). The reason seems to be simple: My recordiungs are showing serial communication commands which can’t be correct: There is a cmdID 137 which should start the GetColorSensor functionality in the firmware and deliver results for the 3 colors (according to the DLL source code). When using your blockly example for Color Sensor you are using “GetColor” with a parameter (r,g,b) which does not really make sense. In the USB recording for all three calls “GetColor” I do find the same call to the 137 cmd “GetColorSensor” (0xAA 0xAA 0x02 0x89 0x00 0x77). The incomming answer is showing rhe values 0x00, 0x00, 0x01 absolutely independend from the color in front of the sensor. blockly decodes this correctly into red=0, green=0 and blue=1. But this does not reflect the colors in front of teh sensor. This was my result of investigations with DobotStudio V1.4.12.
Using Version V1.4.9 which (as stated by the download comment) should work fine with the old sensor seems to work totally different:
It does translate the “GetColor” into a “GetIOADC” command (0xAA 0xAA 0x02 0x86 0x00 0x7A) without any way distinguishing between the different blockly parameters “r/g/b”. This seems to make no sense and it results in a reading of 116® 130(g) 79(b) independendly of the color in front of the sensor.
So in the end I got stuck without support and without usable result of own efforts. If I do not get help from the support I will have to give up using the color sensor and go a totally different way…Not a good marketing refernece, is it? So please make me happy and start answering your support request more promptly. I still have 2 days left for my exhibit which was planned to be shown at the IoT world congress in Barcelona. Wouldn’t it be nice to have the dobot shown there?