Been looking at the datasheet for the TCRT5000L reflective optical sensor. With 20mm through the diode it gives 1mA of collector current in the transistor which is more than enough. Mind you, it does depend on the reflectivity of the surface and that's where experimenting is required. I'm thinking of going for 10ma diode current giving around 0.5ma collector current. The volt drop in the diode shows 1.1v so with 4 in series that's 4.4v. If I run off 12v that leaves 7.6v for a series resistor = 750 ohms. 680 is the nearest preferred value. For the detector transistor, I think I'll work on 0.25mA as a start. If I run it from 3.3v, 12K should let it saturate at 0.4v VCE. I have yet to look at the ESP32 datasheet to see what analogue voltage it takes but mostly this uses 3.3v so I assume that's the maximum.