Sketck Pad

4   Sketch Pad

The capacity of the Apple and other home computers to produce complex graphics gives us an exciting new artistic medium, but it is often difficult to use. There are several commercial software packages that simplify entering images into the computer, but the lack of suitable drawing instruments limits their use. Graphics paddles and graphics tablets are currently on the market, but the cost of this hardware is prohibitive for many would-be computer artists.
     If you are interested in experimenting with computer graphics but can't spend much money on hardware, consider building this versatile sketch pad, which will let you draw directly into the high resolution graphics screen. We will show you how to construct the sketch pad for a total cost of about $30.

Fig. 4-1. Sketch Pad

FEATURES OF THE DEVICE
The sketch pad has a drawing surface slightly larger than a standard sheet of paper (8-1/2 x 11 inches). You can attach drawings and photographs to the pad and trace them into the hi-res screen, or you can use a blank sheet of paper and simultaneously draw on the paper and the screen. You can also use the sketch pad to read graphs, strip charts, and business charts directly into the computer.
     Figure 4-1 is a drawing of the finished device. Features to note are the baseboard, the upright post which can be adjusted to change scale, the head with its two potentiometers, the cantilever, the pencil holder, and the cable with a box for the pushbuttons.
     The unit is constructed of plywood and sheet metal and can easily be made in a home workshop or shop class. It could be built completely with hand tools, but the use of a table or radial arm saw speeds up the job. The wiring is extremely simple, so the electronics work shouldn't intimidate an interested builder. All in all, this is a good beginner's project.
     We have included three programs in Applesoft Basic (see chapter 15) to give you a start in using the sketch pad. A Linearity Test program shows how well this sketch pad or a similar commercial graphics unit is working. The Drawing program, lets you draw directly onto the hi-res graphics screen in three different modes, store pictures on disk, and then retrieve them. The Digitizer is a program that lets you measure points on data sheets and enter them into your computer for data analysis, a process called "digitizing the data." The sketch pad will digitize quickly and with reasonable accuracy, and this program will store and retrieve the data from disk as well. We will examine all of these programs in detail later in the chapter.

PRECISION AND LINEARITY
Simple game controllers can be rather sloppy devices, since accuracy is often sacrificed for speed and feel. But in constructing a sketch pad, you want all the precision you can get.
     Two parameters are important in obtaining that precision. First is the theoretical precision of the electronic circuits, whether they are 8 bit, 10 bit, or greater. Second is the uniformity or linearity of the mechanical to electrical converters, in this case the potentiometers. These considerations arise whenever you are continuously changing quantities (analog) to numbers (digital) or vice versa.
     The paddle input on the Apple II and most other home computers is a timer circuit which converts a resistance value into a number between 0 and 255. This is an inexpensive and stable 8 bit analog to digital (A to D) converter. It is also an extremely slow one. The best possible precision it can have is one part in 256, or about 0.57%. This sounds pretty good; old style panel meters had an accuracy of about 5% at best.
     The problem with even 0.5% precision is that errors creep in because of aging components and temperature changes, so that the theoretical precision is rarely achieved. And, if you have to measure several numbers and use them in mathematical equations, the inaccuracies tend to add up. Expensive computer systems usually have 10 or 12 bit A to D converters. (The most accurate converter we have seen was a 24 bit system in an astronomical observatory.) The more precision you try for, the more difficult it is to calibrate and stablize the system so that you can approach its theoretical limit.
     The second problem is linearity. For the sketch pad, linearity defines how straight a line it will draw. The electronic timer circuit has strikingly good linearity, but the potentiometers do not. If we draw a graph of the resistance of a pot versus the degree of turn of the pot shaft, we should get a straight line. But if the manufacturing processes for the resistive element in the pot are not extremely uniform, the measured reading will vary from the ideal straight line. If you use cheap, non-linear pots in the sketch pad, the lines you draw with it will be bent. Your drawings will look like the reflections in a funhouse mirror.
     There is not much you can do to increase the precision of the Apple's 8 bit digitizer, at least not cheaply. But eight bits is almost enough for Apple graphics, anyway. The resolution of the hi-res screen is 280 by 192 picture elements, and the two paddles resolve 256 by 256. This is more than enough precision vertically, and we are only short by 8% horizontally.

Fig.4-2. Wooden Parts

Figures 4-3 and 4-4. Metal Parts and Head Detail

