Pages: [1] 2   Go Down
Author Topic: Using a Sony ILX751A Linear CCD with any arduino.  (Read 4291 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone. I have a project I have been tinkering with and it seems to be over my head. I have purchased a couple Sony ILX751A linear CCD sensors and need to gather data from them. This is for a graduate class grade and my ability to make this work effects everyone in the class's grade. We will start with the datasheet - http://www.datasheetcatalog.org/datasheet/sony/a6802498.pdf

I understand that this chip needs a main clock pulse and a ROG clock pulse. I also understand that there is a shutter option that can be implemented that will also need a pulse if I decide to use it. My concern is mainly getting the CLK and ROG clock pulses lined up correctly. I've looked at other CCD forum posts, but due to the differences in design, those posts didn't help me much. My experience with programing and Arduino is not quite at the level it should be for a project like this. Any pointing in the right direction would be greatly appreciated.

Concerning which arduino I am using, I have a nano, duemilanove, and an ethernet type arduino. This is for a class and is funded. If I need to purchase the Mega, the money is available. 
Logged

0
Online Online
Shannon Member
****
Karma: 207
Posts: 12196
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What are you going to do with 2048 analog samples?  You'll need enough RAM if you intend storing them all
which might imply a Mega - you might want to configure the ADC to run faster too.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Would it be possible to use an SD card shield to act as RAM? I have also considered possibly reading every other pixel ?
Logged

0
Online Online
Shannon Member
****
Karma: 207
Posts: 12196
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

or summing pairs of pixels - primitive spatial low pass filtering.

Since the speed is limited by the analog reads I suspect simply driving CLK and ROG pins via digitalWrite would
be fast enough - but read that datasheet carefully.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok thanks! I should have some code put together by the end of the day and I will post it here.
Logged

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

i have a ILX551A on order (any day now) looks like a 751 without the shutter function
my experiments withthe upd3799cy are at a stand still (though i belive i know the problem & will revisit it ..)
i am using a Due & have some complications that you do not have (3.3v outputs & Adc input )
though i do have more memory to play with ...
i'll publish some code when its up & running ...


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahhh. That would save my life. I am in way over my head. I just don't know where to start. Well, I kinda do. Here is a simple question. The chip runs max at 5mhz. That is 20 nanoseconds right? Does that mean my clock pulse should be something like 20 nanoseconds (with a 50% duty cycle) ? Is that what that means? I understand the timing as far as the nanoseconds between when ROG comes on and then CLK comes on and then ROG cuts off then CLK starts its timing stuffs. It is all given in the datasheet in exact nanoseconds. So to program that I'm just going to use the delay function and write stuff HIGH and LOW. But the actual clock pulse that happens after. How fast is that? Do I choose that? Does it have to be relative to the ROG pulse time? You guys are helping a lot and I really appreciate it.
Logged

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

200ns not 20ns

no way will you will beable to collect full data at full speed of the sensor
your max conversion is 13μs  (from the data sheet of the Mega)
& likely longer (set up & etc)

you could  decimate & get only 31 samples at full sensor speed (must use the built in sample & hold)
better to slow the sensor to the same speed as the sampling ....

the DUE has a max conversion speed of 1us / sample  & i expect to run at about 1/2 that
(full sensor read taking 2048*2us+overhead ~= 200sensor readings a second )



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, I'm learning a lot from this one little project. Would it be easier in my case (not using a Due) to build a analog to digital converter then have the arduino read the digital data? Also, the only information I need from the camera is pixel number and Intensity of light. Is there a way to skip the unneeded data prior to the analog to digital conversion?
Logged

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

a fast external converter would be possible - not easy but possible
even if you got the data at full speed can you work with it (see below)

you can skip the early parts of the data - either by tossing it out (sampling & over writing) or delay first sampiling  till the ~first valid bits are available

do you have to run at MAX speed?

other things ( at full speed ) to worry about
 MEGA runs at 16 Mhz (62.5ns) this means if you had to run the sensor at full speed (5Mhz / 200ns) you MIGHT beable to fit 3 risc instructions in the time between samples - i haven't looked at the chips instructions but even if you wrote a super tight loop in asm(NOT C/C++) i'm guessing you would need  5-10 cycles (to read /save data / test if done ) no irqs, no timers

(the above is why i'm using a Due)

and a problem that i'm fussing about - do you know (i don't) when is the exposure time for the chip ? it likely needs 1-100ms to collect data (enough photons to make a image) - do these chips double buffer the data (so you have the 1-100ms to pull the data)  or can you only run one line at a time ...
aaaghhh...

Logged

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

follow up :
i've just had 'limited' success in driving the ILX551A ,
very little change programming change from the other chip (upd3799cy)
& i save myself two pins

no data collection as yet but i can see the output change on the scope
whoo hooo !!

it requires VERY little light (i'm up to 200lines per sec ) & still get resonable responce in a medium dark room on a cloudy day ...
& it appears as the native output is close to max 3.5 volts -- so if i clamp it i may beable to feed the arduino direcly (probably have to buffer it but makes life easier ..... )
have to wait till monday  to get sockets , clamping diodes , & assorted other things ... 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh great! Congrats! I haven't had much time to look at things with Mid-terms blowing things up. The exposure time was a big question mark for me. I thought it was cause I am such a noob at this. Here is another noob question.

what does the data actually look like? I have a friend working on the Gui for this project and he would like to make a csv document for our Gui to open and make a simulation of what things will look like so he can further debug. There is no information on the data sheet about what this stuff looks like. I imagine its intensity and wavelength or color.

I attempted to write code for this the other day and failed miserably. I don't know if it's because I don't know what I am doing, or if it is something simple like I started in the wrong part of the clocking sequence. I'm hunting for backup plans on this project just in case.
Logged

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

these Sony devices have a very simple clocking stucture to follow (as opposed to the National part i was mucking with)

there are really only the 3 steps
pulse low on ROG (once)
pulse on CLK , sample  the data  - repeat 2087 times ....
pause (! found the comment in the data sheet - integreation time is 10ms ! )
and repeat ....
use a scope to check that you have the correct polarities ...

not sure about the MEGA but it appears that you should beable to use the transistor buffer shown in the data sheet so easy to connect ( need clamp diodes for the DUE)
data will look like a stream of 10 bit numbers .... relative to the total amount of light .... 
with junk data at the begining & at the end 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi RalphNev,

I have an arduino due and I'm about to order a Sony ILX751A Linear CCD, I want to put together what you did. I'm really interested in how your project went. Did it work nicely and is it possible to send a diagram, pictures, code  etc. of your setup?

Any help would be great even a quick message for now saying how it went would be really nice.

Thank you, Dav.
« Last Edit: April 21, 2013, 09:28:00 am by davpc » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
I like to play with Arduino on the side and sometimes have questions so I come here. Watching the Arduino community grow has been a wonderful experience.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Exam week is here and I finally had to get my butt on the ball to finish this. here are the two codes. one is arduino the other is processing. I can't test this yet because I haven't built the CCD circuit yet. Any tips or suggestions would be great!

Code:

int vout = 26; // sample this pin to get image data
int shsw = 5;  // sample hold. GND cuts on vdd2 cuts off
int clk = 6;   // clock timer pin. controls the timing.
int vdd2 = 7;  // camera needs 5volts supplied to vdd2 to function
int shut = 8;  // shutter function. for use, leave high then 1ms prior to sampling, drop voltage to ground for 1mn then back up to high.
int rog = 9; // pulse rog low once to start sequence
int sample =
0; // this will be used as a serial data output of the samples.
 
 
void setup()
{
  Serial.begin(9600); // start serial. Is baud rate correct?
  pinMode (vout,INPUT); // reads data from ccd to give us samples inbetween clock pulses
  pinMode (shsw,OUTPUT);// some of these pin's functions are optional.
  pinMode (clk,OUTPUT);
  pinMode (vdd2,OUTPUT);
  pinMode (shut,OUTPUT);
  pinMode (rog,OUTPUT);
 
   
}
void loop() 
{
  //clk initialization
    Serial.println("start"); // just for kicks
    digitalWrite(clk,HIGH);  // these next few steps starts the clk, this must be done each time prior to a 2087 cycle
    digitalWrite(rog,HIGH);
    delayMicroseconds(1);
    digitalWrite(rog,LOW);
    delayMicroseconds(1.01);
    digitalWrite(rog,HIGH);
    delayMicroseconds(1);
        for(int i = 0; i < 2087; i++ )
      {
        digitalWrite(clk,LOW); // the 2087 cycle begins here.
        delayMicroseconds(1);
        digitalWrite(clk,HIGH);
        sample = analogRead(vout); // output the ccd's data into a serial sample that can then be read by a processing programing and written to a file
        Serial.println(sample);    // ^^^^^^^^^^^
        delayMicroseconds(1);
   
      }
 
 
}

here is the processing code

Code:
import processing.serial.*;
Serial mySerial; // start a serial called mySerial
PrintWriter output; // calls the writer output
void setup()
{
  mySerial = new Serial( this, Serial.list() [0], 9600);// sets up mySerial
output = createWriter( "SampleData.txt" ); // sets output to a txt file
}

void draw()
{
  if (mySerial.available() > 0 ) //check is serial data is there
  {
    String value = mySerial.readString();
    if (value != null) // if null then something is broke. otherwise...
     {
      output.println( value );// print the serial to output which uses createWriter to place into a new txt file.
      }
    }
}
Logged

Pages: [1] 2   Go Up
Jump to: