I use something like this to control the heater on my 3d printer hot end. Power transistors run high-current DC through a big resistor in a heater cartridge in the hot end.
The power transistors are driven by a low-power PWM control signal (3.3V logic, low current, 2kHz). The duty cycle of this PWM signal controls how much current runs through the resistor, which controls how much heat it adds to the hot end. The low-power PWM control signal comes from a Teensy PWM output: https://www.pjrc.com/teensy/td_pulse.html The duty cycle of the PWM signal is controlled by a PID component in HAL (which gets temperature feedback from a thermistor in the hot end). The temperature command input to the PID component comes from one of the `motion.analog-out-NN` pins coming out of the LinuxCNC motion controller ( http://linuxcnc.org/docs/2.8/html/man/man9/motion.9.html#MOTION%20PINS). I use M67 (http://linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m67) to set the temperature command to the PID controller. Your situation with the laser seems simpler, since you don't need the PID loop. You'll set desired laser power with M67, and connect the `motion.analog-out-NN` pretty much directly (maybe after some scaling) to a physical PWM output pin. This physical pin will connect to the control input of the laser power supply. -- Sebastian Kuzminsky On Sat, Aug 14, 2021 at 6:40 AM Les Newell <les.new...@fastmail.co.uk> wrote: > On 13/08/2021 22:25, Dave Matthews wrote: > > I come from an electronics background and am used to looking at a scope > so > > have always considered PWM as a digital control mode. I'll take a look > for > > examples of how to set up a pwm pin in HAL. My initial setup was done > with > > StepConf so I let it do all of the work to set up a spindle pwm pin. > > > > Thanks. > > > > Dave > > The PWM pulse is digital (on or off) but the pulse width is analog. The > pulse width is the parameter you are changing. > > Les > > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users