I finally threw in the towel for the strange (to me) optical encoder circuit on the vending machines and laid out a more conventional circuit. Since these machines are 25+ years old, the LEDs in the photo interupters may be getting pretty dim too – they're on when the .machine is powered up, so they have a lot of hours.
The schematic shows a pretty standard arrangement for an optical encoder. A buck converter module drops in 24 volt supply voltage to 5 volts. A Schmidt trigger conditions to signal to a PIC18F timer input. I've added an n-channel MOSFET so the LED can be powered only when needed; the gate is pulled high so this feature can be ignored if desired.
The PCB is mounted with screws through the encoder ears. The encoder fits in the exact space of the original. I've used a 5mm removable terminal block for connections, but I'll probably just solder a short pigtail to a Molex plug to mate with the existing cable.
I've ordered the boards from Elecrow. They do not charge extra for v-scoring. In a less than 100mm × 100mm panel, I can get 6 boards
Cost to build 5 panels of 6 boards (30 total): $1
DHL shipping: ~ $25 (seems like it's increased by ~ 30%)
Tariffs: ~ $25
Total charge: just over $51.
The schematic shows a pretty standard arrangement for an optical encoder. A buck converter module drops in 24 volt supply voltage to 5 volts. A Schmidt trigger conditions to signal to a PIC18F timer input. I've added an n-channel MOSFET so the LED can be powered only when needed; the gate is pulled high so this feature can be ignored if desired.
The PCB is mounted with screws through the encoder ears. The encoder fits in the exact space of the original. I've used a 5mm removable terminal block for connections, but I'll probably just solder a short pigtail to a Molex plug to mate with the existing cable.
I've ordered the boards from Elecrow. They do not charge extra for v-scoring. In a less than 100mm × 100mm panel, I can get 6 boards
Cost to build 5 panels of 6 boards (30 total): $1
DHL shipping: ~ $25 (seems like it's increased by ~ 30%)
Tariffs: ~ $25
Total charge: just over $51.