It’s been a while. The first unit of Virk I has been finally finished (more than a month ago, indeed). There’s a fourth working axis now and I’ve polished my modified Marlin version. Currently, I’m working on a simple python program to implement some simple tasks using OpenCV. Here’s the video.
The python software runs on a computer with a webcam, and the perspective transform is used to convert camera coordinates to robot coordinates. This implies a previous calibration process using four points. Eventually all this stuff could be, as far as I know, run on a RPI, thus avoding a full computer on the chain.
I’ve been decided to postpone the Open Hardware thing, as there’s really no interest, probably because the trend today is to 3D print arms, and milling is too overkill for most people.
So what’s next? I’m not sure. Maybe I’ll finish the other units and just try to sell them. Or I could make something else with all those robots. To be honest I will love to open a place with robots and cnc machines, where people can interact with robots and see cnc machines in action. A place to learn and have fun. Or maybe I will start to make and sell just some simple crafts. Who knows.
Currently, I’m competing on several local entrepreneurship contests, searching for a business plan, talking with people to get feedback, etc. In a few words, I’m going outside the shop, into the real world. Any ideas about my new direction now?
Here I disclose my experience using Marlin for my scara robot. I’ve had published the code here:
Please be aware I don’t intent to release a new Marlin “scara” version; this code is just for Virk I. However, maybe it could be useful for someone else.
Current status of scara support
After googling a lot and testing several Marlin versions, I concluded that the “newest” Marlin version with working scara support is 1.0.2. Maybe I missed something, but it’s known that scara support is broken on last versions.
So basically you can use 1.0.2 for a parallel scara 3D printer without modifications. However, Virk isn’t a printer and required some changes.
Changes for Virk
Most of hard work was already done; all I did was some small modifications. Main changes were:
Homing setup: I’ve had added minimal and maximal angle for rotary joints, and target angles for homing position.
M667 / M668: By default, the scara mode is “left” (like a right human arm), but you can change to “right” arm using M668, and go back to left using M669. I’m aware a smarter approach would be a nice addon, but this works now.
M669: this is a gripper mcode M669 S<servo_pos> P<active_time>. P is optional; default <active_time> is 500. I guess I will change this to receive the size of the target object, instead of the servo position. As I said before, a SFR sensor would be a better way, but it’s out of the scope by now.
checkScaraDestinationAngles() check the angles never go outside range.
trimCartesianDestination() trims movements outside reachable area; the arm go as close as it can.
Forward and inverse kinematic transform: my robot wasn’t a parallel scara, so calculate_SCARA_forward_Transform() and calculate_delta() were changed for “standard” scara (every motor coupled, independently, to its link).
Servo disable: a servo is disabled when -1 is passed as parameter. This was required for M669.
Please note I’ve not included standard configuration like lenght of scara links or motor setup, as those are just setup and not my changes.
It’s better to start testing Marlin into non-scara mode. A positive move should result into a counter-clockwise move, in the X (shoulder) and in the Y axis (elbow). Homing should also work if properly configured. Please dont use jog controls to test here; just use M114 to see current pos, issue a G0 to move some axis, and check again with M114. Then, you can enable scara mode.
Finding the right jerk parameters it’s just a trial/error process. Please note my Z axis, unlike rotary joints, is rigid, hence the z jerk for Virk should be lower (actually 0), otherwise it could miss steps . High jerk values on X and Y seems to help reach higher speeds.
My coordinated system: 0, 0 at the robot center, Y towards front, X towards robot right.
If you have different motor configuration I can consider to add as an option, if doesn’t involve to much time and its a generic, non specific case.
A note about Wangsamas
Wangsamas firmware, Repetier based, has very nice features, and in some of my tests it seemed to outperform Marlin. However, I wasn’t able to solve some issues, so at this moment I will stay with Marlin.
I guess the best open software for controlling a cnc robot is, actually, linuxcnc. However, Marlin is a great starting point … why kill the ant with a tank. Smoothieware … who knows. Machinekit … looks cool.
And now the most importat question… ¿should I add a 4th axis? (gripper rotation) ¿what do you think?
Gripper is almost finished. Making a gripper around a rc servo seems easy at first, but there’s a pitfall: you should avoid stall (that is, signaling the servo to go to a position where it can’t go). Using a servo with metal gears can provide some protection, but stalling should be avoided anyway. Possible ways to manage this:
Power the servo for just a short time, long enough for the servo to close or open (something like 500ms). The servo will stall, but for just a small amount of time.
Knowing ahead where you should drive you servo depending on the size of the object you wish to grip. Doing this can be a bit tricky, so it could be wise to combine this and previous behavior.
Add a pressure sensor. This will increase complexity, but having feedback could allow to adjust servo signal to set a constant pressure and avoid stall, without shutting down the servo.
Add some kind of spring-tension to fingers. Even more complex, but not a bad idea at all.
Marlin scara support seems to be broken on current versions. The “newest” version I was able to make it work was 1.0.2. After doing some small modifications and adding some simple gcodes, the whole thing seems to work. I could make a post explaning how to setup Marlin for a scara, if there’s someone interested.
Now, I should say that the first firmware I tried was Wangsamas (Repeteier based), but I left it because of some erratic behavior on some tests. However, now I realize it was just a setup parameter, and indeed movement using Wangsamas firmware was more soft and fast. So, I guess I will try Wangsamas again.
I’ve used simple mechanical lever switches for homing, and they seem to work well on Marlin, but on Wangsamas sometimes I got false readings and hence bad homing. I really don’t care too much about this now; I will come back to Wangsamas a fix this later.
Aesthetics enhancements, belt tension adjust, rewiring and a better wood finish.
I need to add some kinds of bumpers for angular motion links.
Gripper need rubber fingertips. I guess I will go without tactile sensors for now.
Boards need a support. I will make this out of wood, probably.
Pen adapter: This will allow to check path travel. And have fun, of course.
Software: I need to upload my Marlin modifications somewhere, forgot about Marlin for a while, and go with Wangsamas. I pretty sure it will work very well.
4th axis? Maybe.
I had put a lot of work on this first prototype (and his brothers). But, to be honest, it’s not clear where this project is actually going. Final price of those units will be probably higher than planned; probably over 3k. It’s not clear if they will sell, but bear in mind I need to sell just a few units, not thousands. Maybe I sold them as hypermodern art. I really wish to be able to fund a new, faster, larger and cheaper production run… who knows.
I use to do climb milling almost all the time, without any issue. Up to this day. Seems it’s widely known that climb milling can be dangerous if you have backlash in your machine. Well, this was not the case. After I broke the 5mm endmill in the picture I’d found the knobs (both) where pulled out of position by about 0.5mm. Maybe my fault; previously I had disassembled the whole crosslide to clean and install delrin nuts.
A bit later I continue, using 1/4″ three-flute carbide end mill. I don’t remember very well, but I was about to take about 0.3mm on the side, climb milling again. I begin ok, but suddenly, when the endmill was about to exit, the thing grasp into the corner and get stuck into the part. The tip of the endmill was out of position by about 2mm; a rotation in the headstock, purely by flex of all the parts of the headstock and column, was evident (maybe 1º). After unstuck the endmill from the part, the headstock return to his position. I was a bit shoked and forgot to take a picture. Luckily the endmill didn’t break, and there was no damage in the machine (picture doesn’t show original part damage, just a fraction).
Probably as most of my cuts are rather light cuts, there’s no problem with climb milling (max 1mm DOC and 0.5 for side milling). Some things that, perhaps, played against this time, were:
Thinner endmill. Usually I use a 3/8 endmill for side milling.
Two spacer blocks and a long ER16 chuck, giving a less rigid setup.
Slow cutting speed.
Cutting both on the front and on the side (6x11mm).
Less tight gibs. Previously it was not so easy to move the free carriage with the hand.
The good thing is that when things like this happens, you can go to Youtube and check videos like this, and feel a bit better.
One last thing…. now I’m convinced that an accelerometer-based automatic stop is a MUST on any cnc.
First of all, I apologize for not answering comments. There are been nine months since I login to my blog.
I hate to speak about my personal life, but this time I will do an exception. Beginning this year I bought and move to a new apartment (rather old), left my work as software developer and devote to take care of my son (1 1/2 years now). As I like to do all by myself (I’m obsessive and maniac, I know), I start to refurbish the apartment (plumbing, new kitchen furniture, wall repair, painting, details, details, details…), and what supposed to be two or three months turns out to be much more. Also taking care of my son left me almost no time and energy left; indeed working as software developer was joke compared to housewife work. Actually, tough there still a lot of pending work, my working room is finished, so I plan to come back to my projects.
By the way it’s not my purpose to be dependent of my wife forever, so I hope to find some ways to live from what I love to do (a table saw kit and other things come to my mind). I plan to devote between 9:00 to 3:00 AM to my work (rest of the time I will be a housewife and continue apartment refurbishing).
So the next step will be mainly to assemble my mill and lathe, finish my cnc project-machines and clean my computers (I have a mess with my files). Also I will answer pending comments over the next days (sorry for the delay!).
It’s good to remember that Sherline tools are not toys, and that accidents can happen, no matter how well experienced, careful or skilled you are (and I’m none of these) . This happen to me when I was building my table saw. Of course was my fault.
This happened when, after shutting down the motor, I was going to clean the working part and the spindle was still rotating (I get used to do this). The tool, a 3/8″ very sharp carbide mill, caused several cuts in the nail and underneath skin. I must use pointed tweezers to extract plastic particles under the skin, ouch!.
I was lucky; this was a minor injury. Now my nail looks almost the same as before though there are some minor sensitivity issues. After that I adopt some simple rules when working with this tools:
Don’t talk with other people (or ignore them, saying “yes…”, “really?”, etc).
Don’t think about that beautiful girl (or something else).
Don’t put my hands in a radius of 10 cm around the rotating tool.
Clean parts only with a brush.
Of course there are standard guidelines when you work with power tools, but by following these basic rules are a start point.