CONSTRUCTION
Figure 4-2 gives a top view of the baseboard and details of other wooden parts. The first step in constructing the sketch pad is to gather all the materials and cut out the parts.
     The prototype was made from 1/2-inch hardwood plywood (part of a salvaged kitchen cabinet), but standard fir plywood would work as well. The drawing surface of the baseboard must be sanded smooth. The wooden parts of the uprights and cantilever were cut from the same plywood and also had to be well-sanded, particularly along the edges. Most of the holes shown in figure 4-1 are for #8 x 1-inch wood screws. They were drilled with a Screw Mate drill, which produces exactly the right shape hole and counter-sink.
     Most of the metal parts (see figure 4-3) were cut from a 1/16-inch thick piece of aluminum scrap. Galvanized steel about 1/32-inch thick would also give good results. You must be able to work the material with hand shears, but it can't be so flimsy that the parts are easily bent. When you are drilling sheet metal, you should hold it with vise grip pliers or in a bench vise to keep it from spinning and cutting your hand. The front and back of the upright have countersunk holes for #6 flathead wood screws. File all edges and corners smooth as soon as you cut or drill them.
     The parts for the head, which holds the two pots, are somewhat complicated; figure 4-4 shows them in detail. It helps if you have your pots in hand so you can trial-fit them. If your first attempt doesn't look right, make another.
     Cut out the two metal pieces that form the hanger (as shown in figure 4-3), then drill only the two central pop rivet holes. Pop rivet the pieces together. Now open up the bottom parts of the hanger and bend them around a 1/4-inch bolt to form the pot shaft clamp. Bend back the bottom tabs so that they don't quite touch. With the bolt still in place (it substitutes for the pot shaft), drill the clamp bolt holes for the bottom shaft. Drill the top bolt holes. Then, using this metal piece as a pattern, drill the matching holes in the cantilever parts and the masonite spacers.
     Cut out the pot mount piece and brace, file the edges smooth, and drill the holes for the pots. You will need a hacksaw for the two small cuts. Use the pots to mark the positions of the spin prevention tab holes. Now bend the pot mount to look like the one in figure 4-4. For the prototype, the metal was bent in a bench vise with custom-made oak jaw faces. Fit the brace in position and clamp it with vice grip pliers in order to drill the pop rivet holes. Install each pop rivet after its hole is drilled, working from the outside to the inside.
     The holder for the drawing instrument is made from brass tubing available at your local hobby shop. You may want to make several different size holders for pencils, pens, and a plain wooden pointer or stylus. Be sure to take the instruments to the hobby shop with you for trial fittings. Cut the brass tubing with a small triangular file. If the fit is a little loose you can insert a 3/8-inch wide strip of heavy polyethylene sheet (a garbage bag is a good source) inside the tube. You may have to cut the erasers off the pencils.
     Next, cut a 1-1/4 inch wood plug from 3/8-inch maple dowel to fit inside the top of the tube and glue it in place with epoxy. After the glue has completely set (preferably overnight), drill the pot shaft hole, the bolt hole, and the saw cleft stop hole. Make the saw cleft with a hacksaw and file all edges smooth.
     Put together the wood parts with wood screws and carpenter's glue and then fit and mount the metal parts. Install the clamping bolts, but leave them loose; the upright extension should slip smoothly into the upright. You may have to sand and rasp the extension some more to get a smooth adjustment.
     When everything fits, take off the metal parts and fine sand the wood. All wood parts should be finished with two or three coats of satin-finish polyurethane varnish. When the varnish is thoroughly dry, reassemble the entire device.
     To prevent the sketch pad from scratching your furniture, you can glue cotton felt to the bottom of the baseboard with contact cement. To make a better surface to work on than the finished wood, attach a heavy piece of drawing paper to the unit with drafting tape.

ELECTRICAL COMPONENTS
The utility of the sketch pad is dependent on good potentiometers: the pots must be as linear as possible. We have had good luck with the pots that meet military specifications (Mil Spec) described in the parts list, but even with these you should consider buying a few extras so that you can choose the ones that draw the straightest lines. The pots listed have short shafts; they are just long enough for the homemade clamps. If you have a choice, get long-shafted pots and saw off the shafts as needed.
     The pots do not travel through their full turning of 300 degrees, so you will need pots with values much greater than the standard values -of your computer. The 1 meg-ohm pots listed work well for the Apple II, which normally uses 150K pots.
     If you can't find good pots with the higher values, or if you find some especially good pots at a surplus store, you can use correction capacitors, as described in chapter 1. Correction caps can easily be mounted in the pushbutton box, and you are much more likely to obtain straight lines if you use them.
     The pushbuttons, which should be at least 3/8-inch in diameter, are mounted in a small plastic box. Your fingers will tire quickly if the buttons are smaller than this. The correction caps, pull-down resistors (R1 and R2), and the filter cap (C1) are mounted on a small piece of printed circuit board that is placed in this box.

