Here are a couple of of learnings / questions. My first configuration was to use the fan PWM to drive the laser via the M106 command.
From a hardware perspective you need to do two things, first you need to get the 24V fan power down to close to the 5V PWM input. Jay, at JTechPhotonics, said the following: "For the voltage on the fans, yes it would be better if they were put down to 5V (or even 12V). The input is isolated, so it should work fine, but it was designed with 5V in mind. I think the high end of the design is rated at 24volts. If you have a way to get it to 5V then I would recommend it, but you probably are fine at 24V. " I did a voltage divider and took it down to close to 5V. Second, I installed a switch so that I could toggle between the fans working or the laser working.
There is a slight issue on the firmware side though. At least with my printer there is a spike of voltage when the fan circuit activates. I am assuming this is to help the blades of a fan spin up but have not dug into the code to see. You can see the spike using a meter or just by watching, with glasses of course, the laser turn on. Not at all optimal to have a litle black spot everywhere the laser activates! Is this on all machines? It turns out that this is a fan spin up feature and it can be disabled in the configuration.h file (courtesy of gr5 on the Ultimaker forum).
With the above being the case I decided to go the LED PWM route. This is not as clean due to the normal state of the LED being on but I decided to try it anyway. I chose not to use a voltage driver as the supply for the LEDs is under 12V. Same comment about it needing to be switched but this time there are no spikes! There was another problem though. An LED PWM command, i.e. M42 S200, seems to get processed as soon as the firmware reads it without waiting for previous commands to be completed! You need to put an M400, wait for everything to be done, command just ahead of it (found that above in the comments on this thread). Note that you do not need a pin number with the M42 as it will default to the LED ... but if you do use a pin number it is 8 for the UM2 and 15 for the UM.
Here is an update from GR5 on the Ultimaker User Forum in regards to the Fan PWM and the burst we see on starting the fan. I have not done this yet but only because I dread messing with the motherboard again!
As long as you never set the fan to below 30%, getting rid of this feature won't hurt. Plus it doesn't work very well anyway. If I don't set the fan to 100% until 5mm and is printing .1mm layers that is 50 layers so fan is 2%, then 4% then 6%, etc. When it hits 2% it powers 100% for 200ms then to 2% and fan stops. When it goes to 4% it is already on and it doesn't do the special "power on" code. So the code is kind of useless. It should do full power everytime power is increased - not every time fan is turned on.
In Configuration_adv.h just set the time to 0 or minpwm to 255:
// When first starting the main fan, run it at full speed for the
// given number of milliseconds. This gets the fan spinning reliably
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
#define FAN_KICKSTART_TIME 200Update of mid-November: I could not get the LED PWM to work as well as the fan PWM was working so I have gone back to the fan after implementing the above change.
#define FAN_KICKSTART_MINPWM 20