TT Electronics Reflective Optical Sensor Kit - Review

Table of contents

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:

Unboxing

The kit shipped by TT Electronics includes the following items

  • a mainboard the daughter boards where the OPB9000 sensors is mounted will be connected to
  • 2 OPB9000 daughter boards
  • a USB cable
  • a 4-wires extension cable
  • a USB stick with datasheets and the setup for the Photologic GUI application

I also received an additional daughter board (which feature a different connector) and an adapter cable to connect the daughter board to the mainboard

 

imageimage

imageimage

 

Testing with the graphical interface

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

  • I connected the daughter board to the mainboard. Daughter board must be oriented outwards, as shown in picture
  • I installed the Photologic GUI application by running setup.exe on the provided USB stick
  • I plugged the mainboard to a USB port on my PC
  • I started the Photologic GUI application from the link that was created on the desktop. If everything is ok, the status bar located at the bottom of the application window will show something like "Device found"

 

image

 

  • Place in front of the sensor the "object" you want to detect at the desired detection distance
  • Click "Auto calibrate" button.  The OPB9000 sensor will drive the emitter LED until it detects the right amount of light is reflected back by the reflective object. When this condition is detected, current level is stored in the internal EEPROM and the calibration process is completed successfully
  • Now you can connect the sensor is ready to be operated and can be connected to your own electronics

 

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)

 

image

 

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

 

image

 

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

 

Sensor dimensions and connections

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

 

imageimage

image

 

 

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

  • power supply status
  • output status (i.e. whether the object is detected or not)
  • calibration status

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

 

imageimageimage

 

 

Interfacing with Arduino

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

 

image

 

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

image

 

I chose pin 15 (board pin A1). So here is the final prototype

 

image

 

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

  • "sample time" is the time (expressed in milliseconds) between two RPM calculations
  • counter is the variable that counts the number of interrupts occurred
  • 4 is a constant that takes into account the fact that there are four detection objects on the flywheel, as you can see in the following picture of the testbed

 

imageimage

 

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)

 

image

 

Conclusions

I consider this roadtest very positive thanks to

  • The sensor itself, because
    • is extremely compact
    • detects objects reliably in every light conditions
    • detection range and "what has to be detected" is programmable
    • supports power supplies from 3.3V to 30V
  • the evaluation kit, because you are guided in each and every step to have an hassle-free experience. The video included in the USB stick is really a plus: even if it refers to outdated software and hardware version, it gives you an overview of the steps required to use the sensor

 

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

Anonymous