Welcome

This page is about my interests, projects, and profession (video games industry).  I mainly code in Python & Java either directly or with these implementations:  PyGame, pygletMEL (Maya Embedded Language), Processing, Android, with a smattering of Arduino tossed in where needed, so you’ll see topics revolving around those languages.  In addition I enjoy a bit of photography and electronic projects (LEDs, soldering, solar gizmos, etc), so they’ll slip in from time to time.  Most of my photography can be found over on Flickr.

Speaking of Processing\Android\Python, you can link to my various programs\apps via the above title bar.

I also maintain several mel\Python\Pygame\Processing wikis that I update far more often than this blog.  See info on their page.

All information on this site is copyright under the Apache Licence v2.0, unless otherwise noted.  Which means you can pretty much use the information here for whatever you like, but I always appreciate credit where applicable.

Have a look around.  Thanks for stopping by.

– Eric Pavey

Ostrich-Egg Bot and Processing

One of the main goals I have with using the Ostrich-Egg Bot is to generate art for it via Processing.  I’ve successfully drawn and etched a variety of random svg graphics onto a variety of surfaces.  Next step was to get that art from Processing.

Turned out to be a bit more difficult than I expected:  Processing has no native API call for exporting svg’s (that I can find).  But I finally grasped the fact that it can export pdf files via its pdf library.  And these, when imported into Inkscape, have the exact paths you need to plot.  Here’s a vid of the etcher in action based on a Processing-generated image:

And here’s the source for a simple Processing sketch that makes use of this:  The sketch draws a bunch of overlapping circles, larger on the bottom, smaller on the top, and makes sure there is no seam on the edge:

// eggbot_circles01

import processing.pdf.*;

int eggWidth = 3200;
int eggHeight = 800;
int minSize = 32;
int maxSize = 256;

void setup() {
  size(eggWidth, eggHeight);
  smooth();
  background(255);
  frame.setTitle("Eggbot: Circles01");
  noFill();
  beginRecord(PDF, "processingCircles.pdf");
}

void draw() {
  float[] pos = {
    random(width), random(minSize/2, height-maxSize/2)
  };
  float eSize = map(pos[1], minSize/2, height-maxSize/2, minSize, maxSize);
  ellipse(pos[0], pos[1], eSize, eSize);

  // Tile the circles on the x axis:
  if (pos[0] < eSize/2) {
    ellipse(pos[0]+width, pos[1], eSize, eSize);
  }
  else if (pos[0] > width-eSize/2) {
    ellipse(pos[0]-width, pos[1], eSize, eSize);
  }
}

void keyPressed()
{
  if (key == 's') {
    endRecord();
    exit();
  }
}

When the sketch is going, press ‘s’ to save an image, and quit. It actually raises an exception, but the image saves… not sure what’s going on…

From there it’s a simple matter of importing the pdf into Inkscape. I discovered however that its size was bigger than what was defined in the sketch, so I had to resize it to fit the Ostrich-Egg Bot’s drawing area. Here is a close-up of the etcher in action:

And here’s a shot of the final product:

So, not the most amazing thing, but one step closer…

Ostrich Egg-Bot: Diamond Engraving Tool

This weekend I got the diamond engraving tool assembled and mounted on the Ostrich Egg-Bot.  Like the previous assemblies, it went off without a hitch.  And engraving on a glass bowl worked the first time.

Things I’ve learned about the kit as a whole up to this point:

  • The “center” of the print is where the pen is located when the print starts.  I hadn’t realized this for some time, and trying to figure out why my prints were drawing on the wrong part of the egg was confusing me:  I figured the print would start with the steppers “centered”, but that’s not the case.
  • When I first was printing, the pause option wasn’t working properly, and I was getting a stair-stepped effect in the print:  Turned out I needed to adjust a very small potentiometer on the egg-board:  Both problems went away.
  • During long prints, my screensaver would kill the print:  Downloaded the “Caffeine” app (for my Macbook Air) to help prevent this from happening.
  • Things that like to be printed on:  Glass balls, baseballs, Christmas-ornaments covered in paper grocery-bag like material.
  • Things that like to be etched on: Glass balls (that’s all I have right now…).
  • Things that don’t like to be printed on:  Tennis-balls, styrofoam balls, styrofoam balls coated in the putty you fill small holes in your wall with:  Ink takes to the styrofoam really well, but all the small divots and holes between the expanding beads cause the pen-tip to get hung-up.  Filling them in with putty just seems to clog up the pin when drawing :(
  • When I first started etching, the etcher didn’t do anything:  I had to adjust the little blue pot on top to get the motor spinning up fast enough.
  • When etching, I had to turn the “speed when pen is down” to at least 100 to be able to see the effect on the glass bowls:  I’ll try it even slower next time.

Next up will to try spray-painting the glass bowls, and see if the etcher can take it off.  In the meantime, here is my first etching:  I figured I should do something the Mrs would appreciate ;)

"Eric + Jodi", aaahh..... :-)

And here is the shot of the engraver itself:

Ostrich Egg-Bot kit assembled

Hour and a half on a Saturday afternoon saw the Ostrich Egg-Bot completed.  Was quite easy (which is good), nothing out of the ordinary happened.  The final product:

