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.
Answer
I solved this with a very simple circuit, which avoided the need to run extra ground or +5/12V lines. I used a simple optocoupler and resistor.
Again this is an inverted control: when the fan is ON, the laser will be OFF. Anything less than 100% output on the fan will result in the laser pulsing at the fan PWM frequency.
I have a Monoprice Maker Select 3D printer which uses RepRap compatible g-code. To turn the laser ON, issue M106 S0, and to turn the laser OFF, issue M106 S255 gcode commands.
I am using the J Tech Photonics Inkscape plugin to generate laser g-code, and it doesn't support this type of inverted output. So it's necessary to do a search/replace in the gcode file to swap the M106 S255 and M106 S0 commands.
YMMV - hopefully helpful to someone!
simulate this circuit – Schematic created using CircuitLab
No comments:
Post a Comment