NEW PRODUCT: TSL1401-DB Linescan Imaging Sensor

12346»

Comments

  • rahiljrahilj Posts: 4
    edited March 2014 Vote Up0Vote Down
    Hi Phil and other active members of this thread,

    Thanks for your continued support on this forum. This is a valuable resource.

    I am trying to use the linescan sensor with a mobostamp-pe motherboard for deflection measurement of a thin backlit membrane. I wish to acquire a grayscale image at rate of 1k samples/sec. I believe this should be possible according to the TSL1401 datasheet. I have most of the optics figured out, however, I am new to programming in pbasic and having a difficult time ramping up. Specifically, I am having trouble outputing the analog pixel data to an available PWM output. If this is not advisable, I wish to import the raw pixel data into my pbasic program and saving it for later analysis as a csv file. I don't intend to capitalize the image processing abilities of the AVR and I understand that I can't becuase the analog data has to be exported out on the fly.
    I hope to get started with a code snippet that I can integrate with the template provided on the parallax website. I am currently using the program listed on Pg 33 of the manual.

    If there is any obvious flaw in my plan, please do not hesitate to point out. Thanks again for you support and help.

    Rahil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    Rahil,

    Your plan should work okay, except for the 1K 128-pixel frames/sec if you're using serial output. Just outputting the pixel data as raw 8-bit bytes would require a rate of 1000 * 128 * 11 = 1.4Mbaud -- far above what the BASIC Stamp can do.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • rahiljrahilj Posts: 4
    edited March 2014 Vote Up0Vote Down
    Thanks Phil for the prompt reply.
    I was afraid of that. Ok, I can use the Stamp to provide only the clock and SI signals. I understand this is an overkill, but boards like these are more expensive. I can feed the analog output from the parallax daughterboard into a high speed DAQ for post processing. The limitation is that the system cannot be synchronized, which is ok for now.
    I was playing with this setup and was using the monitor program to control the linescan daughterboard. I can change the integration time but not the frame rate, which is only ~5Hz. Do you know, what's the clock frequency that's being used in the monitor program and how can I change it?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    Rahij,

    Instead of using the MoBo, you could use the Propeller Backpack. It has DUTY-mode DAC capabilities built-in, along with sigma-delta ADC for reading the TSL1401's output. (BTW, the TSL1401 board plugs into the Backpack, the same as with the MoBo.)

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • rahiljrahilj Posts: 4
    edited March 2014 Vote Up0Vote Down
    Thanks Phil. I will look into it.
    I may be too much to ask, but do you have a sample program for the propeller with the daughterboard plugged-in to get me started.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    Rahil,

    Attached is a Backpack program that drives the TSL1401-DB plugged into it, writes the pixels to a 128-byte buffer, and scans the buffer, outputting a sync signal and a DUTY-mode DAC signal on the 2.5mm stereo phone jack. Here's a scope trace of what the outputs look like:

    attachment.php?attachmentid=107336&d=1393968728

    Since the DAC output is done in Spin, it's slower than, and asynchronous to, the sensor scan. Also, the driver program does not do continuous scanning; rather, it does a scan at the prescribed exposure time, then outputs the result of that scan.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • rahiljrahilj Posts: 4
    edited March 2014 Vote Up0Vote Down
    Thank you so much Phil. This is very helpful. I appreciate your support.
    I have yet to read and understand the backpack program. I have already ordered one. I hope it will be alright if I ask more questions.
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    Sorry, but which program i have to use to upload this program to my MoBoStamp-pe, i have already downloaded LoadAVR.exe bau it doesn't work.......
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    The program provided in post #157 above will not run on the MoBoStamp-pe; it's for the Backpack only.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    20140312_100652.jpg
    20140312_100707.jpg
    20140312_100715.jpg
    20140312_100740.jpg
    Immagine58.jpg



    These are some of my project photos, i have already said to you that in TSL1401_monitor_v1_4 i don't see clearly image as you, other problem is that i write your program post #14 but i didn't be able to upload your program in my MoBoStamp-pe, could you send me a video tutorial for doing that,
    and i want how can you have obtained the image ikn the post #5, please help me. Thank you.


    -Harjit......
    1024 x 768 - 77K
    1024 x 768 - 50K
    1024 x 768 - 61K
    1024 x 768 - 54K
    379 x 487 - 52K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    harji95 wrote:
    These are some of my project photos, i have already said to you that in TSL1401_monitor_v1_4 i don't see clearly image as you,
    Several things come to mind:
    1. The camera is oriented the wrong way. You want the linear array perpendicular to the direction of motion, not parallel to it, as you have.
    2. The image is saturating. That means you have either too much light or too long an exposure time.
    3. The lens looks like it's screwed in too far for the focal distance you've chosen.
    4. To resolve the kind of detail apparent in the text on that sheet of paper, you will probably need to be much closer. Remember, the TSL1401 has only 128 pixels.
    other problem is that i write your program post #14 but i didn't be able to upload your program in my MoBoStamp-pe
    That program is loaded into the MoBoStampo-pe automatically when you start the monitor program. You don't need to load it explicitly.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    Immagine5848965.jpg
    20140312_164429.jpg
    20140312_164446.jpg
    20140312_164456.jpg
    20140312_164528.jpg



    Ok but the camera that you have used in post#5 is the same to TSL1401-DB o is a different type....... anyhoe the image captured with my cam isn't clear as your.....
    1) Servo motor is neccessary.
    2) To my cam i have uploded the firmware that i download from parallax website.
    3)And i have used the LoadAVR.exe downloaded from parallax website, for upload to my moboset.
    4) But the result is the same.
    5)i followed all yours suggestions.
    533 x 619 - 65K
    1024 x 768 - 86K
    1024 x 768 - 74K
    1024 x 768 - 76K
    1024 x 768 - 67K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    It's the same. To get a clear image, you just need to follow the suggestions I outlined in the post above.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    Sorry Mr. Phil Have you see my post #163...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    Again, you've got the camera oriented the wrong way. It needs to be a right angles to what you have now. Also, if you note my post #5, I have the camera mounted on a servo so that it can scan the subject. Finally, you're way too far from the subject to resolve any detail.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    20140312_172726.jpg
    20140312_172737.jpg
    20140312_172746.jpg


    Now i have oriented in right way.....
    and which function has the center yellow line in the post #5 that you see with the TSLI1401-DB MONITOR.....
    1024 x 768 - 68K
    1024 x 768 - 60K
    1024 x 768 - 83K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    Look at the bottom row of settings of the monitor screen. When set that way, the yellow line will appear automatically.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    On my MoBoStamp-pe i have upload this code:
    ' ========================================================================='
    ' File...... tsl1401_template.bs2
    ' Purpose... Code template for the TSL1401-DB driver firmware.
    ' Author.... Parallax, Inc.
    ' E-mail.... support@parallax.com
    ' Started... 20 July 2007
    ' Updated...
    '
    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================




    '
    [ Program Description ]


    ' This is a blank template used for interacting with the TSL1401 driver
    ' firmware in the MoBoStamp-pe's AVR coprocessor.


    '
    [ I/O Definitions ]


    owio PIN 6 'Pin for OWIN and OWOUT to AVR coprocessor.


    '
    [ Constants ]


    ' Commands


    SETLED CON $EB 'Set LED strobe and brightness/time from next byte.


    'Flag to OR to brightness/time (0 - 127) value.


    TIME CON $80 'Set strobe: value (0 - 127) is 0 - 3.4mS at 100% on.
    INTEN CON $00 'Set intensity: value (0 - 127) is 0 - 49.6% on.


    SETBIN CON $EC 'Set threshold, hysteresis, and filter (3 bytes).


    'Filter flags.


    FLOAT CON $80 'Threshold is floating per filter value (0 - 7).
    FIXED CON $00 'Threshold is fixed.
    WINDOW CON $40 'Threshold is a window (outside of hysteresis band).
    LEVEL CON $00 'Threshold is a level with hysteresis.


    SETEXP CON $EE 'Set exposure to byte (1 - 255) following: 0.27 - 68mS.


    ACQGRAY CON $A0 'Acquire and dump a grayscale image.
    ACQBIN CON $A4 'Acquire a binary image.
    ACQAND CON $A1 'Acquire binary image ANDed w/ previous.
    ACQOR CON $A2 'Acquire binary image ORed w/ previous.
    ACQXOR CON $A3 'Acquire binary image XORed w/ previous.
    ACQANDNOT CON $A5 'Acquire binary image ANDed w/ NOT prev.
    ACQORNOT CON $A6 'Acquire binary image ORed w/ NOT prev.
    ACQXORNOT CON $A7 'Acquire binary image XORed w/ NOT prev.


    ACQDIFF CON $A3 'Idiom for ACQXOR.
    ACQSAME CON $A7 'Idiom for ACQXORNOT.


    XTRIG CON $08 'External trigger flag, ORed to ACQ commands.


    CNTNEW CON $C8 'Count pixels/edges between new bounds.
    CNTNXT CON $C0 'Count pixels/edges between current bounds.
    FNDNEW CON $F8 'Find first pixel/edge between new bounds.
    FNDNXT CON $F0 'Find first pixel/edge between current bounds.


    'Modifiers, ORed to CNTNEW, CNTNXT, FNDNEW, and FNDNXT.


    NXT CON $00 'Continue from where last CNT or FND left off.
    BKWD CON $04 'Search backward.
    FWD CON $00 'Search forward.
    DRKPIX CON $00 'Target is a dark pixel.
    BRTPIX CON $02 'Target is a bright pixel.
    DRKEDG CON $03 'Target is a bright-to-dark edge.
    BRTEDG CON $01 'Target is a dark-to-bright edge.


    DUMPADR CON $DA 'Dump data, beginning at addr, and until reset.


    'Address constants for single byte arg following DUMPADR.


    PIXELS CON $00 'Beginning of binary pixel buffer (32 bytes).
    RESULTS CON $20 'Beginning of results buffer.
    MINPIX CON $20 'Value of darkest pixel (0 - 255).
    MINLOC CON $21 'Location of darkest pixel (0 - 127).
    MAXPIX CON $22 'Value of brightest pixel (0 - 255).
    MAXLOC CON $23 'Location of brightest pixel (0 - 127).
    AVGPIX CON $24 'Average pixel value (0 - 255).


    DUMPID CON $DD 'Dump the firmware ID (returns 3 bytes).


    DUMPFLAGS CON $DF 'Dump error flags (returns 1 byte).


    'Bit positions in returned byte.


    BADCMD CON $80 'Unrecognized command.
    CANTBUF CON $40 'Attempt to buffer unbufferable command.
    CMDOVF CON $20 'Command buffer overflow.
    DATOVF CON $10 'Result data buffer overflow.


    '
    [ Variables ]


    flags VAR Byte
    busy VAR Bit


    '
    [ Initialization ]


    PAUSE 10 'Wait for AVR to finish reset.


    '
    [ Program Code ]


    ' Your program code goes here.


    END
    '
    [ Subroutines ]


    '
    [ Ready ]
    ' Wait for the driver to become not busy.


    Ready:
    DO
    OWIN owio, 4, [busy] 'Read busy bit.
    LOOP WHILE busy 'Keep checking until it goes low.
    RETURN


    '
    [ GetError ]
    ' Read the error flags from the driver.


    GetError:
    OWOUT owio, 0, [DUMPFLAGS] 'Read the error flags.
    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
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    harji95 wrote:
    On my MoBoStamp-pe i have upload this code:
    Okay. That program doesn't do anything; it's just a template. Did you see that part that reads,
    ' -----[ Program Code ]----------------------------------------------------
    
    
    [b][color=red]' Your program code goes here.[/color][/b]
    
    
    END
    

    For the program to do anything, you have to add your own PBASIC code.

    But before you do anything else, you really need to get a good image in the monitor, so you know what settings to use in your app.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    Okay Phil,
    I nedd to capture a good image, then i have to write a program code, right?
    Your code is that you have used in post #14, right?
    Now i haven't got a servo to move my TSL1401-DB, and i want to konw if without a servo, the experiment be successful......
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    The code in post #14 is what gets loaded to the MoBo when you start the monitor program. It may or may not be what you need for your app. (What is your app, BTW?)

    Without a servo or some other means to physcially scan either the camera or the subject, you will not obtain a full image, but just a one-line slice.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • harji95harji95 Posts: 8
    edited March 2014 Vote Up0Vote Down
    So, if i move my object instead TSL1401-DB, is same or not.........



    -HARJIT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,339
    edited March 2014 Vote Up0Vote Down
    It doesn't matter whether you scan the camera (and lighting) or move the subject. The result will be the same.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • josephpham1194josephpham1194 Posts: 3
    edited August 14 Vote Up0Vote Down
    Hi Phil and other members of this thread,

    I am trying using TSL1401-DB linescan camera module for object detection. I wish to acquire a grayscale image for the 1K 128-pixel frames/sec.
    Do you know, how can you solve that problem?
    Thank you so much for support and help.

    Joseph Pham
  • Joseph,

    Welcome to the forum!

    To achieve 1000 fps, you will need a clock speed of at least 128 kHz and an A/D converter that can sample and convert at that speed. I recommend a parallel-output converter to achieve that speed. Otherwise, with a serial-output converter, you would need a serial clock of more than 1 MHz.

    The other thing you will need is plenty of light, since your integration times will be 1 ms. or less.

    Good luck with your project! Can you divulge what it is you're looking at?

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Phil,

    Thank you very much for the prompt reply.
    I am a student, I am researching a project for my professor. He proposed to use TSL1401-DB linescan camera module and achieve 1000 frame/sec. I am studying your proposed information but I don't know what to start or what device to use to achieve that speed. I hope you can give more specific guidance or suggest the necessary device to do.
    Look forward to receiving your help and thank you very much.

    Joseph Pham
  • Joseph,

    Which microcontroller are you using to obtain and transmit the data?

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Phil,

    Currently, I am using Arduino Uno board but it did not achieve the same results at first. I am trying to find other microcontrollers to use to obtain and transmit the data.

    Joseph Pham
  • Phil,

    Currently, I am using Arduino Uno board but it did not achieve the same results at first. I am trying to find other microcontrollers to use to obtain and transmit the data.

    Joseph Pham

    Since this is a Parallax forum and they make the Propeller chip I would suggest using one of the Propeller boards. On top of being fast enough you will also benefit from having sample code from the OBEX and help from some very smart and experienced people on this forum.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Here's an ADC chip that should be able to handle your frame rate:

    https://www.digikey.com/product-detail/en/analog-devices-inc/AD7819YNZ/AD7819YNZ-ND/997013

    It's spec'd to 200 ksps and has a parallel 8-bit output.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
Sign In or Register to comment.