And here it is printing a “mountain scene” I drew in Inkscape on one of my wife’s candle-holder vases:

The end result isn’t that impressive, but you can blame the artist, not the tool :-P

The whole process from assembly to print went off without a hitch, which really impressed me.  Props to the folks over at Evil Mad Scientist Laboratories!  In fact, the most difficult thing for me now is to find things to print on… ;)

Ostrich Egg-Bot kit arrived

Quite a space between my last post and now.  Busy finishing my latest game, COD:MW3, learning a lot more about the Maya API (I highly recommend the new book “Maya Python for Games and Film“), and taking an awesome two week cruise through the Panama Canal.

A “shipping the game” present to myself was to pickup the “Ostrich Egg-Bot” kit from Evil Mad Scientist Laboratories (the ‘big-brother’ of the “Original Egg-Bot” kit).  Just brought it home, and unboxed:

Hope to get a more interesting blog post on it as it is assembled and working!  My current plans are to create cool lights based around LED’s and etched patterns on mason jars.  We’ll see what happens…

Arduino 4wd robot & Ping))) sensor

More photos at the bottom. Click to enlarge.

Armed with the knowledge of my previous “Ponar” post, I successfully completed construction and programming of my “Arduino-based 4wd robot with servo-actuated Ping))) sensor”.   It was an enjoyable process with a lot of trial and error since: I’m still learning a lot about how the Arduino works, how hardware hooked up to it works, and electronics work in general.  To get things started, here is a video of it driving around my kitchen:

Here’s the parts list:

Here’s the Arduino program:

How it works:

  • I wanted a simple robot to drive around avoiding obstacles using the ping sensor.  To do that, I sketched out (on paper) the general program, that went like this:
    • Ping to see if there is any obstacles in front.
    • If not, drive forward, while pinging.
    • If there is an obstacle, stop, and take a distance reading to the left and right of the robot.
    • Turn for a fixed period of time in the further direction.
    • Ping again:  If still blocked, keep turning that direction.  If not blocked, go back to drive mode.
  • There are basically three modes the robot can live in:  Drive forward (mode 1), stop and scan (mode 2), and turn (mode 3).  When driving, it can do three things:  Drive straight, turn left, turn right.
  • The hardware is configured like so:
    • The Adafruit Motorshield is plugged into the top of the Arduino.
    • The Arduino is powered off of 5xAA batteries (7.5v) in the belly of the robot.  These are wired to a switch sticking out the back of the robot.
    • The Motorshiled is powered off a separate 4xC battery pack (6v) on top of the robot.  These are wired to another switch on the back of the robot.
    • The 4 DC wheel motors & servo are powered off the Motorshield.
    • The Ping))) sensor draws power form the Arduino.

Things Learned:

  • Next time, use 2-wheeled robot instead:  easier to steer around the house.  The “tank steering” method of this robot seems like it uses a lot of power and doesn’t work very good.
  • I read it in a couple places, and it turns out it’s probably needed:  Solder a 1uf capacitor between the leads on the DC motors to help “smooth out” their operation.  Otherwise it seems little “hiccups” can happen while driving.
  • Voltage, voltage, voltage:
    • I was having all sorts of problems getting the motors to work properly:  They’d start\stop “hiccuping” a lot.  Per the above note I added in extra capacitors on the motors themselves, but it didn’t solve all the problems:
    • Originally I had the motors hooked up to the 5xAA battery pack (7.5v) that came with the robot chassis.  The motors per the specs are rated at max for 6v.  But… I didn’t know this.  I thought it needed moar power.  So I went out and got a 6xC (9v) pack and powered the motors through that.  The stuttering got even worse (although, it went pretty fast when it behaved) and even did something really stupid:  Put one of the batteries in backwards… which caused it to melt-down and leak acid everywhere.  Sigh…
    • Finally (after I knew the correct voltage for the motors and servo) I went out and got a 4xC pack (6v), and that, combined with the extra capacitors, finally gave it a smooth ride.
  • I had to solder in extra connections to the analog pins on the motorshield to allow fo the Ping))) sensor to passthrough it to the Arduino (acting as a digital pin).  However, the motorshield has the pins in the order of “signal\-\+”, while the cables from the Ping))) (and servo) are “signal\+\-”.  Not sure why the motorshield would break ordering convention, but I had to splice and re-wire the Ping))) cable to match the board.
  • The motorshield docs say that servo2 is pin9, but it’s actually pin10.  That took me a while to figure out… :-S
  • I ran into a lot of problems with the programming of the robot itself:
    • The behavior is to run, ping, scan, repeat.  But during “scan” it wouldn’t drive the servo full left\right:  Sometimes it would only  got left, never make it right.
    • To solve this, I put a “timer” in the code, that would only execute the main loop if a certain amount of time in ms had passed (30ms to be exact, which makes it run around 30fps in game terms).  This seemed to make it behave exactly how I wanted.
    • I thought I needed to tell the motors to run on every loop:  It turns out they’re a state machine:  once you tell them to run, they keep running until you tell them otherwise.  Knowing this helped me clean up the code.
  • There doesn’t seem to be any official documentation I could find to the motorshield library, I had to crack open this header file to deduce what it could do:  AFMotor.h

Picture time!  Click to enlarge: