Introduction: Etch-i-Sketch

"We can't compete with that!" --Steve Jobs('s doppleganger)

"'Zune'?  What were we thinking?  This is what we need." --Bill Gates('s likely thoughts)

 "But needing a power source ruins the point..." --Ohio Art('s worthless opinion)



Tired of conventional portable electronics being too darned portable?  Spoiled by the convenience of modern technology?  Do capacitive sensors make for too much touch?  Can your own Retinas not handle 16 million colors?

Well how about just two?

Ladies and Gentlemen, I give you the Etch-i-Sketch.

What is it, you ask?  First I'll explain what it isn't .  The Etch-i-Sketch isn't just another Etch-A-Sketch with motors strapped to the knobs or with a resistive touch panel taped to the front  (though I will not deny that it sports such features at this juncture).

No, as the lower-case "i" implies, we're making a sleek(?) and modern(?), coherent, portable(?) computer platform based on the Cypress PSoC that just happens to sport an unconventional mechanical display, to compete with established platforms like the iPhone/iPad and Android.  I say "we" because the code will soon be opened up to allow users to leverage my API to design their own applications to run on the device!

If you're looking for a flawless and full-featured device, you need not continue (or follow my directions exactly, anyway).  If we're following the lead of our competitors that closely, there will be a new, slightly improved version of the hardware out every year or so anyway, so stay tuned for that.

 To everyone else... Come on, "early adopters"!  Let's get started!

Step 1: Gathering Parts

We can't mess with software without hardware, so first we have to physically slap this puppy together.  Keep in mind that what you see is cobbled together with things I had around or were available within a week's notice, not necessarily things that are ideal (some things are messy some things are overcomplicated, some things are just plain bad.. like the tiny baby stepper motors without gearing).  Use your own judgement when applicable.  There are a few hard rules with the way the code is right now (it won't stay that way, I promise), which we'll get to when I describe the code, but besides that, improvisation is encouraged.

Here's a list of the parts I used:

-(1) PSoC CY8C29466-24PXI "PSoC1" microcontroller.  This version is a 28-pin DIP package.
-(1) 28-pin DIP socket for said PSoC.
-(3) 25LC1024-I/P 1MBIT EEPROMs.  These are 8-pin DIP package SPI EEPROMs.  They hold 128 kilobytes each.  Currently used for save files.
-(3) 8-pin DIP sockets for the EEPROMs.
-(2) L293D inductive drivers for driving the stepper motors.  Each can drive 4 ourputs, so it's one per motor.
-(1) Murata OKI-78SR 5V DC/DC converter.  This is a drop-in replacement from a TO-220 regulator, except it's an efficient switching converte.  This is used to derive 5V from the higher voltage supplied to the motors for use with the logic gadgets.
-(5 sections) 0.1" pitch male header.  This will be used to put a programming header on the board.  The PSoC's "MiniProg" programmer uses this sort of form factor.
 -(1) HLW4R-2C7LF FFC connector.  This four-position, 1mm pitch connector is used to couple the touchscreen's flat flexible cable to some more manageable wires for connection to the PSoC.
-Some decoupling capacitors.  I'm using a 10 microfarad at the output of the 5V DC/DC converter and a 0.1 microfarad across the power and ground pins of the PSoC.  Don't be like me!  All digial logic devices should really have a decoupling capacitor across like this.
-(1) Perfboard for mounting the circuitry on.
-(2) unipolar, 6-wire stepper motors.  These were the only ones I had, and the ones the code is set up for right now.  They're 48 "ticks" per revolution, and are just coupled directly.. no gearing.  Yeah.  In order to use the whole length/width of the screen, yours have to be like this too.  It might just make more sense to wait for a fix.
-(2) 1 inch to 1/2 inch copper plumbing couplers.  These will be used to couple the motors to the knobs of the Etch-A-Sketch since Etch-A-Sketch knobs are about an inch in diameter.  The other end billed as "1/2 inch" really has more like a 5/8 inch diameter.
-(2) Clamps capable of closing down to a ~1/2 inch diameter.
-(2) Clams capable of closing down to a ~1 inch diameter.
-(1) Standard Etch-A-Sketch.
-(1) Flat (1/16 inch) strip of aluminum long enough to get two ~8 inch pieces from.

Not specifically pictured:
-(1) 8.4" ELO AT4 4-wire resistive touch panel.  The driving/reading process should be about the same for any 4-wire touch panel, but I can't guarantee my code will work with others as it is.
-(1) 5/8 inch wood dowel for the couplings.
-Lots of wire.  Different colors help.
-Nuts and bolts.

Optional:
 -A beefy battery.  All I had was a benchtop power supply.

Other:
Tools abound.  It'd be great to have, at least, soldering supplies, a hacksaw, a drill(press), screwdrivers, pliers, and tape.

Step 2: Soldering

This guide assumes you already have some soldering skills.  As such, I'll kind of gloss over this part except for showing my general sort of progression and order.  Follow along with the pictures.

In general, this is how things need to be connected:
 (Note that the "Stepper windings" are numbered with respect to the order that they need to be activated in to advance in a clockwise direction.  "Stepper voltage" is the high voltage that drives the stepper motor.  This voltage is the input of the DC/DC converter.  The output of this converter is the "5V" listed.  The "COMMON" lines of the stepper motors need to be tied to "Stepper voltage".  The touch panel pins are numbered from left-to-right looking at the HLW4R-2C7LF connector head-on, with the contacts on the top.)

PSoC:
Pin 1:     Touch panel pin 4
Pin 2:     Touch panel pin 3
Pin 3:     Touch panel pin 2
Pin 4:     Touch panel pin 1
Pin 5:     L293D (Right) pin 11
Pin 6:     L293D (Right) pin 15
Pin 7:     L293D (Left) pin 11
Pin 8:     L293D (Left) pin 15
Pin 9:     No connection
Pin 10:   All EEPROMs pin 6
Pin 11:   All EEPROMs pin 5
Pin 12:   EEPROM A pin 7
Pin 13:   Programming header pin 2
Pin 14:   GND
Pin 15:   Programming header pin 1
Pin 16:   EEPROM A pin 1
Pin 17:   EEPROM B pin 1
Pin 18:   EEPROM C pin 1
Pin 19:   Programming header pin 3
Pin 20:   L293D (Left) pin 7
Pin 21:   L293D (Left) pin 2
Pin 22:   L293D (Right) pin 7
Pin 23:   L293D (Right) pin 2
Pin 24:   All EEPROMs pin 2
Pin 25:   EEPROM B pin 7
Pin 26:   EEPROM C pin 7
Pin 27:   No connection
Pin 28:   5V

(Note there are three EEPROMs in this implementation.  When multiple connections are listed, they apply to EEPROMs A, B, and C respectively)
EEPROMs:
Pin 1:     PSoC pin 16, PSoC pin 17, PSoC pin 18
Pin 2:     PSoC pin 24
Pin 3:     5V
Pin 4:     GND
Pin 5:     PSoC pin 11
Pin 6:     PSoC pin 10
Pin 7:     PSoC pin 12, PSoC pin 25, PSoC pin 26
Pin 8:     5V

L293D (Left Motor):
Pin 1:     5V
Pin 2:     PSoC pin 21
Pin 3:     Stepper winding 3
Pin 4:     GND
Pin 5:     GND
Pin 6:     Stepper winding 1
Pin 7:     PSoC pin 20
Pin 8:     Stepper voltage
Pin 9:     5V
Pin 10:   Stepper winding 4
Pin 11:   PSoC pin 7
Pin 12:   GND
Pin 13:   GND
Pin 14:   Stepper winding 2
Pin 15:   PSoC pin 8
Pin 16:   5V

L293D (Right Motor):
Pin 1:     5V
Pin 2:     PSoC pin 23
Pin 3:     Stepper winding 3
Pin 4:     GND
Pin 5:     GND
Pin 6:     Stepper winding 1
Pin 7:     PSoC pin 22
Pin 8:     Stepper voltage
Pin 9:     5V
Pin 10:   Stepper winding 4
Pin 11:   PSoC pin 5
Pin 12:   GND
Pin 13:   GND
Pin 14:   Stepper winding 2
Pin 15:   PSoC pin 6
Pin 16:   5V

Programming Header:
(Note:  The numbering I used is for viewing the board from the top, left-to-right.  In this order, the MiniProg's pins are SDA, SCLK, XRES, GND, VDD)
Pin 1:     PSoC pin 15
Pin 2:     PSoC pin 13
Pin 3:     PSoC pin 19
Pin 4:     GND
Pin 5:     5V

Step 3: Mounting the Stepper Motors

The last major step in physical assembly is mounting the stepper motors onto the knobs of the etch-a-sketch. Again, my method isn't necessarily the best or even acceptable for normal operation, so feel free to deviate.  What's necessary for the code in its current form is that there be 48 "ticks" per revolution.  Screen width is 204 ticks, and height is 144.

Yes, I could've just glued everything together or something, but a major goal of this version of the design was to not permanently affect any component being used.  These couplings should be able to be removed, so you're left with a perfectly fine Etch-A-Sketch and motors.

Follow along with the annotated images.

Step 4: Finished! Final Touches, Code, and the Future.

I affixed in a professional manner (read:  taped) the touch panel to the Etch-A-Sketch over the "screen" and plugged it in.  That's it!

Cypress offers some different ways to program this thing, but you'll probably want the MiniProg USB programmer.  Use it with the programming header we put on (with the way we ordered the pins, keep the front of it facing up.

Stay tuned--I'll distribute the code as soon as it's cleaned up a little, made presentable and readable.  In the meantime, the hex file for a "demo" app is attached below.  This simple program will first run through a calibration routine--it'll trace around the border of the screen.  When it settles at the top-left corner, press and hold that point firmly.  Repeat with the bottom-right corner when it settles there.  The etcher will return to the bottom left.  When this is done, trace anywhere on the screen and the etcher will draw it.  Note that the motor speed's turned down quite a bit right now... bear with it.  It shouldn't miss any of your motions anyway, just give it a chance to keep up.

I'll go over some features that are ready or coming soon, but not featured in this demo:

The raw crud behind most everything (and something for eager developers to start thinking about) is a pair of C functions--one to poll the touch panel and return the state (touched or not) and coordinates (translated using calibration data to stepper position) of that touch.  The other is the function that drives the stepper motors--the arguments are the X and Y coordinates of the destination.  The etcher will move in a straight line to that point.  The motor that needs to travel the farthest distance gets the maximum speed, while the speed of the slower motor is scalled proportionally to the slope of the line it needs to travel across.  Though not yet cleanly implemented, there are provisions to change these speeds even while in the motors are in motion. The developer has access at all times to the current position of the etcher, too.


There's a general menu/submenu system, with options paint, games (or apps), and options.  Options allows the user to recalibrate if it the screen gets shifted a bit or something (yes, I realize that this means the user needs a reliable touchscreen in order to make the touchscreen reliable, there will be "emergency" ways on boot-up).  Calibration will typically be saved in the PSoC's internal Flash, so setting will be saved when the device is powered off.

 The paint application is similar to the thing seen in the demos, but with more options.  Users can load/save drawings to and from the EEPROMs.  Currently, this is the only use for those chips--one keeps constantly keeps a log of inputs.  If the power gets cut, the user can recover from this backup.  Otherwise, when the user chooses to save, this is copied out to one of the other EEPROMs.  A "load" operation traces out a saved set of inputs as quickly as possible--the user will get a carbon (aluminum?) copy of an image he or she has previously drawn that they can further edit.

Games/apps are a bit limited right now.  I kind of recycled some code from another project to allow some fixed point trig for some basic 2D game design stuff.  There are some pong-ish ball bouncing demos/tests and whatnot as of now.

I still want to put in a kind of standardized text-drawing system (a software keyboard would be handy for some things, too).


 Anyway, there's a lot of room for future improvement for both hardware, too. 

You may've picked up on one of the... inconviences associated with this high-tech screen.  Erasing is a bit of a mess.  The device isn't very conducive to shaking right now, but an X is drawn across the screen when it needs to clear.  The user then... um... manually overrides the picture element state and then touches the screen anywhere and the program continues, drawing in what is needed.  In future hardware versions, I hope to automate, or at least streamline erasing.

Obviously there's a second "feature" that may be keeping some people from jumping from LCDs to this new technology (people like familiarity, I guess), and that is the fact that the etcher can never lift off the screen.  While a big focus of this version was keeping the Etch-A-Sketch unadulterated, in future versions, I plan to move some of the gadgetry inside.  One thing I hope to do is replace the stock etcher with a new doodad featuring an electromagnet and a spring, so this "feature" could be disabled by those not ready to embrace the future.  It would work a lot more like a traditional vector display, with not just X and Y position control, but a "beam" enable/disable (touch/release) as well.

Another change I'd like to make when opening the thing up is replacing the stock glass panel in the etch-a-sketch with the glass-backed touch panel itself.  No idea how well or badly this is gonna go.

Something else that has to change is the fact that this thing can't auto-center on startup.  It's purely open-loop right now, so it relies on being manually reset by the user to the bottom-left corner of the screen before power-up.

I just used a benchtop supply for testing, but for this thing to be viable as a portable platform,  it'll need a battery (okay, so a pretty beefy one) and integrated charging circuit.

Ideally, I'd like to replace the EEPROMs with an SD card.

And if we're really serious about competing with Apple, this thing obviously needs 3G, Wi-Fi, and GPS, too.  Yep.


Anyway,  in parting I offer you these really lousy couple-second-long clips of tests from during development, teasers for what to expect, that I took with the only camera I have available (I'm sorry, really!)



 Whatever, guys, have fun!  I look forward to working with you!  Hold in your heart the image of the day where every trendy individual is carrying one of these bad boys around!
Toy Challenge

Participated in the
Toy Challenge

Microcontroller Contest

Participated in the
Microcontroller Contest