by dirktheeng » Wed Oct 26, 2011 10:39 pm
I've decided that I am going to use a set of counters that I will connect to an old arduino MEGA I have laying around via a 34 pin ribbon cable the MEGA will set the laser on/off. I am also going to attempt to use the MEGA to do engraving.
The engraving strategy looks like this:
1) prepare the image via a Python Script. The python script will take an image, convert it to greyscale, and then dither it to the resolution and size needed.
2) write this informatin to an SD Card through the MEGA (I have an SD card shield)
3) Move the laser head to the position of the upper left corner of the engraving
4) give Mach3 the macro code (say M199) which is the macro that will handle the rastering through Mach3
a. the macro will send a code throught he modbus (arduino uno) that will set the mega to engrave mode
b. the mega will send back the dimensions of the raster, feed rate, and other information
c. the macro will ask the modbus for the dimensions and feed rate
d. the macro will move the head to start position and request permission to start a raster line
e. the mega will load the first line of data (which contains the position information in steps when the laser should be swiched)
f. when the mega is ready, it sets a ready pin that is read by the Uno which then sends the ready signal to Mach3
g. mach moves the head at the right speed to a given position
h. once the MEGA detects motion, it sets the ready pin to low
i. as the head moves, the MEGA tracks the position via the counters and turns the laser pin on and off as specified
j. once past the end of the data in a line, Mega loads the next line and will set the ready pin to high again when done
k. rince wash repeat until done
Hopefully this will work ok because at 30IPS and 1000 DPI, the head will pass pixels at the rate of 30kHz. This means that I will have 533 instruction cycles to read the position, compare it to a given value, set the laser pin, and load the compare value. This is also prety much the limit of how fast we can the laser on and off. Supposedly, the laser takes about 15 microseconds to turn on and off (each), so it takes about 30 microseconds to turn on and off once and there is 33.3 microseconds that the head is over a pixel.
If 533 instruction are not enough, I will replace the MEGA with an Duo (when it comes out) or a Maple which run at 96mhz. That will give me 3200 instructions. I think the key to making this reliable is not having to wast a lot of resources on the board to count the signal.
Who knows, maybe we will get a general high speed vector/engraving solution for under $100.