Hello,
I have wired up a TRCT5000 photoelectric sensor to an Arduino nano.
I have pulled out the two diodes of the sensor board and placed them in a casing facing each other with about 10mm gap between them.
While the sensor diode is receiving IR-light nothing should happen, when the IR-signal gets interrupted an LED strip should flash once for 40ms.
So far it is working quite fine, if I for example move a pencil quite fast through the gap between the diodes the LEDs flash like they should.
But for the actual application the photoelectric sensor should detect a 6mm diameter sphere moving about 90m/s, which is not working. I already tried maxing out the baud rate (see code below), which made me able to detect the 6mm sphere falling through the sensor.
Is this configuration actually able to detect such a fast moving object or do I need other components?
Thank you very much
const int pinIRd = 8;
const int pinIRa = A0;
const int pinLED = 9;
int Trigger = 1;
int IRvalueA = 0;
int IRvalueD = 0;
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define LED_PIN 4
#define LED_COUNT 15
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(1000000);
pinMode(pinIRd,INPUT);
pinMode(pinIRa,INPUT);
pinMode(pinLED,OUTPUT);
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
strip.begin();
strip.show();
strip.setBrightness(255);
}
void loop() {
IRvalueA = analogRead(pinIRa);
IRvalueD = digitalRead(pinIRd);
if ((IRvalueA > 30) && (Trigger == 1)){ //IRvaluaA output ~25 in idle
//Turn on
for (int i=0; i <= LED_COUNT ; i++){
strip.setPixelColor(i,255,120,0);}
strip.show();
//Duration on
delay(40);
//Turn off
for (int i=0; i <= LED_COUNT ; i++){
strip.setPixelColor(i,0,0,0);}
strip.show();
Trigger = 0;
//delay(700);
}
if (IRvalueA < 30){
Trigger = 1;
}
}