Sunday, March 11, 2012

Chumby One as CNC controller

Well, after a fair bit of fussing to get a decent development environment setup, I finally have the start to my Chumby CNC controller.  So far I only have the manual jog and status screens done, but I expect I'll soon put together a basic gcode streamer to go along with it.  Since I know the audience for this particular mod is fairly small, I'm going to talk in general terms about what I did.  If you want source or have additional questions, please comment.

First, I selected the Chumby for a few reasons, not the least of which is because it was handy.  It runs Linux and has a fairly complete development system.  It also has a nice 3" LCD touchscreen that I wanted to take advantage of and wireless connectivity to the rest of my house.  It runs off of 5v, so I plan to wire it directly to the same supply as the TinyG when I'm done.

I generated a fairly simple control panel using Inkscape.  I then took the coordinates for the various button boxes, and defined them in my program to spit out the button release when the touchscreen is pressed.  The touchscreen is accessed via the Linux input event system, and so most of this is fairly standard and easily portable.

Since the program has to pay attention to events from the TinyG as well as the touchscreen, I'm using select() to block until something is ready and then do the necessary read and parse.  I'm using Perl since that's my programming language of choice after years of sysadmin work, and so I was also able to use the JSON parser module to read the status into from the TinyG.  At the moment, the status output is just being written to standard out, but the next step is to write code to push text out to the yellow status info box.  Since I have to drive the framebuffer directly, I wanted to wait until I had some of the basics working first.

An issue I've run into with the TinyG is that it will happily take (and echo) input while it is in the process of moving and dumping out status info.  That seems to make the parser pretty unhappy.  I'm going to try to shut off character echo on the TinyG end and see if that addresses the issue.

I'm also working to parse the output of ? on startup, so that I can initialize the program's understanding of the coordinates correctly.  Still debugging that part.

At the moment, the jog and update steps seems to be working fairly well, as long as you don't press the buttons too quickly in sequence.  Hoping the echo takes care of that.

I have a USB joystick...  I wonder if I should try to make that a jog input as well...

No comments:

Post a Comment