PWM pin for laser in skr 1.3 with grbl-hal

why are you not using the FET switched HeatBed/2.5 connector?

Because not works with my laser. Goes On/OFF with M3/M5 but not is capable to control the power. With servo pin works perfect.

I was searching before asking if there was a direct pin for HB_PWM, but that pin goes all the way to U5 MC74HCT125ADTR2G. So I was looking for an alternative pin, on the net I found this, which gave me that idea and it works perfect.

Also I changed $33 to 20.0. My diode laser is 20khz

I am glad you got it to work.
For other users’ benefit please tell us exactly how is your machine now wired?

My 2 cents

The Hotbed output (HB)connects to the drain of Q2. The gate of Q2 (HOTBED MOSFET) connects to pin 8 of U5. U5 is a noninverting buffer and the input to that buffer is pin 9 (HB PWM).

Therefore the output labeled HB (Bed 2.5) is a PWM capable connection and it requires no level shifting etc.

If your diode needs a voltage other than what you are powering your controller you will need a pullup to that voltage. Otherwise, you can connect a pullup to the controller’s voltage (VBB).

Depending on the laser you are driving and the running firmware you may need to invert the PWM signal which often can be done in the firmware settings.

Benefits to using the MOSFET drivers as outputs

  1. Your connected device is isolated from the internals of your controller. When external signals are connected internally to the board and especially directly to the processor your controller is susceptible to noise and even damaging spikes.
  2. Wiring to the terminals provided on a MOSFET driver is easier than the more fragile connections inside the controller boards peripheral.
1 Like

And that is because you needed a pullup resistor which I thought Don mentioned. Think of it like this:
You have a toggle light switch on the wall and the light turns on when the switch is in the UP position but the switch will not stay UP, it falls back down( broken internal spring). So, you need something to keep it pulled UP just enough so it stays UP and stays DOWN. The HB/2.5 negative side is that pull DOWN so you would need to place a 4.7K resistor in the same negative terminal but hook the other side of the resistor to 5V(Yes, you can get the 5V from the servo header). Now, when your software is not commanding pin 2.5 to do anything, the resistor is pulling the Laser signal UP to 5V and when your software is commanding the laser to turn ON, it pulls pin 2.5 low(to ground) and your laser turns on.

In my autonomous RC car club when someone comes in not knowing anything about electronics and wants to work on DIY projects, I recommend they go to Adafruit.com and get an Arduino based board, some buttons, LEDs, a servo and a breadboard and to through each of the Adafruit Learning sections for each part. Just understanding the basics of electronics opens a world of understanding and opportunities.

Well, but it’s easier to change this

PWM1_CH6
for this
PWM1_CH1

Ya, but some do find the journey of learning and understanding quite rewarding. The world is full of assemblers but they can only make what others meticulously spell out for them… There is so much more than that.

Good you got it working.

Sorry Don, I did not seen your comment.

Reduce noise a mosfet?

The MOS transistor has the highest 1/f noise of all active semiconductors, due to their surface conduction mechanism. The result is: several theory’s and physical models competing together to explain the 1/f noise in a MOSFET.

Laser module pcb is ready with inductor, over current protection, over voltage protection, etc, with low ESR. It’s no problem connect ttl/pwm pin directly to a mcu.

Really, if you are looking for low noise with this type of hardware, the first thing you would have to do is optocouple all this type of cheap hardware with what you are going to connect. I don’t see any other way. All this hardware uses low quality passive components, don’t expect series of capacitors here like X7R X5R, or good brands like Murata, etc. These are all LSCS components from the cheapest Chinese brands. So it is not to walk with so much preppy.

One thing I forgot, if you do a pullup there, you should put a 100 nF capacitor, it is common in this type of communications, the same thing happens when it is done with I2C or SPI. In order to reduce what you say, the noise.

Using a resistor would have to be looking for the right values or communication could have problems, it’s not putting 4K7 and that’s it, maybe it will go better with this laser and this 1K controller, or 10K, or another, I say those because they are typical. In addition to looking for the appropriate value of the capacitor and type of capacitor, a matter that BigTreeTech and laser engineers have already done, so why be inventing the wheel?

Changing the code is not the universal panacea either, it can also cause problems in the long run of a conflict type or whatever, but since both solutions are not perfect, I decided on this one that I saw faster.

Maybe another day I’ll change it and do it like this but for now it works and I’m only going to use this machine for the laser. For CNC I have to make a bigger one. And for drilling, this machine is not suitable for a spindle between 150,000~200,000 rpm 7~10kg

I’ve never considered PWM a “communications” but I see how it can be seen that way. It is a one-way communications sorta and I do run across that quite often.