Interfacing Arduino Uno with CMOS driver

Hello,

I am attempting to use an Arduino with a CMOS driver circuit. The circuit controls a linear image sensor. The driver circuit requires a Start Signal, 5V supply, and a square wave 50% duty cycle Clock Signal. The setup I have on the Arduino is a Start Signal leaving digital pin 2 and a Clock signal of 8.192kHz from the DS3231 Chronodot.

I have the Arduino feeding the Circuit 5V also, from the 5V pin. What’s supposed to happen is the Clock signal and Start signal are sent into the driver circuit. Both should be high at the same time. This initiates the driver circuit to scan its accompanying linear area (composed of 512 pixels). Each successive Clock signal dictates the timing of the output video signal from the Driver circuit. The driver circuit also outputs a trigger signal that is high when the clock signal is high. The driver circuit details can be found here:

http://www.hamamatsu.com/resources/pdf/ssd/c9001_kacc1079e.pdf

The chronodot details can be found here:

My issue is with understanding why I don’t see any meaningful data from the output video signal. If I graph the output Video Signal after running my code I get something that looks like a sine wave around 4.95V. I suspect the Driver circuit isn’t being started or triggered by the clock and start signal at the beginning, so that nothing is really happening in the circuit. In my code I use timer1 and set it to 4x the frequency of the clock signal and use it to read the video signal. Another possible issue is maybe the Clock signal and Start signal is triggering the Driver Circuit to begin its operation but my code is not fast enough to read the Video signal coming out. My code is attached. Thank you for your help!

#include <Wire.h>

// Define various ADC prescaler
const unsigned char PS_16 = (1 << ADPS2);
const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

void setup() {

Wire.begin();

//Begin Serial transmission
Serial.begin(115200);
Serial.flush();

// set up the ADC
ADCSRA &= ~PS_128;  // remove bits set by Arduino library

// you can choose a prescaler from above.
// PS_16, PS_32, PS_64 or PS_128
ADCSRA |= PS_16;    // set our own prescaler to 64

//initialize startPin
pinMode(2, OUTPUT);

//Assert Default setting:
analogReference(DEFAULT);

// Set all IO pins low:
for( int i=0; i< 14; i++ ) {
      digitalWrite(i, LOW);  
  }
//cli();  
startScan();

 //set timer1 interrupt at 32kHz
  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0
  // set compare match register for 1hz increments
  OCR1A = 487;// = (16*10^6) / (1*1024) - 1 (must be <65536)
  // turn on CTC mode
  TCCR1B |= (1 << WGM12);
  // Set CS10 bit for 1 prescaler
  TCCR1B |= (1 << CS10);  
  // enable timer compare interrupt
  TIMSK1 |= (1 << OCIE1A);


// enable global interrupts:
sei();
}

void startScan(){

  Serial.println("---START SCAN---");
  Wire.beginTransmission(0x68); // address DS3231
  Wire.write(0x0e); // select register
  Wire.write(0b01011000); // write register bitmap, bit 6 is SQUARE WAVE
  //bit four and 5 initiate clock speed of 8.192kHz
  Wire.endTransmission();
  //output a constant start signal, hold for 122070 ns, then stop
  //long enough to initiate scan (1/8192 = 122070ns)
  PORTD |= _BV(2);
  delayMicroseconds(122);
  PORTD &= ~_BV(2); 
 
}

ISR(TIMER1_COMPA_vect) {
  printStuff();
  }

void printStuff(){
  //read video signal and send to serial
  Serial.println(analogRead(A0));
  }

void loop(){}

speclink.ino (1.91 KB)

:confused: I don't understand any of that....

Do you have an image sensor and some kind of optics for the image sensor driver?

What kind of video signal is that? Is it supposed to be NTSC or PAL composite video? Something else?

What's the Arduino supposed to be doing?

Hi DVDdoug,

Yes, there is an image sensor: Hamamatsu S8378-512Q and here is a link if you want to see it:

http://www.hamamatsu.com/resources/pdf/ssd/s8377-128q_etc_kmpd1066e.pdf

I'm no expert on the video signals, but what I've been told is that the image sensor sees light on each of its pixels and the driver scans each of these pixels and outputs a voltage (which is the video signal) based on the intensity of light at each pixel. I don't know why it is shaped the way it is on the data sheet. But on the data sheet it says the video output signal is positive polarity. I've been told the signal is just a voltage that depends on the intensity of light on the pixels.

The Arduino's job for this project is to drive the Driver Circuit and provide a clock for the circuit. The circuit then scans the pixels and sends a trigger signal as each pixel is scanned. It also sends a video signal (voltage) after each pixel is scanned. That video signal comes back to the Arduino and I read it at the A0 pin.

Let me know if you'd like me to explain anything else. Thank you for replying

That video signal comes back to the Arduino and I read it at the A0 pin.

Which won't work.

Mark

Hi Mark,

What is the reason it won't work? Is it the shape of the signal or the speed of the Arduino? I'm still trying to get the hang of this.

For a 16 MHz Arduino the ADC clock is set to 16 MHz/128 = 125 KHz. Each conversion in AVR takes 13 ADC clocks so 125 KHz /13 = 9615 Hz.

That is the maximum possible sampling rate, but the actual sampling rate in your application depends on the interval between successive conversions calls. Since you read the result and send it through the serial port, you are getting a delay that increases as the baud rate decreases. The lower the baud rate the longer it will take to send the same length of data and the longer it will take to call the next ADC conversion.

The actual sampling rate in your application can be determined with the use of a debugger or a simulator, but an easier solution is to toggle a digital pin every time you execute a conversion and measure the frequency that the digital pin toggles at.

Hi,
Have you got the gnd of the arduino connected to the gnd of the circuit you are sending and receiving to?

Tom… :slight_smile:

Hi BillHo, thats a good idea. I will try that. I figured setting the adc prescaler to 16 would help increase the sampling frequency enough but i guess i should be sure of that first.

Hi TomGeorge,

Just to clarify, the output video signal has a ground with it. The driver also has two ther ground connections, all of which i have grounded to the Arduino using the GND pins. Is this what you are referring to by connecting the gnd of the arduino to the ground of the circuit?

Thanks again for everyones help!!