Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Wednesday, May 4, 2011

Learning GCode with EMC2

I'm spending a lot of time with my new microCarve A4 CNC router this week. My first couple of items were made using a handy image to gcode converter that's built into the EMC2 control software I'm using.

But the image converter simply treats the image as a depth map which is cut by raster-scanning with the cutting head. For the designs I used, this was slow, and produced rougher results than would be produced using vector cuts.

So I looked at a couple of approaches to improve things. One is using CAD software that works well with a CAM package to covert the CAD design into machine control instructions to cut out the CAD shapes. The other is to go straight to writing my own machine control programs by hand. I know that I'll want to have both methods in my toolkit, but which to use first?

After a bit of back and forth yesterday morning, I decided to start with programming by hand first. So I dove into the EMC2 documentation for gcode, the programming language more properly called RS-274-NGC. What a catchy name, eh? You can bet that the folks who picked programming language names like "python" and "Java" are kicking themselves after seeing how "RS-274-NGC" rolls off the tongue.

Results of my first gcode program on my microCarve A4 CNC.
Results of My First GCode Program.

Well, the EMC2 site has a link for a gcode tutorial, but what's there is...not much. Maybe I'll pitch in, since that's what wikis are for, right? The I went an read the EMC2 documentation, which has the standard cart-before-horse format of discussing details before generalities. Then I found the excellent LumenLabs GCode Tutorial. Much better!

I read some bits, scanned others, then hit the keyboard on my CNC control system. It's an old Athlon 800 with 768MB of RAM loaded up with the EMC2 LiveCD install for Ubuntu Hardy Heron, with EMC2 upgraded to the current version after install.

I fired up EMC2 with the SIM-Axis configuration for developing the gcode. I've got three different configurations of EMC2 on my desktop. I've got the SIM-Axis setup, and two different configurations for my microCarve A4, each with different origins for the axes.

I used gedit to create an initial gcode file, then opened it in EMC2. The gcode preview window is great. Whenever I edited the gcode file and saved, I'd click the reload button in EMC2 and immediately see the changes. Likewise, the error messages were good enough to let me find my problems, though the problems were usually typos rather than what was reported.

I used iterative development, of course. No sense writing too much code before finding out that I didn't understand some element of syntax. I started with initializing the mode settings, lifting the head to a safe traversal height, traversing to a point in space, then returning to machine zero. After fixing a couple of problems, I got what I wanted. Then I added a few additional move commands, and got the simulated CNC to follow them. At that point I could see that things would get out of hand pretty quick if I didn't learn some basic flow control.

So I read up on subroutines in gcode. I laid out a simple key pattern on graph paper, and wrote the necessary routines. That's the border you see in the picture above. That was the easy part. It's all straight lines.

Next was curves. I read up on G2 and G3. I hadn't thought about the ability to shift the depth of cut across the curve when I started reading, but by the time I was done I was thinking, "Hmmm, if I vary the depth of the cut with a V groove bit, I can vary the width of the cut just as I would vary the width of a line with a calligraphy pen."

So I broke out a fresh sheet of graph paper, and started drawing some letters. Well, it took me about three times as long to lay out the letters as it took me to lay out the key pattern, but I managed that. Not only that, but I set things up with scaling factors and variable settings that allow me to easily scale and move the letters.

Results
The results you see above are what I got from the first "live" run of my first gcode program. The cuts are a bit deeper than I'd like, and the 90 degree bit I'm using right now doesn't help. Also, the cutting was a bit fast for the plywood, causing the wood to be frayed on the cross-grain cuts. Still, the varying of "line weight" on the letters turned out well. Overall I'm happy with it, and the defects should be easy to fix when I run it again. I'm planning on building a complete alphabet for this font and throwing it into a file for later use.

Tuesday, September 16, 2008

Trying Out Free OSes

As a class activity I had my high school students try out several different free operating system distributions on the school's different computers in the lab. I brought seven different Live CDs, and we have five different computer types in the lab. I had the class break up into teams of two or three and go round-robin to the different types of systems and test each OS.

