PropEtcher

Parallax Propeller-controlled Etch-a-Sketch.

Inspired by this post on Hackaday.com, I decided to make something similar, except mine would be controlled by a Propeller chip.

Here is a video of PropEtcher in action:

Here are some photos of the frame and motors:

Front view, 3/4 view, top view, back view

I constructed the frame from a scrap piece of lumber. A big thank-you to Seattle's City Hardware and Home Depot for their help with cutting the wood.

Stepper motors

I bought some stepper motors from Metrix Create:Space. (You have to love a place where you can walk in just before midnight and buy stepper motors from a vending machine!)

This was my first experience with stepper motors. I had done some reading and was prepared for 4-, 5-, or 6-wire steppers, but these motors are rather unusual in having only three wires.

Fortunately, they're very easy to drive:

Three-wire stepper motor drive patterns

The motors are rated for 24V but I'm driving them at a nominal 12V (the "12V" wall wart I'm using actually puts out about 16V). One revolution takes 300 steps.

Coupling to Etch-a-Sketch

After much trial and error, I found some tubing at an auto parts store that provided good coupling between the stepper motor and the Etch-a-Sketch.

Tilt motor

I had hoped to use a third stepper to tilt the Etch-a-Sketch for erasing, but the stepper couldn't provide enough torque. Fortunately, I happened to have a Faulhaber gearhead motor lying around (http://www.robotroom.com/FaulhaberGearmotor.html).

I use one of the Propeller's versatile counters in DUTY mode to ramp the voltage up and down to this motor.

Electronics

The following photo shows the PropEtcher circuit board. The Propeller chip is on its own little "11x11" board in the upper left corner. Below it are two SN754410 quad half-H driver chips for supplying power to the motors. Also visible is an SD card (with poor man's SD card holder) as well as video and keyboard connectors.

PropEtcher circuit board

PropEtcher schematic

Sphinx

Normally, Propeller programming is done on a PC. You write programs in Spin (the Propeller's "native language") and compile them on the PC, then download the resulting bytecode to the Propeller.

In contrast, Sphinx is a Propeller-based Spin compiler. It is somewhat limited in terms of speed and memory, but it is perfectly suitable for compiling small turtle graphics programs. It provides a command-line interface, a simple text editor, and a Spin compiler.

Running Sphinx enables PropEtcher to be a standalone system (no PC required).

Turtle graphics object

Turtle graphics is a way of generating graphics by controlling the motion of an imaginary turtle. You write a program that commands the turtle to move forward or turn. The path the turtle traces makes, with any luck, an interesting picture.

Classical turtle graphics programming was done in Logo. On PropEtcher, you write Spin programs that use the "turtle" object.

One turtle graphics feature that PropEtcher lacks is the ability to enable and disable the turtle's "pen"—the pen is always on, since the Etch-a-sketch has no way to move its stylus without drawing.

Example programs

This first program drew the set of circles in the video. The first part of the code is housekeeping; the real action is in the method named Blah.

obj turtle : "turtle"

var long args[5]

pub Main

turtle.Init( @args, 5 )

\Blah

turtle.Exit

pri Blah

repeat args[3]

repeat args[0]

turtle.Forward( args[1] )

turtle.Right( args[2] )

turtle.Right( args[4] )

Th second program drew the space-filling Hilbert curve in the video. The turtle starts in the center of the screen, so the program first moves the turtle to the lower left and erases the screen. Starting from that point centers the Hilbert curve on the screen.

obj turtle : "turtle"

var long args[3]

pub Main

turtle.Init( @args, 3 )

\Blah( args[0], args[1], args[2] )

turtle.Exit

pri Blah( n, t, s ) | w

w := ( s * ((|< n) - 1) ) >> 1

turtle.Left( 135 )

turtle.Forward( ^^( w * w * 2 ) )

turtle.Right( 135 )

turtle.Erase

Hilbert( n, t, s )

pri Hilbert( n, t, s )

ifnot n

return

turtle.Right( t )

Hilbert( n-1, -t, s )

turtle.Forward( s )

turtle.Left( t )

Hilbert( n-1, t, s )

turtle.Forward( s )

Hilbert( n-1, t, s )

turtle.Left( t )

turtle.Forward( s )

Hilbert( n-1, -t, s )

turtle.Right( t )

Clipping

The software defines boundaries on the screen beyond which the Etch-a-Sketch stylus is not permitted to go. If a program tries to draw a line extending outside the boundaries, only that portion of the line that is within the boundaries is drawn. If no clipping were done, it would be possible to run the stylus out to the hard mechanical limits of the Etch-a-Sketch, placing undue stresses on the motors and the Etch-a-Sketch, not to mention messing up the drawing.

Note that the software has no way of knowing where the stylus actually is. Every time a turtle graphics program runs, it starts with the assumption that the stylus is in the center of the screen. You must ensure that the stylus is in fact in the center for the clipping to work properly. A manual control program allows you to position the stylus by using the arrow keys on the keyboard.

Backlash compensation

As it happens, there is some appreciable mechanical slop, also known as backlash, in the system. At first I thought the backlash was in the tubing between the stepper motors and the Etch-a-Sketch, but in fact it's mostly in the Etch-a-Sketch mechanism itself. The effect of the backlash can be seen in the noticeably distorted circles in the left photo below (not counting flattening due to clipping, of course):

Left: without backlash compensation

Right: with backlash compensation

I was prepared to live with the imperfections caused by backlash—after all, as Matt at Metrix sagely reminded me, "It's a toy"—but I decided to try implementing some very simple backlash compensation in software. The improvement was remarkable, as shown in the right-hand photo above.

It's still not perfect, but that's OK—it's a toy.

Code

I have attached the source for the turtle object for your reference.

Return to Project Blah