WIRING
For the electronics work on this project you will need a small pencil soldering iron of 25 to 40 watts and fine resin-core solder. The necessary hand tools are long-nose pliers, diagonal cutters, and wire strippers.
     The cable from the pots to the pushbutton box must be very flexible and have at least three conductors. Using four-conductor telephone cable with the +5 wire doubled up worked well for the prototype. The cable should be about 30 inches in length-long enough to loop to the top of the upright and then run to the pushbutton box. Figure 4-4 shows the pot terminals to which you will solder the wires.
     The run from the pushbutton box to the plug requires six conductors. Two lengths of telephone cable will Work nicely. Ribbon cable can also be used for this run if that is what you have on hand. If you have extra wires, double up the +5 supply and ground. The length of this cable will depend on how far away from the computer you want to place the sketch pad for general use.
     The plug is a standard 16-pin DIP header. You can mount resistors R1 and R2 on it if you like. Be very careful to identify pin 1 by its marked corner. The cable usually enters the header from the pin 8 end.
     The best way to check your wiring is to make two photocopies of figure 4-5. On the first copy, color in each wire, component, and solder joint as you progress. Go over your work again and color in the second copy as a final check. This is standard practice in electronics.

Fig.4-5. Schematic

TESTING AND ALIGNMENT
If you have a multimeter, check the resistance from pin 1 to ground pin 8. It should be at least 50 ohms (normally, it will be much higher) even when you press the buttons and turn the pots. Shut down your computer, plug in the sketch pad, and turn the computer on again. If your computer does not start up in the normal way, turn it off at once and recheck your work. Then run the Controller Checkout program from chapter 15.
     To adjust the pots, tape a blank piece of paper on the board and mark the spot in the center where the pencil is exactly straight up and down. With a program running that shows the pot readings, and with the clamping bolts loose, turn the pot shafts within the clamps until both readings are 128 when the pencil is on the mark.
     Now tighten all three clamping bolts. Move the pencil around the paper and make marks at the 0 and 255 points in each direction. The reading in the top left-hand corner should be 0,0, just as the top left-hand corner of the hi-res graphics screen is 0,0. If one or both axes are backwards, you can reverse them by moving the +5 wire to the other outside pot terminal and resetting the 128,128 point.
     Try moving the upright up and down to change scale. Mark the 0 and 255 limits for different upright heights to learn the range of sizes available for drawings. You should be able to adjust from about 6 x 8 inches down to 3 x 4 inches. If 0 and 255 fall off the baseboard, you will need the correction caps as discussed earlier.

LINEARITY TEST
The Linearity Test program (see chapter 15) provides a test of the linearity of your pots and the accuracy of the sketch pad as a whole. To make this test you will need paper, a compass, and a straight edge. Tape the paper to the board and run the program.
     As shown in figure 4-6, draw a line front to back down the center of the paper. Mark the points on this line where Y, as shown on the screen, becomes 0 and where it reaches 255. Using the compass, bisect this line (the required arcs are shown in figure 4-6). Draw the bisecting line completely across the paper. Bisect each half of the first line with short cross marks. Mark the points on this line 5, 6, 7, 8, and 9, as shown in figure 4-6.
     Mark the 0 and 255 points on the X axis line and bisect the line between these points. The central point #2 may or may not fall exactly on the Y axis. Bisect each half of the Y line and mark points 0 to 4.
     Now for the linearity test. Carefully place the pencil on point 0 and press the 0 button, then do the same for points 1, 2, 3, and 4 in turn. Move to points 5 through 9 and at each press pushbutton 1. The screen will now show the correct reading for each point, the value actually read, the error, and the error as a percentage of full scale. The lowest repeatable score could have as low as 0.5% as the worst error percentage. Sketch pads with error rates below 4% will generally produce good drawings. Run and test several times to see how good you are at hitting the same points. Pots with large error values will draw distorted pictures, but the distortions may lead to interesting effects.
     After testing the unit as described, you may want to cover the exposed wires on the pots and the DIP header with several coats of fingernail polish or with silicone sealant. Gluing cotton felt to the bottom of the pushbutton box will keep it from scratching the desktop. Be sure to mark pushbuttons 0 and 1 clearly.

Fig.4-6. Linearity Test

