Laser with Repetier: M106 , Pin9 --> Pin44, Higher Frequency in PWM

I am using my printer with repetier firmware. The Printer is running with a Mega 2560 board.

I added a Lasermoduel with a chinese Laser Driver (Good Laser A11).
First Problem is that one needs a 5V ttl signal, which has to be controlable via Gcode, so i used the M106 S... which is the FAN pin.
But the Fan Pin gives 12V, so i changed the Pins.h, and where the Pin of the Fan ist set to 9 i changed the number to 44.
This works as intented, but it seems that the frequency of the pwm is to low.

I was looking for a solution, so one would be using the new dev version where one can set the pwm speed of the fan, but this would lead to restrictions regarding the resolution, which i dont want to have.

The other way is adding a line to setfan2speed / setfanspeed( which one is the D9 so in my case 44?) in the commands.cpp... i would like to have an idea, what i have to write there if i want to get the analogwrite() function in this function. This should give me 490Hz, which should be enough...if not the next step would be changing the prescaler of the timer5, would that be possible or does it lead to problems with other functions?

Regards Jan


Comments

  • 1. Use dev version.
    2. Use laser module instead of fan.
    3. Add event system and write the events for init laser and set intensity. Here you are free to use whatever you want - pwm or external board setting pwm with higher frequency. So if the pin has unused pwm it can be as simple as calling analogWrite for the pin.
Sign In or Register to comment.