im new to arduino but im already used to programming in C++ and Visual Basic.
Im working with a X-Ray PIN diode detector in a synchrotron radiation laboratory.
I can read the X-Ray intensity thru the Fout plug, which is a TTL signal with frequency that ranges from 0-500kHz (That is proportional to the photon flux on the diode). I have a arduino UNO R3 board.
I want the arduino board to make an average of the TTL frequency over 1/10 second and write the information on the serial.
I have read here that the maximum sampling rate of arduino UNO is about 125kHz, which is way below the 500kHz cap frequency of the detector.
anyone know if this is true? can i read the 500kHz signal with arduino uno?
sorry for bad english hehe =] thank you for your attention.
I have read here that the maximum sampling rate of arduino UNO is about 125kHz
That is for ADC - as you work with TTL signal you do not need the ADC to consider - just measure the frequency of that TTL signal..
but im avoiding using other hardware than arduino. i tried connecting the TTL source to arduino with a simple code, but it started failing with frequencies higher than 1kHz.
i used a similar code to this one (this one has a bug, but the one i used was working fine <1kHz)
int pino = 13;
int t0;
int tf;
int delta;
int counter;
int TTL = HIGH;
float freq;
void setup() {
Serial.begin(9600);
pinMode(pino,INPUT);
}
void loop() {
t0 = millis();
TTL = digitalRead(pino);
while ((millis()-t0) > delta) {
if (digitalRead(pino) != TTL){
if (TTL == HIGH){TTL = LOW;}
else {TTL = HIGH;}
counter = counter + 1;
}
}
freq = counter/(2*(delta / 1000));
Serial.println(freq);
}
im wondering about using a few flip-flops to reduce the output frequency.