Welcome! Log In Create A New Profile

Advanced

Anet A6 and a laser -- PWM where?

Posted by StlLooking 
Anet A6 and a laser -- PWM where?
May 30, 2019 02:51PM
Hi, I have an Anet A6 I rarely use and just purchased a blue diode laser to make some smoke. I have Marlin 1.1.9 on the A6 so I just defined the Spindle/Laser in 1.1.9 source and it uploaded just fine for 91% of program storage.

Now I need to drive the laser PWM/TTL which is 5vdc.

What pin will have PWM at 5v and where will I find it on the Anet board? I checked the fan sockets and they are both 12vdc.

Could I just use on of those and a resistor to drop the 12vdc to 5vdc? If so, what would be a starting resistor size to test with?

Thanks
Re: Anet A6 and a laser -- PWM where?
May 30, 2019 04:22PM
The input to the mosfet is already 5v....

a voltage divider from 12v to 5v should also work. See [www.allaboutcircuits.com] use a 4.7 kΩ and 6.8 kΩ for a 12V to 5V
Re: Anet A6 and a laser -- PWM where?
May 30, 2019 04:59PM
there are only 8 PWM pins on this controller, they are used as follows..

3 Z step
4 Fan
6 J3 pin 3
7 J3 pin 5
12 Headed bed
13 Hotend
14 XY enable
15 X Step

So very few you can actually use.
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 10:30AM
OK, thanks. But I have a weirder thing that is well out of my area of understanding. Yesterday, I decided to try using the part-cooling fan, so I checked that M106 Sxxx in GCode to see if it changed the speeds and it did. Good start.

I then hooked the 'scope to the red/black wires to check the PWM frequency and P-P voltage. With that connected, as soon as I power up the A6 the fan runs full speed. If I disconnect the 'scope ground it stops.

Can you please briefly explain what might be going on and how do I fix it. I **do not want to hook the laser** to the A6 until I can see what's what and where.

With my small amount of electronics knowledge, I wondered if it was a grounding thing. I pulled the cover off the power supply and checked that the house Ground was also the chassis ground. It was.
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 10:34AM
Quote
Dust
there are only 8 PWM pins on this controller, they are used as follows..
...

So very few you can actually use.

Thanks again, but for a laser I don't need a few of those, so that should open the choice a little.

Could I use one of these?
6 J3 pin 3
7 J3 pin 5

Wouldn't they already be 5v? I will go looking for those pins today.
If I can, the next issue would be how to change Marlin 1.1.9 to use that pin and the GCode to use it.
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 11:40AM
I used the 12v fan connector. If you need 5v then use 5v. If the a6 control board is lije the ramps 1.4 board, the mosfet switches on the ground side. So instead of 12v, use 5v, the other lead will be switched to ground.

That way you can use gcode that controls the fan to control the laser. You'll have to adapt whatever cam software to use that gcode to switch the laser on and off.

I don't remember if marlin can use a generic pwm pin and expose it to gcode. Someone else will hopefully chime in.


--
Kind regards
Imqqmi

NFAN CoreXY printer:
[reprap.org]
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 11:46AM
Quote
imqqmi
the mosfet switches on the ground side.

Ahhh, so that explains the 'scope ground thing running the fan. Now that's weird --to me anyway. smiling smiley

Thanks.
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 01:58PM
Well, using +5vdc from an unused Z-end-stop socket and the ground from the Fan-Grnd pin I get this exciting trace. Not sure I want that going into the laser PWM. In fact the Bed and End pins also have such traces. It seems like this board's idea of PWM does not include square waves. smiling smiley

Or, am I doing something wrong and what do I need to fix that?
Attachments:
open | download - anet-01.jpg (76.1 KB)
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 10:31PM
stop using GNDS from mosfet plugs. They are only gnd when the mosfet is on. this includes fan, heated bed and hotends plugs

they are normally at 12v when off. so from a 0 or 5v signal to a "gnd" at 12v you get -7v to -12v signals!

Edited 1 time(s). Last edit at 05/31/2019 10:35PM by Dust.
Re: Anet A6 and a laser -- PWM where?
May 31, 2019 10:37PM
"Could I use one of these?
6 J3 pin 3
7 J3 pin 5"

yes if your not using a lcd
Re: Anet A6 and a laser -- PWM where?
June 01, 2019 10:55AM
Quote
Dust
stop using GNDS from mosfet plugs.

OK, confused still but thanks for the explanation.

The imqqmi post suggested using 5v and I thought, the MOSFET Ground. I was trying to save having to order some resistors for the voltage divider. We live out in the boonies and everything is 3 to 5 days. I guess I misunderstood how imqqmi meant for me to connect it.

Using the 'scope Ground on the power-supply connector and the black wire of the fan socket, I finally get a nice square wave. It shows around 11.64vdc @ 987Hz. Do I have to order resistors or is there another way using a 5v supply from the board?

Thanks for your patience, I am clearly well out of my depth here.

ETA:
Is there any way to increase that frequency in Marlin 1.1.9? The laser spec is 5KHz at 5v P-P, but the vendor says it might run at 1KHz.

Edited 1 time(s). Last edit at 06/01/2019 10:59AM by StlLooking.
Re: Anet A6 and a laser -- PWM where?
June 01, 2019 11:28AM
The mosfet is a 3 legged device. Its pins are Gate, Drain and Source. the gate pin is already at 5v
You can attach a wire to the gate pin and use this at a 5v PWM signal.


re PWM try enabling #define FAST_PWM_FAN
Re: Anet A6 and a laser -- PWM where?
June 01, 2019 12:14PM
Quote
Dust
You can attach a wire to the gate pin and use this at a 5v PWM signal.

Thanks, but the heatsinks on the MOSFETS stick out over the terminals. I might try to pull off the heatsink and hope it is still sticky enough to go back on. But, I guess just driving the laser a missing heatsink may not matter.

In the mean time I will try the Fast Fan you mentioned and see what that returns, thanks.
Re: Anet A6 and a laser -- PWM where?
June 01, 2019 02:28PM
Quote
Dust
re PWM try enabling #define FAST_PWM_FAN

Upload, M502, M500, M501
OK, that did nothing. It is still around 980Hz. I tried messing with the SOFT_PWM and with PWM_SCALE set to 1 it is 15KHz, way too high. The SCALE is an Integer so it would not let me use 0.34 for around 5KHz.

Any thoughts on why the FAST_PWM_FAN did not change anything?

Thanks
Sorry, only registered users may post in this forum.

Click here to login