I purchased a diode laser from amazon. Bigger than my older laser. Has pwm cause im fancy.
But i needed 5v pwm and my mach3/breakout board provides 0-10v analog. The easiest solution I could think of was once again to slap a nano on it.
Here I am testing the circuit.
The circuit uses 2 10k resistors as a voltage divider to accept the 0-10 volt signal into the arduino analog inputs. The other component is a 5v regulator to power the arduino off the cnc power supply and the knob simulates the mach 3 for testing.
The arduino library makes the code so easy. Pin 5 gives a 980hz signal and other pins give different lower signal so choose accordingly. I cant think of a reason to hassle geting into the Timers and increase the HZ.
#include <Arduino.h> //duty is 0-255 int duty = 0; void setup() { //pin 1 reads 0-10v /2 pinMode(A1, INPUT); //output a pwm at 980HZ pinMode(5, OUTPUT); } void loop() { duty = map(analogRead(A1), 0, 1023, 0, 255); analogWrite(5, duty); }
When its done I put it in a 3d printed case and hot glued it to power supply.