Hello everyone ! Wonderful forum you have here ! I've been looking for something like what I want to do but so far I've only seen projects with only partial similitude, so I thought maybe the forum will have answer or ideas ! I want to build a xy gantry to move a camera on a "grid" and take pictures of what will be put underneath said camera. So the idea is : move to XY coordinates, take picture, move to new XY coordinates, take picture etc etc... you get the idea. My questions are : Is there a project like mine that I don't know of and that you might have heard about ? If I have to start from scratch (accro system + steppers) would a Arduino Uno + protoneer CNC shield do the trick ? Or Raspberry pie with a protoneer CNC hat ? What would be the best solution ? My biggest worry is, will I be able to create a script to move the camera on a grid (translation my XY coordinates into gcode ?) and take pictures ? Also can I plug the CNC shield and the camera on the arduino uno at the same time ? wont they fight over the same pins ? Or with the RPI, will I be able to plug the camera with the CNC hat on top ? I'll appreciate any inputs, Cheers Arzock
Hello Arzock, Welcome to the forum! I think that this would be a very interesting project. I haven't done this but in principle there is no reason why you can't achieve your aims. Just some basic stepper drivers, steppers (depends how big your XY gantries are, how heavy your camera is and how fast you want to move it) and an Arduino Uno with GRBL on it would allow you to move your XY gantries around. You could control it using the Open Builds Control and you just need to feed it valid g-code for your XY moves. Tricky bit (for me at least) would be wiring up the camera switch to trigger it (GRBL allows you to control a laser so you should be able to use those pins to turn trigger your camera). I bet there is someone lurking on the forum that has done this! Cheers Adam
An easy XY gantry setup: Checkout the ACROs: Machine Bundles - ACRO System - OpenBuilds Part Store They'll be ideal for something like this
This is a bit of a wide open question. How much area are you wanting to cover? Are you wanting vertical movement in addition to horizontal motion? Are you wanting camera orientation axes (pan, tilt, etc.)? Focus control?
Yeah my idea was to use a RPI, write a python script that would alternate between moving the camera and triggering the camera, the part to control the stepper motor might be a pain to write but that would allow to put the camera movement and triggering in the same script I guess..
I feel like I answered this question not long ago, are you the same guy? I would write python. The python can send Gcode as needed, and trigger an external camera or the Pi camera (if 8Mp is enough) as needed. all in one. mum.
The ideal area would be roughly the size of the ACRO system that Peter Van Der Walt linked above, so around 30*80cm I don't need camera orientation, I just want picture from above. I also don't need Z axis movement (or a manual one that I can make later), the adjustment with the zoom and focus of hypothetical camera (motorized RPI cam or webcam) should be enough I think. In case I can't find a motorized autofocus/Zoom camera I might need a Z axis movement but I hope not. The idea is to take multiple macro photo of a filter paper with tiny seed on it and stitch them together to get a high res pictures of the whole thing. To give you an idea here are the seed : Imaging a multiple pieces of paper (11*17cm) with 4000 seeds on each and I need to get a clear image of each seed.
Hello David, I asked the same question in another forum specialized in Arduino, maybe that's why ? Sorry if that issue as already been addressed, could you link me to the other post ? Cheers
moving steppers is what GRBL is really good at so I woudl subcontract that work to it for sure (-: sending Gcode from python is easy, there are exmaples in the GRBL codebase. I woudl start with 'simple_stream.py' from here.
Thanks David, that seems like a good option. In theory could I create a G-code file for each of my camera path on the gantry, stream it to grbl, and take a picture ? Like a loop with incrementation to change g-code files every time I take a photo ? Load G-code Position 1 => stream it => camera moves to destination 1 => camera stop => pictures gets taken (end of loop) Load G-code Position 2 => stream it => camera moves to destination 2 => camera stop => pictures gets taken (end of loop) Etc .. Does that seems doable ? Thanks MaryD but I don't think the thread got anywhere sadly :/
I don't think you need to generate a file of gcode since the python can generate the gcode and send it, on the fly. something like (this is not tested, running code , I have been programming in C, Ruby, PHP and Delphi recently and my head is swimming a bit so my python is not correct) Code: xstep = 3 // step 3mm in the X direstion ystep = 5 // step 5mm in the Y direction Xmax = 200 // max in the X direction Ymax = 400 // max in the Y direciton serial.send("G90 G21 G17 F500") // send header codes for the mode we want serial.send("G0 X0 Y0") // go to start point currx = 0 while x <= Xmax: curry = 0 while curry <= Ymax: gcode = "G1 X{0} Y{0}".format(currx,curry) serial.send(gcode) serial.waitforOKfromGRBL camera.takepicture(use currX and currY in filename) curry = curry + ystep currx = currx + xstep so the idea is to loop through the desired X and Y range and make a line of Gcode at each stop, send that gcode and wait for the move to finish(wait of OK), then take the picture for that point.
Perfect all this looks very promising ! Thank you very much for all the advice ! I'm gonna order my RPI and all the other stuff. I'll keep you updated ! Cheers