THE DRAWING PROGRAM
Now that the device (and perhaps its builder) have been thoroughly checked out, we can begin to draw with the sketch pad. The Drawing program listed in chapter 15 is a fairly detailed sketching program. It lets you draw pictures in three different modes, save your work on disk, and retrieve it. The program is menu-driven and includes instructions.
     First tape a clean piece of paper onto the board. To run the program, select item #1 on the menu to clear the hi-res screen. Next enter item #4, Drawing Continuous Points, and read the instructions. Press RETURN. As you move the pencil, dots will appear on the screen. The 0 pushbutton will show the values X, Y, and HCOLOR. Pressing numbers 1 through 7 on the keyboard will change HCOLOR to the number pressed. The ESCAPE key will bring you back to the main menu.
     Again, press 1 to clear the screen; now select item 5, Drawing by Continuous Lines. The rules are similar to those for selection 4, but we think the resulting drawings look better. You might trace a plastic circle template to see how distorted the circles are on the hi-res screen. Tracing the same shape several times will give you some idea of how accurately you can copy drawings. Press ESCAPE to return to the main menu.
     The third drawing mode is 6 on the menu, Drawing by Reference Point Lines. Both pushbuttons are used here. Pushbutton 0 does just what it did before. Pushbutton 1 has a new function: it fixes the stylus location as a reference point, which will be shown as a small blinking cursor on the screen. To draw in this mode, think of your picture as a series of straight lines. Move the stylus to one end of a line and press button 1. Find the other end of the line and press 1 again. A line will appear on the screen between the reference points. This drawing mode is least affected by the non-linearity of the pots.
     You can use all three modes in one picture: draw straight lines with the reference point mode, draw curves with the continuous line mode, and fill in areas with the continuous point mode. To erase, simply change HCOLOR to 0 or 4 (black) and retrace the line. You can shift between the modes without erasing the screen.
     Main menu selections 2 and 3 place and retrieve the entire hi-res screen on the disk (this requires 34 disk sectors). Practice saving and retrieving a simple practice sketch before spending a lot time on a drawing. You don't want to risk losing a masterpiece by making a simple mistake.

THE DIGITIZING PROGRAM
The digitizing program (see chapter 15) assumes that you have a stack of up to 41 graphs or charts, each with up to 15 data points, and that you need to transfer this information into the computer. You must first name the disk file. If you want to add to an existing file, answer that the file is not new-the program will get the file off the disk.
     Adjust the height of the sketch pad upright so that the stylus will just cover the entire area where points are found on any of the graphs. If all your graphs are the same size, make a reference corner by taping strips of cardboard to the sketch pad base. This will make it easy to place each graph in the same location.
     Write down the values of X = 0, X = 255, Y = 0, and Y = 255 on the axes of the graphs. These readings will be needed in the next step. Press pushbutton 0 to continue.
     Enter the units of the X axis (centimeters, days, whatever), then the graph axis value for X = 0 and the graph axis value when X = 255. Do the same for the Y axis. Since the 0,0 point is in the upper lefthand corner, the value for Y = 0 is usually larger than the value for Y = 255.
     Now you are ready to transcribe data. Place sheet 0 on the baseboard, move the stylus to the first point, and press pushbutton 0. The screen will show the X reading, the Y reading, the X axis value in the X units of the graph, and the Y axis value in the Y units. Continue moving the stylus and pressing pushbutton 0 to enter up to 15 data points.
     Pressing pushbutton 1 at any time will bring up a question asking if a new sheet is desired. A YES answer brings up a new sheet, a NO answer sends you to the disk storage routine.
     This digitizing program is intended as an example to get you started. You will probably want to add correction features and restructure the data files to suit your data reduction programs. The number of sheets and points is limited by the size of your computer's memory.

SUMMING UP
The sketch pad is an inexpensive, easy-to-build device that can be used for computer art work and data entry. Its major limitation is the imprecise linearity of inexpensive pots. (Commercial units, however, also have difficulty achieving good linearity.) The programs included here let you check the quality of the sketch pad and help you get started with drawing and data entry.

Parts List
Sketch Pad


Number
Required
Description of Part
Suggested
Supplier
Total
Cost
3
Linear taper pot, 1 meg, mil spec, CMU1052
Jameco
$9.00
1
16-pin DIP header
Jameco
    .70
2
Pushbuttons, #275-609
R.S.
  1.90
1
Box, #270-230
R.S.
  1.90
12 feet
feet Telephone cable, #278-365
R.S.
  3.00
2
Resistors, 1K, 1/4 watt
R.S.
    .40
2 sq.ft.
Plywood, 1/2" hardwood preferred

  4.00
1 sq.ft.
Sheet metal, aluminum or steel

  1.00
2
Bolts, 1/4 x 2"

    .60
2
Wing nuts, 1/4"

    .30
2
Flat washers, 1/4"

    .10
16
Flathead wood screws, #6 x 1/2"

    .60
10
Flathead wood screws, #8 x 1"

    .60
3
Bolts with lockwashers and nuts, #6 x 1/2"

    .40
2
Bolts with nuts, #8 x 1-3/4"

    .30
6
Pop rivets, 1/8" x 3/16"

    .40
1
Brass tube (to fit pencil)
Hobby shop
    .60
Misc.
Cotton felt, sandpaper, varnish, etc

  2.50



______


Approximate
Cost

$28.00

   Suppliers:    
Jameco Electronics
1355 Shoreway Road Belmont, CA 94002
Minimum order $10.00

R.S.-Radio Shack
See Yellow Pages

All other parts were purchased at a local hardware store.

Return to Table of Contents | Previous Chapter | Next Chapter