I have constructed a Eshakeoko jig to use a camera to scan a surface. I have an Arduino Uno with a Amber GAUPS shield. I want to adapt existing software to control the X/Y movement of the camera, then add the camera shutter.
Being completely new to this field, some signposts would be useful. For instance, I cannot find anywhere a core program (a “sketch” that incorporates necessary strategy, definitions, routines, steps, alarms etc) that I can load into the Arduino and try out the various controls. It may be embedded somewhere in these pages, but there is no way to find it.
I am taking a crash course in programming the Arduino, but will soon need to discover how to address the GAUPS to control the stepper motors etc.
There is a mass of useful, inisightful, advice on this site, but it is about 2 levels above my current understanding.
Any ladder of advice would be gratefully received.
I am sure others will have far better insight and better resources to point you toward but if you are in the Arduino/GUAPS world I would imagine you want to head towards GRBL. https://github.com/gnea/grbl/wiki Getting GRBL running on your Arduino and playing nicely with your GUAPS board and the steppers will be step one of several steps.
This is a pretty daunting challenge to take on and there is alot of learning to be done - just keep grinding away!
As @PhilG said, GRBL would probably be the best starting point, and in fact it will do all the stepper motor control for you (it’s a lot of work to re-implemented all that). I will say this though: GRBL already pushed the ATMega328 microcontroller (the one in the Arduino Uno) to its extreme limits in terms of memory usage and realtime performance. I will not be easy to add any significant amount of your custom code in there without breaking something (the memory limit or the performance)
If you do this for the fun of learning how to control stepper motors from an Arduino, then by all means proceed down this path, it’s a great learning experience. However if you want to focus on developing your scanning jig, why not let GRBL and the Shapeoko controller board deal with the motion control, and just ue your Arduino Uno to control GRBL and the camera trigger?
It could work like this:
- Your arduino Uno would be connected to the Shapeoko over its USB serial interface (doable with a serial/USB adapter connected to the UART RX/TX pins of the Arduino Uno)
- It would send G-code commands to make the machine move to a given position
- It would then trigger the camera shutter via one of its GPIOs
- rince and repeat, for all positions in a grid over the area you want to scan.
If you do it this way, I think the effort to goes from months to a few days. But then again as I said, if the stepper control part is what you have fun implementing, that’s understandable too
I have had this “shapeoko scanner” idea on my todo list for a long while, so I’ll be quite interested to see what you come up with. Also I messed with using an extra Arduino and the Shapeoko in this project, though in that case the Arduino was only reading the output of a DRO, the scanning motion was predefined in a generated G-code file.
Thank you for the advice and support. I last programmed anything in the mid '90s, in Pascal. So the output is my primary interest and, with 3 stepper motors, I am quite willing to let someone else to invent the wheel. But first I have to understand how the wheel works. Are there any tutorials for absolute begnners in grbl?
Your calibration project looks interesting. I hope that I can get anywhere near that degree of reproducibility. Whitworth used the concept that a relatively coarse screw can be used to create a finer, more accurate, screw thread. It looks as though you are following in his footsteps.
Fortunately, there is some good image processing software that can merge a mosaic of images into one panorama, provided there is ca 20% overlap between the mosaic chips. I prepared a 6x5 mosaic of a small print ca 12x8 cm on a hand moved floating table at a magnification of ca 2:1 using a static camera, producing a 200 MB file. That took most of an afternoon. But some of the prints are A1 size - hence the drive for automation.
There are actually very few G-code commands that you need to understand to do basic movements.
I have written a one-page summary here.
A few additional interactions would be needed between the Arduino and the Shapeoko controller to initialize things, all GRBL-specific commands are documented here, but you will only need a small subset of that
I’ll be happy to provide some support if you want, this is an interesting project (that I wanted to play with anyway, and the priorities in my TODO list tend to be driven by random opportunities like this one).
I’m always a bit optimistic about how difficult things are going to be, but now that you clarified that you basically “just” need to have the machine go to predefined locations with no stringent precision requirement (thanks to that image overlap and post processing), this should be relatively easy.
Actually, you may even want to try the same very basic approach I used in that calibration jig project:
- a handcrafted G-code file that will move to predefined positions, and use delays to stay at each position for a second or so, before moving to the next one.
- an Arduino program to trigger your shutter at predefined times matching those moments when the machine is supposed to have reached position #N.
with no other synchronization than manually launching the G-code execution on the machine, and the program execution on the Arduino, at roughtly the same time. It won’t win any awards, but with a little tuning it works perfectly. It does require to take margins in the delays between each position, to cope for small desynchronisation between the Shapeoko and the Arduino, but unless you have strong contraints on the scan time, that’s not a problem.
Thank you for the summary, very brief and to the point. Other pages had listed the code terms, but hadn’t shown how they fitted together into a structure.
Keeping it simple is the primary tactic. Moving, settling, timing, focus and shutter is the iterated sequence, within a lot of “for” statements across 2 dimensions Starting by defining the zero and the scanned dimensions -then making sure the SD card doesn’t fill up.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.