RoadTest: TT Electronics Reflective Optical Sensor Kit
Author: amgalbu
Creation date:
Evaluation Type: Semiconductors
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: The sensor is comparable with Vishay VCNT2020, Sharp GP2S700HCP or Vishay TCRT5000
What were the biggest problems encountered?: No problems at all
Detailed Review:
The kit shipped by TT Electronics includes the following items
I also received an additional daughter board (which feature a different connector) and an adapter cable to connect the daughter board to the mainboard
At first I inserted the USB stick in my PC and, with my great surprise, I found a great introduction video that shows in an absolutely clear and effective way how to get started with the kit. I think it worth to share it because it gives in just a few minutes a great overview of the sensor capabilities
According to the video, before using the OPB9000, it may be programmed to a specific output type and sensitivity level, and self-calibrated against a specific target at a specific distance from the sensor face.
As supplied, the device is output type inverter (signal detected, output low), push-pull. The sensitivity level is set for detection of a 90% diffuse reflectance white card at a distance of 12mm and a change of state when the reflected signal drops by approximately 50%. This default setting is sufficient for use in many applications. For other applications, the user can re-program and re-calibrate the device for the specific application by means of the provided Photologic GUI application.
So let's do the calibration from the Photologic GUI. I followed these steps
There is another option to calibrate the sensor: just push the calibration switch located on the evaluation kit's main board and check the calibration result (LED D6 shows the calibration result)
My first question here was: what if I want to calibrate the sensor after I installed the sensor itself in my machine?
According to the datasheet, during the calibration process the pulsed LED drive is ramped from 3 mA to approximately 85 mA (at the above mentioned pulse duration and pulse period) until the reference level is reached for two consecutive pulses. The LED drive current value is then stored in an EEPROM bank. The LED drive ramp is controlled by a 10 bit DAC (1024 steps) at approximately .085 mA per step. The ramping period is 17mS max; a subsequent STATUS mode is active for an additional 13 mS. After a calibration request is sent, and during the ramping period, the CAL/STAT pin will be in a high state. After the ramping period ends with a successful calibration, the pin will transition to a low state for the STATUS mode (as seen in the screenshot). If the calibration is unsuccessful, then the CAL/STAT pin will remain high for the STATUS mode period. An unsuccessful calibration can occur if there is no reflective surface present, or insufficient light received during the calibration process.
This is the signals that you need to generate and check in order to calibrate the sensor
The calibration procedure looks not so implement... you have to generate pulses with duration of about 10 microseconds. It's not clear the amount of precision you have to achieve in the pulse durations and I was not able to find any other information on this topic. It would be great if TT Electronics could provide a reference implementation of the procedure to communicate with the sensor and start the calibration process
For this roadtest, two types of sensor boards have been shipped
The first type in included in the evaluation kit box. It features only a switch to calibrate the sensors after it has been installed in your device.
It has a four-pins square connector and can be plugged directly to the evaluation kit's main board. on the same size of the connector, there is also a switch, but I have not been able to find out what this switch is for
The second sensor board has been shipped in a separate parcel and features a different connector (a 4-pins Molex) and three LEDs to show current sensor status, namely
This board can handle from 3.3V to 30V and has a built-in voltage protection. Thanks to LEDs (that makes troubleshooting really easy) and the wide range of supported voltages, this board can be used as-is in your final project
For this roadtest, I would like to build an RPM counter. For the first prototype I will connect the OPB9000 sensor to an Arduino Nano 33 IoT and use the Trinamic TMC-2300-IOT-REF board to drive a motor with a flywheel
As I said, after the calibration process has been worked out, the sensor can be connected to your hardware.
The recommended application circuit is shown in picture below
We need to connect the OUT pin (i.e. the pin that reports whether an object has been detected or not) to one of the Arduino Nano 33 IoT pins and use a 10k pull-up resistor as suggested by the datasheet
Because we want to connect avn interrupt, we have to choose one of the following pins
I chose pin 15 (board pin A1). So here is the final prototype
The code for the Arduino board will attach the interrupt the the falling edge of the A1 pin. Every time a falling edge is detected, a counter is incremented. Every second the RPMs are computed according to the formula
RPM = (60000 / sample time) * counter / 4
where
The result is printed out to the serial port
int ledPin = 15; volatile byte rpmcount; unsigned int rpm; unsigned long timeold; void rpm_fun() { // update rotation count rpmcount++; } void setup() { pinMode(ledPin, INPUT); attachInterrupt(ledPin, rpm_fun, FALLING); rpmcount = 0; rpm = 0; timeold = 0; Serial.begin(9600); } void loop() { //Update RPM every second delay(1000); //Don’t process interrupts during calculations detachInterrupt(0); //Note that this would be 60*1000/(millis() – timeold)*rpmcount if the interrupt //happened once per revolution instead of twice. Other multiples could be used //for multi-bladed propellers or fans Serial.print("Count="); Serial.print(rpmcount); Serial.print("; Delta="); Serial.print(millis() - timeold); rpm = 60*1000/(millis() - timeold)*rpmcount; timeold = millis(); rpmcount = 0; //Print out result to lcd Serial.print("; RPM="); Serial.println(rpm); //Restart the interrupt processing attachInterrupt(ledPin, rpm_fun, FALLING); }
Here is the video of the RPM in action
I run this application in different light conditions and the sensor's detection algorithm looks not to be influenced by external light. I tried to change ambient luminosity by switch on my mobile's torch and the sensor kept operating reliably. Also, the object detection point was quite stable over time, as you can see from the scope trace (in the video, the scope was configured with infinite persistence, and the signal shows no jitter)
I consider this roadtest very positive thanks to
The only thing I would like to suggest is to provide a reference implementation of the functions required to access sensor EEPROM and to start the calibration process