I’m attempting to control a linear CCD sensor using an Arduino Uno. The sensor is a Sony ILX511. The datasheet can be found here: (http://www.oceanoptics.com/technical/detectorsonyILX511.pdf). The sensor requires a clock pulse and a gate pulse. If I understand correctly from the datasheet, the gate pulse is HIGH (5V) while the clock pulse creates square waves to tell the sensor to shift along the pixels in the array. When the gate pulse goes from HIGH to LOW and back to HIGH it tells the sensor to restart. I’ve finally come out with code that will create the proper pulses, with clock pulses having a 50% duty cycle. I’ve tested the pulses by plotting in Labview and watching LEDs light up. There is no maximum time in between clock pulses, so I’ve tried running the code at slow paces and at fast paces and still come out with the same problem. The problem is that the sensor does not shift pixels in the array, and instead it remains on the first pixel. I’m able to see this because output voltages only change when I shine light on the first pixel.
So, has anyone had any experience with running a CCD sensor with the arduino? I don’t see why it wouldn’t be possible because the datasheet states that there are no maximum times in between clock pulses. I’ve wired up the sensor exactly how the datasheet shows on page 10. Any advice would be great.
I also suspected that voltage output by the arduino might be the case, so I tried with a 9V battery connected to the arduino and still the same problem.
Here is my code:
int CLKPin = 3;
int ROGPin = 5;
float pulsetimer = 0;
float counter = 0;
void setup() {
DDRD = B00101000; //Pins 3 and 5 as outputs
Serial.begin(115200);
}
void loop() {
pulsetimer = pulsetimer + 1;
counter = counter + 1;
Pulses();
pulseRead();
delay(15);
}
void pulseRead() {
static float timer; //currently not used
long PhotoRead;
timer = (timer + 1); //currently not used
PhotoRead = analogRead(0);
//Serial.print("YELLOW = ");
Serial.println(PhotoRead);
//Serial.print(",");
//Serial.print("RED = ");
//Serial.print(redRead);
//Serial.print(",");
//Serial.print("Time = ");
//Serial.print(timer);
//Serial.print(",");
//Serial.print("Pulsetimer = ");
//Serial.println(pulsetimer);
//Serial.print(",");
//Serial.print("Counter = ");
//Serial.print(counter);
//Serial.print(",");
//Serial.flush();
}
void Pulses() {
int CLKState;
CLKState = digitalRead(CLKPin);
if(pulsetimer <= 30) {
PORTD = B00001000; //ROG - Low, CLK - High
counter = 0;
}
else if(pulsetimer > 30 && pulsetimer < 35) {
PORTD = B00101000; //ROG - High, CLK - High
counter = 0;
}
else if(pulsetimer >= 35 && pulsetimer <= 12563) {
if(counter == 3) { //Change CLK state every 3 iterations
if(CLKState == HIGH) { //If CLK = HIGH set to low
//and vice versa
PORTD = B00100000; //ROG - High, CLK - Low
counter = 0;
}
else {
PORTD = B00101000; //ROG - High, CLK - High
counter = 0;
}
}
}
else if (pulsetimer > 12563 && pulsetimer < 12568) {
PORTD = B00101000; //ROG - High, CLK - High
}
else if(pulsetimer == 12568) {
pulsetimer = 0; //Restart
PORTD = B00101000; //ROG - High, CLK - High
counter = -1;
}
}
Pulses_with_delay__.ino (1.6 KB)