I can't change the sensor anymore. The parts of the rotary have been machined and it would be too expensive and there's no time to start from zero 
Using this code the backlight of my LCD showed properly if the sensor is above a hole or above the disc:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
#include <TMC2130Stepper.h>
//int stepdelay = 5;
int stepdelay = 14; // time between steps - defines speed max
int StepDuration = 10; // time high level is held to transmit signal properly
int ButtonUp = 37; // input buttons
int ButtonDown = 40;
int ButtonLeft = 36;
int ButtonRight = 35;
int ButtonSelect = 19;
unsigned long testSteps = 302450*10; // fast genau 1512000*2 // als: 302400
int VccLOAD = 22; // enables power for fan and stepper motor
int pwrSens12V = A0; // check is 12V is present. Voltagedevider on 12V
int pwr12value = 0;
int USBpwr = A7; // if high USB-PWR! Don't power up VccLOAD
#define EN_PIN 10 // Nano v3: 16 Mega: 38 //enable (CFG6)
#define DIR_PIN 7 // 19 55 //direction
#define STEP_PIN 6 // 18 54 //step
const int TMC_CF0 = 5; // TMC2130 CFG0, non-SPI-mode only
const int TMC_CF1 = 3; // TMC2130 CFG1, non-SPI-mode only
const int TMC_CF2 = 2; // TMC2130 CFG2, non-SPI-mode only
const int TMC_CF3 = 31; // CS (SPI) / CFG3
const int IRrx = A4;
const int IRtx = 46;
const int positionSensor = A7;
int sensorValue = 0;
int sensorValue2 = 0;
void setup() {
pinMode(VccLOAD, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
pinMode(EN_PIN, OUTPUT);
pinMode(TMC_CF0, OUTPUT);
pinMode(TMC_CF1, OUTPUT);
pinMode(TMC_CF2, OUTPUT);
pinMode(USBpwr, INPUT);
pinMode(pwrSens12V, INPUT);
pinMode(ButtonUp, INPUT_PULLUP);
pinMode(ButtonDown, INPUT_PULLUP);
pinMode(ButtonLeft, INPUT_PULLUP);
pinMode(ButtonRight, INPUT_PULLUP);
pinMode(ButtonSelect, INPUT_PULLUP);
pinMode(IRtx, OUTPUT);
pinMode(IRrx, INPUT);
digitalWrite(IRtx, HIGH);
// see: https://learn.watterott.com/de/silentstepstick/pinconfig/tmc2130/ -> TMC2130 Standalone Modus (only VIO=HIGH and GND=LOW available)
digitalWrite(TMC_CF0, LOW); // Chopper Off Time TOFF (GND=140tclk, VIO=236tclk, OPEN=332tclk)
digitalWrite(TMC_CF1, HIGH); // see: Schrittkonfiguration
digitalWrite(TMC_CF2, HIGH); // see: Schrittkonfiguration
lcd.begin();
digitalWrite(EN_PIN, HIGH); // HIGH to disable
// turn loadPWR on
if (digitalRead(USBpwr) == LOW){
digitalWrite(VccLOAD, HIGH);
lcd.setCursor(0,0);
lcd.print("load on!");
delay(50);
// check if 12V is present. A value of 800-900 means 12V is present.
// only works on 12V DC! (on USB-pwr analogRead seems to freeze)
pwr12value = analogRead(pwrSens12V);
lcd.setCursor(10,0);
lcd.print(pwr12value);
delay(50);
// turn TMC2130 on
if (pwr12value >= 750) {digitalWrite(EN_PIN, HIGH);} // low to enable, only if 12V is present!
lcd.setCursor(0,1);
lcd.print("TMC2130 on = LOW");
}
else {
lcd.setCursor(0,0);
lcd.print("USB PWR!");
}
delay(1000);
lcd.clear();
//lcd.noBacklight();
lcd.setCursor(0,2);
lcd.print(testSteps);
lcd.print(" steps");
}
void loop() {
while (digitalRead(ButtonUp) == LOW){
if (testSteps<= 40000000){
testSteps +=100;
}
lcd.clear();
lcd.setCursor(0,2);
lcd.print(testSteps);
delay(150);
}
while (digitalRead(ButtonDown) == LOW){
if (testSteps>= 1000){
testSteps -=100;
}
lcd.clear();
lcd.setCursor(0,2);
lcd.print(testSteps);
delay(150);
}
while (digitalRead(ButtonLeft) == LOW){
StepperImperator (testSteps, 1);
//StepperImperator (testSteps, 1);
}
while (digitalRead(ButtonRight) == LOW){
StepperImperator (testSteps, 0);
//StepperImperator (testSteps, 0);
}
}
void StepperImperator(long steps, int dir){
digitalWrite(EN_PIN, LOW); //enable stepper driver
if (dir == 1){
digitalWrite(DIR_PIN, HIGH);
}
else {digitalWrite(DIR_PIN, LOW);}
for (int i=0; i<steps; i++){
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(StepDuration);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(stepdelay);
// Sensor
if (i%100 == 0){
if (digitalRead(IRrx) == 0){
lcd.noBacklight();
}
else {
lcd.backlight();
}
}
}
digitalWrite(EN_PIN, HIGH); //disable stepper driver
}
So in general the sensor works fine with the acrylic disc.
But as I just build a basic setup using the Ramps board and the sensor only, I'd like to program the position detection, first.
Creating the code around the position-thing is just a matter of time and it won't be a problem for me.
This plot is created while there is no movement.