The laser command we use does have a timer for a wind up/warm up built in so no worries of premature cutting. The PID library also has the ability to change values on the fly. So perhaps instead of adding the LCD next I work on the manual speed control function and see which one might fit into the same set of if/then/else’s. I am dreaming of making test cuts and manually setting the RPM to the sweet spot than using that number to import into CAM.
Or, I tape this all up and go get it dirty real quick.
So the to do list is
1-LCD (2004 or 0.96 oled) The 2004 has 2 buttons and an encoder large display, the OLED is small and sexy and could make for a very small overall design. Thoughts?
2-Manual control
3-The function that started all of this, vary the RPM by +/- X amount to avoid harmonic chatter
Ah, got it ! The CAM -> Marlin -> speed controller gets WAY less mysterious once one finds out that the marlin M3/M4 gcode documentation is NOT on par with the implementation : Spindle CW / Laser On | Marlin Firmware
It’s simply wrong : the 0-255 PWM command is with M3 O128, while the M3 Sxxxxrpm is translated to 0-255 using a “linear” formula.
Yeah I actually just saw that is incorrect or incomplete as well as the docs for M666. I am going to have to try and submit some updates to help them out. Even with my horrible grammar, better than nothing right? Don’t worry about how fluent you are, I am not fluent at coding, we can meet in the middle. Pretty sure I am going to get into this a little more today so we will see what happens.
[attachment file=58370]
This little booger looks amazing but takes up almost all the available memory on the nano, lame. Maybe it is an i2c vs iic thing?
So no big deal? I mean I know Marlin just cut out unused characters to decrease LCD load so that is a possibility if it becomes an issue. The 2004 has the characters built in, extremely low load, but uses more pins (8 vs 4 just for the LCD). Also it kind of has too much room and boy is it tiny.
At this point I am thinking of trying to get boards pre-made with all of this combined, to try and bring the price down. Not sure if that is a possibility or not. Maybe I am getting ahead of myself, and should just get some use on the darn thing.
Did some more digging. Seems the AC controllers PWM is valid between 20-240. I need to test this, the backup controller I have is only valid from 15-90…interesting. I have mapped the output to compensate.
Found another issue. The actual RPM all seem to be short by at least 50-100. The PWM timing must not start at 0 as the error is from the input PWM directly. But I have Marlin set to have a min value of 5000, so I will change it to test what rpm=1 gets me for a pwm.
Dammit, slope equation in marlin. So in steps of 118.4, explains why I was off in between those values 10,000 input gets rounded to 9945…
/** * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT * where PWM duty cycle varies from 0 to 255 set the following for your controller (ALL MUST BE SET) */
That makes sense. A short to ground looks like a pwm value of 0 and a short to hight looks like a pwm of 255, so by using a smaller ramge, you can have more confidence that the other side is still connected.
Well, I can’t be a chicken forever. I played with the PID’s for long enough. Handles speed changes like a freaking champ, and I can only disturb the system so much poking it on a test bench. Time to get dirty.
[attachment file=58437]
8k to 12.5k command jump.
I am going to have to use it as is with the encoder disk I think. I don’t want to spend another full day at the bench tuning LED’s, yet.
Well, still chickening out a bit. I don’t want wires near the spinning bit. Wired the previously mentioned emitter and receiver, properly this time, they seem to work really really well.
There is a nice spot to mount them to inside the 660 near the end of the spinning shaft (nice and dark), or maybe at the fan blade (that seems like a dust issue waiting to happen).
Not super stoked on the price of this thing so far. Anyone have any ideas to get it cheaper, or is $60-70 not as bad as it seems to me?
nano $4
LCD $10.50 - the 2004 has an encoder, buttons, speaker…but also an SD slot…Maybe there is a cheaper alternative?
Power supply $10…need to look into how much juice we can use from the rambo’s but everything wants 5V, so just a guess on price here assuming we will need 5-12v external.
AC dimmer $33 -shipped. If I buy a crap ton he will give me a price break but shipping and taxes are rough from Latvia.
optical sensor $2
Wires and a cord $4
Shipping.
This is retail~ish. Buying in bulk I hope to bring the price down, if there is zero labor involved.
If you have to spend $33 on the dimmer, then there’s not much breathing room.
The power supply is the next obvious choice. Do you have any idea how much current it requires? I don’t know about the dimmer, but the rest should be pretty minimal. A linear voltage regulator can create 5V from 12V pretty easily, and they are cheap, but they are very inefficient (The just burn the extra voltage, basically): https://www.sparkfun.com/products/107
I have a couple of these types of micros with builtin screens, and they are awesome:
They can be programmed from arduino, but they do have some extra pitfalls. Similar to the rambos, you need to install hardware support libraries for them. They will also solve any memory issues you’re having.