Jonathan Thomson's web journal

Getting Started with the TSL230R and Arduino April 24, 2010

The TSL230R uses an array of configurable PIN diodes to convert light into current, measures the current, and outputs a pulse train with a frequency that represents the measured current. The TSL230R allows the sensitivity of the photodiode and the scaling of the output frequency to be changed. The photodiode array has three levels of sensitivity: 1x, 10x, and 100x. Output frequency scaling is for lowering the apparent frequency your frequency counter sees, so that the counter can accurately measure the frequency without its maximum detectable frequency being exceeded.

Sensitivity is set by changing the voltage levels on TSL230R pins 1 and 2. Output frequency scaling is set similarly by manipulating pins 7 and 8. Pin 6 outputs the scaled frequency, and pin 3 controls whether the frequency is output or not. Ground and power are pins 4 and 5 respectively.

Arduino can be used as a frequency counter and to set the TSL230R’s sensitivity and scaling. The following schematic is for an Arduino set up on a breadboard.


TSL230R_basic_example.pde (view online) will set the sensitivity to 1x and the frequency scaling to divide by 2. It counts the TSL230R output pulses input to Arduino digital pin 5 using the FreqCount library, which is easier to use and more accurate than the milli() or micro() functions.


Follow this link to download the FreqCount library. The FreqCount folder should be placed in arduino/sketchbook/libraries/

Follow this link to download TSL230R_basic_example.pde and add it to your Arduino sketchbook. Once you have the code uploaded and running on the uc, open the serial monitor and observe the changes in frequency as you shine varying amounts of light on the TSL230R. If divide-by-1 frequency scaling is used the TSL230R outputs a fixed width pulse train. The other frequency scalings result in a square wave output. The t_on of the fixed width pulse maybe be too short for Arduino or low frequency oscilloscopes to detect, therefore a frequency scaling setting of divide-by-2 is used.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s