Download Print this page

Parallax TSL1401-DB Instructions Manual

Linescan camera module

Advertisement

Quick Links

Web Site: www.parallax.com
Forums: forums.parallax.com
Sales: sales@parallax.com
Technical: support@parallax.com
TSL1401-DB (#28317): Linescan Camera Module

Product Overview

General Description
The TSL1401-DB is a daughterboard that provides a TAOS TSL1401R 128-pixel linear array sensor and a
lens. It is designed to plug into a motherboard (e.g. MoBoStamp-pe (p/n 28300), MoBoProp (p/n 28303,
in development), Propeller Backpack (p/n 28327)) or the DB-Expander (p/n 28325). This module will
allow its host system to "see" in one dimension. Two- dimensional vision can also be achieved by moving
either the subject or the sensor in a direction perpendicular to the sensor axis.
Features
Provides vision in one dimension with 128-pixel resolution.
Three-line serial interface with analog intensity output for each pixel.
Included 7.9mm lens provides a field of view equal to subject distance.
Plug-compatible with Parallax motherboards.
Coprocessor driver firmware for the MoBoStamp-pe available for download.
Can be interfaced directly to a BASIC Stamp for some functions.
Onboard accessory socket for strobe output or 50/60Hz fluorescent light sync input.
Runs from 3.3V or 5V supplies. (5V is needed for the optional LED strobe attachment.)
Applications
Measure height, width, diameter, thickness.
Locate objects, lines, edges, gaps, holes.
Count items; measure conveyor coverage.
Determine volume, shape, orientation.
Read simple barcodes.
Learn the principles of machine vision.
What's Included
What You Need to Provide
Parallax motherboard, or DB-Expander with BASIC Stamp and carrier board (such as the BOE).
© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
Office: (916) 624-8333
Fax: (916) 624-8003
Sales: (888) 512-1024
Support: (888) 997-8267
®
Web Site: www.taosinc.com
Sales: sales@taosinc.com
TSL1401-DB with lens.
®
Office: (972) 673-0759
Fax: (972) 943-0610
Page 1 of 52

Advertisement

loading

Summary of Contents for Parallax TSL1401-DB

  • Page 1: Product Overview

    Product Overview General Description The TSL1401-DB is a daughterboard that provides a TAOS TSL1401R 128-pixel linear array sensor and a lens. It is designed to plug into a motherboard (e.g. MoBoStamp-pe (p/n 28300), MoBoProp (p/n 28303, in development), Propeller Backpack (p/n 28327)) or the DB-Expander (p/n 28325). This module will allow its host system to “see”...
  • Page 2 The TSL1401R chip is a linear array (linescan) sensor. It consists of a single row of 128 photodetectors. The TSL1401-DB includes a lens to form images on the sensor array. What results is somewhat like peering through the narrow crack of a partially opened door to see a thin slice of what lies behind it. The...
  • Page 3 Interface and Basic Operation Refer to the schematic on the last page of this document for the TSL1401-DB’s pinout, and to TAOS’s TSL1401R-LF datasheet (available from www.taosinc.com) for the sensor chip’s particulars. For normal operation (i.e.
  • Page 4 2 3 4 5 6 7 8 9 10 . . . Tri- Tri- Tri- Stated Stated Stated In all the discussion that follows, we will be using one-shot imaging. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 4 of 52...
  • Page 5: Image Acquisition

    Operation with the BASIC Stamp This section explains how to use the TSL1401-DB directly with a BASIC Stamp. If you have the MoBoStamp-pe BASIC Stamp 2pe motherboard, you can skip this section and proceed to the section titled “Operation with the MoBoStamp-pe”.
  • Page 6 The following PBASIC code fragment (taken from the complete program template shown later in this section) can be used to read a single scan from the TSL1401-DB. It consists of five lines of code, which are shown and discussed individually: SHIFTOUT SI, CLK, 0, [1\1] SI and CLK are defined in the larger program’s preamble as PINs and connect to like-named ports on...
  • Page 7: Image Analysis

    IF (pixels(lptr) = which) THEN RETURN ' Return on match. NEXT ELSE FOR rptr = rptr TO lptr Loop backward. IF (pixels(rptr) = which) THEN RETURN ' Return on match. NEXT ENDIF ENDIF © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 7 of 52...
  • Page 8 ' -----[ Program Description ]--------------------------------------------- ' This program demonstrates image capture and processing using the ' TSL1401-DB (Parallax p/n 28317). It continuously acquires and displays ' images from the TSL1401R sensor chip. It then locates both left and right © Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
  • Page 9 " Extent = ", DEC rptr - lptr + 1, CLREOL '... and extent of object. ELSE 'No: Display failure message. DEBUG CR, CR, "No object found.", CLREOL ENDIF © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 9 of 52...
  • Page 10 = 1 - which 'Look for opposite kind of pixel first. GOSUB FindPix which = 1 - which 'Then look for desired pixel, by falling through to FindPix. ' -----[ FindPix ]--------------------------------------------------------- © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 10 of 52...
  • Page 11 Here’s the code snippet that does it. It can be plugged into the main code template shown above: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 11 of 52...
  • Page 12 Proper lighting techniques encompass an entire subject area of their own. The last chapter of this document links to various resources on the internet that cover this important topic. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 12 of 52...
  • Page 13 TSL1401-DB into its socket. TSL1401-DB Monitor Program There is a Windows PC host program that will let you see what the TSL1401-DB sees in real time. It’s called “TSL1401_monitor.exe”, and it can be downloaded for free from the Parallax website. Just copy it to the directory of your choice.
  • Page 14 Lighting Controls: When used with the forthcoming StrobeLED-DBM, which plugs into the 6-pin • mezzanine socket, these controls adjust the type and timing of the light output from the LED. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 14 of 52...
  • Page 15 – and most repeatable – results. Backlit Comb in Focus Backlit Comb Out of Focus © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 15 of 52...
  • Page 16 128 grayscale pixels output from the TSL1401R. The firmware accomplishes sub- pixel resolution during image acquisition time by interpolating a virtual pixel between every pair of actual pixels, as shown below: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 16 of 52...
  • Page 17 This can be handy for thresholding subjects whose illumination is uneven. It also allows the detection of extreme edges, while ignoring gently rising or falling light levels. The screen shots below illustrate this: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 17 of 52...
  • Page 18 Another application of floating thresholds is in “texture” detection. Texture is a characteristic associated with rapidly alternating pixel values. The seeds and herbs on a bagel represent texture, for example. In © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 18 of 52...
  • Page 19 Notice how the green “one” pixels capture the texture of the coated bagel, and even the fact that the right side of that bagel has more stuff on it than the left side. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 19 of 52...
  • Page 20 This is what it will see. To the right of this image is a rotated scope display, showing what the TSL1401-DB sees. (Lighter is to the left; darker, to the right.) © Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
  • Page 21 Using a telephoto lens and backing off from the subject to narrow the “capture angle” (possible • with the TSL1401-DB, but requires a different lens). Using lighting that’s brighter near the image edges than at the center (possible, but sometimes •...
  • Page 22 In the next pair of images, you can see the difference between a full bottle and one that’s not so full. To find the liquid level we use the “First Dark Object Location” measurement: Full Bottle Not-so-full Bottle © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 22 of 52...
  • Page 23 In the next pair of images, you can see the difference between a bottle that’s capped and one that’s not. Here we use the “Last Dark Object Area” measurement: Capped Bottle Uncapped Bottle © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 23 of 52...
  • Page 24 In all the examples that follow, we shall use these predefined constants, instead of their numerical equivalents, just to keep things as readable as possible. You will also want to use the code template (downloadable from Parallax’s TSL1401-DB product page) to make writing – and reading – your programs easier.
  • Page 25 When a triggered acquisition is awaiting the trigger pulse. • In the former case, just complete the not-busy polling before resetting the firmware. The latter case is discussed in the section, “Acquiring an Image”. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 25 of 52...
  • Page 26: Reading Data

    DUMPFLAGS command to see what the error was. Here’s the code that performs the aforementioned tasks: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 26 of 52...
  • Page 27 When a binary image is acquired, each pixel is first read from the AVR’s A/D converter as a value between 0 and 255. Then it’s converted to a 0 or a 1, depending on the values of the three coefficients © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 27 of 52...
  • Page 28 These are the Threshold, the Hysteresis, and the Mode. These coefficients are the same as described above in the “TSL1401-DB Monitor Program” section. The sequence of bytes required by the Set Binary Coefficients command is: SETBIN, Threshold, Hysteresis, Mode Where SETBIN is a constant having the value $EC (mnemonic “enter coefficients”).
  • Page 29 TIME is a constant defined in the code template that equals $80. In its place, the constant INTEN may be used. It’s equal to zero and does nothing, but it makes the code more readable. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 29 of 52...
  • Page 30 Stamp pin P3, then begin its exposure. Since P3 is common to both daughterboard sockets, this same pin triggers the TSL1401-DB in either one. This enables exposures to be synchronized precisely with an external event, such as an encoder pulse or optosensor output.
  • Page 31 But it illustrates quite graphically what happens if they’re read out to slowly. Also, bear in mind that this effect can only occur with ACQGRAY and not with any of the binary acquisition commands. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 31 of 52...
  • Page 32 They do not appear when an imaging lens is in place. Intensity plot resulting from even illumination and a very slow readout. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 32 of 52...
  • Page 33 Here’s a program snippet that uses ACQGRAY and outputs the pixel data at 38400 baud to the DEBUG port. It’s identical to that used by the TSL1401-DB Monitor Program: pixno VAR Byte char VAR Byte(16) OWOUT owio, 0, [ACQGRAY] GOSUB Ready...
  • Page 34 Once this sequence of code has executed, remember, the results buffer pointer is reset to RESULTS ($20), and the next result computed will be buffered there. This is due to the reset sent at the end of the OWIN statement. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 34 of 52...
  • Page 35 The commands that do all this are FNDNEW and FNDNXT: FNDNEW|Modifiers, Begin, End FNDNXT|Modifiers © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 35 of 52...
  • Page 36 32 and 64, scanning from left to right. Here’s the code that does it: OWOUT owio, 0, [FNDNEW|FWD|DRKPIX, 32, 64] GOSUB Ready © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 36 of 52...
  • Page 37 FNDNXT for the second, leaving off the Begin and End locations. Second, since we’ve chained two commands in a row, after the ACQBIN, our results will be • found sequentially, beginning at location RESULTS + 5. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 37 of 52...
  • Page 38 Of course, all this assumes that we’re looking at the largest part of the bagel, which would be a real coincidence. In a subsequent section, we’ll see how to parlay this into an application that inspects bagels moving past on a conveyor and that finds their actual diameters. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 38 of 52...
  • Page 39 ACQBIN executed. How many bytes did we actually buffer, anyway? In the first line, there are three: the “<” doesn’t get buffered. In the second line there © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 39 of 52...
  • Page 40 DEBUG "Bagel diameter: ", DEC max_dia, CR max_dia = 0 ENDIF LOOP Line numbers have been added to the left of the actual program so we can discuss each line here: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 40 of 52...
  • Page 41 So, if we measure the overall width of each bagel every quarter of an inch of travel and accumulate the sum of those widths, we will have measured its area once it has passed. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 41 of 52...
  • Page 42 2. The cap is detected, and it has a size of at least 36 pixels. 3. The top of the cap is no higher than pixel 205 (i.e. it’s pushed on all the way). © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 42 of 52...
  • Page 43 Unlike the prior program, which relies on a falling edge on P3 to trigger a new scan, this one operates more in demo mode, in that the trigger comes from tapping the spacebar in the DEBUG window. Here’s a blow-by-blow description: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 43 of 52...
  • Page 44 Test to make sure all the observed locations and sizes meet the specs. 30, 32 Print pass/fail. 34, 35 Print the observed data. Here is what the output looks like: © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 44 of 52...
  • Page 45: Automatic Exposure

    In situations where brightness can vary faster than simple incrementing or decrementing can compensate for, it may be necessary to adjust by an amount proportional to the © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 45 of 52...
  • Page 46 PBASIC Code Template Here is the code template, TSL1401_template.bpe, which defines all the constants and subroutines used by the examples above. You can also download it from the Parallax website to use with these examples and with your own programs.
  • Page 47 'Attempt to buffer unbufferable command. CMDOVF 'Command buffer overflow. DATOVF 'Result data buffer overflow. ' -----[ Variables ]------------------------------------------------------- flags Byte busy ' -----[ Initialization ]-------------------------------------------------- PAUSE 10 'Wait for AVR to finish reset. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 47 of 52...
  • Page 48 OWIN owio, 0, [flags] IF (flags = $FF) THEN 'If $FF, driver is waiting for a reset. OWOUT owio, 1, [DUMPFLAGS] 'So reset and try again. OWIN owio, 0, [flags] ENDIF RETURN © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 48 of 52...
  • Page 49 It cannot be used in immediate mode. The number of results produced by a buffered sequence depends on the commands in the buffer and will be the sum of what the individual commands produce. © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 49 of 52...
  • Page 50 Melles Griot: http://www.mellesgriot.com/products/machinevision/lif_1.htm • Advanced Illumination: • http://advill.com/uploads/downloads/A%20Practical%20Guide%20to%20Machine%20Vision%20 Lighting.pdf Edmund Scientific: http://www.edmundoptics.com/techSupport/DisplayArticle.cfm?articleid=264 • Vision & Sensors Magazine: • http://www.visionsensorsmag.com/CDA/Articles/Cover_Story/BNP_GUID_9-5- 2006_A_10000000000000097315 Schematic TSL1401R-LF 330R 0.1 F 74LVC1G14 10 F 4.7K © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 50 of 52...
  • Page 51 Driver firmware..........13 MoBoStamp-pe ..1, 3, 5, 13, 16, 24, 30, 45, 46 DRKEDG ..34, 35, 36, 37, 38, 39, 43, 47, 49 DRKPIX ....... 34, 35, 36, 47, 49 © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 51 of 52...
  • Page 52 RESULTS 25, 27, 34, 35, 37, 38, 39, 40, 41, 42, 43, 47 Window thresholding....... 17, 28 Schematic.............50 SETBIN .. 28, 29, 31, 37, 38, 39, 40, 42, 43, 46, XTRIG ........30, 31, 42, 47, 49 © Bueno Systems, Inc. • TSL1401-DB (2009.10.01) Page 52 of 52...
  • Page 53 Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Parallax 28317...