The computers we have include two desktop PCs, one a Dell, the other a generic PC (perhaps assembled by our tech, I'm not sure.) We have some Fujitsu laptops for student use, and two models of iMac. I didn't pull all the system stats today, I'll do that next class on Thursday for when I publish the completed test results.

The partial test results can be found here. This document will be updated with further results as we get them.

Today we tried out iLoog 8.02, Edubuntu 7.10 (the last Edubuntu on a LiveCD--it still frosts me that it takes a second disk under 8.x), Belenix 0.7, Ubuntu 8.04, and OpenSolaris 2008.05. If time permits, we can also test Sabayon 3.4e and Mandriva 2008 Spring. These are on DVD, and only about half the lab's systems can read DVDs, so that limits their value to us.

This turned out to be a good class activity for all the students at different skill levels. Some of the students had no experience trying to boot to some operating system other than one preinstalled on the computer. For them, we got to learn about modifying BIOS settings to change the boot priority on the drives on PCs, and using the Option key to select a boot device on the Macs. I'm sure I'll have to review this during out lecture period in our next class to make sure it sticks.

For others, it was good for them to get a chance to try to boot an OS with no idea of what results they were going to get. Getting to see failures during boot and having a sense of what was going on, why the boot failed, and learning when to give up was informative for them.

I tried to hand out OS disks to the teams based on my assessment of their skill level. I gave the OSes I expected to be more compatible and to have the least problems to those teams that were probably less skilled. This turned out to work well for a couple of the teams, but it didn't matter much otherwise. As it turned out, the skill levels had a greater effect on the speed at which a team could try out an OS and move from system to system than it did on how they could deal with the compatibility problems. Just about all teams needed the same level of oversight. Only one team got caught up in games enough to need a comment.

This testing was not only educational for the students, in some cases giving them their first exposure to an OS other than Windows, it was also very helpful for me. Once we do some more testing I'll be able to see which OSes I should duplicate to use with my middle school class on the basis of what works where, and what apps are installed. For that class, it would be nice to have one OS that works on all lab systems, but splitting between two different ones with the same apps would work, as well.

I'll also be offering copies of the disks to students when we complete this activity. In fact, I'll probably make an activity of copying the disks on those systems that can do so. Then the students can try the same thing on their home systems.

Wednesday, August 27, 2008

Ubuntu Works!

Classes start next week. Between meetings today I had time to slip into the computer lab and spin up the Ubuntu Live CD for Hardy Heron. It works great with the PCs in the school's lab. Networking works fine, video is good, apps run, and so on.

I'm really pleased about this, even if it's not an Edubuntu Live CD as I've mentioned elsewhere. I'll be able to use this disk in class even if it doesn't include some of the Edubuntu apps I'd like to have. I'm not in a position to intall Ubuntu so that I can apply the Edubuntu stuff to it. I need everything on one Live CD.

In addition, I may download the older v.7 distro of Edubuntu Live CD image to get the Edubuntu apps. After all, that's what I was told I was getting when I ordered the CD. The upgrade to Hardy Heron where Edubuntu no longer fits on the same CD as the core Ubuntu is what I got. The fact that Hardy Heron works fine on the school's hardware means that it's reasonable to hope the prior version will do the same (we're not talking cutting edge hardware here.)

I was hoping to spin up some other free OS Live CDs, but my time went into making a copy of Ubuntu for a former student who happened to be in the school center instead. She has a computer at home that's a close cousin to our lab PCs that has some problems that a switch to Linux might fix.

The joy of free software. All I had to do is pull out a blank CD and make a copy for her. No fuss, no muss, no shrink-wrap licenses or fees.

And knowing that I've got at least one Live CD that just ups and runs on the school's computers feels really good.

Tuesday, July 15, 2008

Edubuntu: Not a LiveCD Any More

Among the things I'm planning on doing with my 4th-8th grade computer class this upcoming year is give them a chance to play with OSes other than those installed on the school's lab computers. Presently both Mac OS X and Windows are in the lab. I wanted to have a week or two where we spin up some LiveCDs of different OSes and play around with them. I figured I'd have a short list of tasks for the students to perform on each system, as well as allowing for a fair bit of unstructured exploration.

Among the OSes I was interested in having available was Edubuntu. The presentation on the Edubuntu web site makes it look particularly attractive for a class at the 4th-8th grade level. So I ordered a free CD, a courtesy for which I'm grateful. When I ordered it, it looked like I'd be getting the older version of Ubuntu as the base OS since Edubuntu hadn't been updated to use the new version yet. For my use, this was not a problem.

When the disks arrived yesterday, however, I got two disks, not one. One disk is Ubuntu 8.04 LTS, the other is an add-on CD of Edubuntu software. As much as I appreciate free resources for my classes, having Edubuntu split in two sort of defeats the purpose I had in mind.

Many of the computers we have at the school are not particularly new ones. The disk space is at a premium even with just the basic OS and app install. This is why a LiveCD has such value to me as a teacher. It gives me the chance to bring in things that aren't installed on the systems already and use them in class, or to provide a working environment that is consistent across our different systems, without interfering with the basics already on the lab systems, and without giving myself or the already thin and overworked lab staff extra work.

I'll probably still use the base Ubuntu CD in class. But after having been sold on Edubuntu, it's a bit disappointing. I hope that the Edubuntu folks manage to find a way to fit a full version of Edubuntu on a single CD again in the future, because installing is frequently not an option in education.

Undaunted


Now, I don't want to come off sounding negative here. I'm disappointed that I didn't get Edubuntu all on one disk. But the fact that I can use LiveCDs of several OSes this way in class is great! The fact that the world is becoming more heterogeneous
in its use of operating systems, and that more and more flexibility exists in how everyday work gets done, is fantastic.

Doing "real work" on the internet is a reality now. The mass of complaints about Google Docs going down for an hour reminds me of the tales of the early days of networking at UC Berkeley when they took down a network that had been installed as a sort of science experiment back in the 70s, only to have the faculty in the halls complaining they couldn't get their work done without it!

The opportunity to not only teach on-system horizontal apps but networked apps, to teach not just the one major OS but several of them, is exciting. It's exciting to show students the amazing possibilities that are open to them. We have a plurality of OSes that run on a wide range of hardware. We have a variety of commercial, free, and liberated applications available. Work can be done locally or remotely. Virtually all the areas of knowledge are laid open to them, without cost beyond the computer and the network itself. Where ever their passions lie, they can go from novice to expert with the information available on the internet (and with a liberal application of elbow grease of whatever sort in applying that knowledge.)

With simulators and emulators they can do things without having an actual thing to do it on. Whether it's playing a classic video game or playing with electronic circuitry.

It's an amazing world we live in. I'm excited about helping give my students access to it.

And while I'm disappointed that Edubuntu showed up on two disks, rather than one, I'm glad I'll be able to show my students that when it comes to OSes, they aren't trapped and that they don't need to simply accept "what is." They have a choice.

I really, really would have liked to make this post about how cool Edubuntu is and how it's going to slot right into my lesson plan. Hopefully I'll have just such a post about Ubuntu soon, even if I don't get all the Edubuntu apps with it.