I'm adding a laser cutter to my 3D printer. I want to repurpose the cooling fan output to control the laser. My laser has a power supply which accepts a 5V TTL signal to turn the beam on/off.
The fan output is as follows: Fan OFF - both red and black wires are held at 12VDC. Fan ON - Red wire 12VDC, Black wire pulled to GND. (also supports PWM output at various levels, black wire is used for PWM signal while red wire is held at 12VDC.)
I had wrongly assumed the black wire would be held at GND while the 12VDC wire would be used to control the fan. So I assumed I had a GND reference available, so I built this level shifting circuit (which, of course, doesn't work due to black wire being pulled to 12VDC when off). Its purpose was to simply ground the TTL+ pin to the TTL- pin when 12VDC was present on the input, effectively inputting a logic 0 to the laser controller, or allow TTL+ pin to float high when 0VDC was present from the fan controller, inputting a logic 1 to the laser. I realize this inverts the fan output (fan off = laser on) but that's not a problem. And it did work when testing with a 12VDC power supply.
simulate this circuit – Schematic created using CircuitLab
However, since the outputs of the fan controller both go to 12VDC when the fan is off, this doesn't work. How can this circuit be re-designed in the simplest way possible (hopefully without requiring outside power) to shift this strange 12VDC signal to 0/5VDC TTL signal, or effectively short/open the connection between TTL+ and TTL- pins? I guess a relay would work for simple ON/OFF controls, but that would preclude using PWM to control the laser...
Thanks for any insight.