Instructables
Picture of Arduino Etch-A-Sketch Clock
I've seen various Arduino driven Etch-A-Sketch clocks on the web , but none with instructions (is it some kind of secret? Is someone planning on making it rich in the Etch-A-Sketch Clock global market?). I've used Arduino, but never used stepper motors, real time clocks, never coded to this level (turned out quite simple really), and never really built something from scratch. 

I took the code from someone who had made an EAS (Etch-A-Sketch) that drew random lines, then learnt from there (his code taught me how to drive steppers and how to use case statements).


It's all actually rather simple. The hardest part is defining each numerical digit in code as each EAS is slightly different. For example, when you turn an EAS knob left the "cursor" on the EAS goes left. You could measure this, and quickly write the code that "-1600" steps of the stepper motor draws 2cm of line on the EAS in the left direction.

You would then assume that "+1600" steps would give 2cm of line on the EAS in the right direction, but it won't. You'll probably get around 1cm. This is because the EAS is an "analogue" device with it's own analogue foibles. You'll notice that when you turn a knob in one direction, and then change direction, the drawing stylus will lag behind as slack in the internal mechanisms is taken up.

The exact distance each EAS knob moves the stylus/cursor on the EAS is dependent on what it last did! i.e. if the EAS just moved up, then the next move to the right will be different than if it just moved left. etc etc.

This means each number/digit has to be calculated manually. It was a lot of work. Not difficult, but it required patience. I did it over several evenings. You will notice the digits 8,9 and 0 are not so pretty as these were the last ones to do and I had lost my patience by then! You can fine tune them easily :-)

To work out the numbers I printed 0-9 in a "digital" font and then cut the numbers out. I then stuck them on the EAS and "drew" around them with the EAS test code (more on that later).
 
Remove these adsRemove these ads by Signing Up

Step 1: BOM - Bill of Materials (Parts list for us Brits!)

This is fairly fluid - I'll give you a few options at the end.

Perspex/Acrylic Sheet A3 - 3mm thick   £5
Perspex/Acrylic Sheet A3 - 4mm thick   £6.80

All of the below were from http://www.zappautomation.co.uk/en/
8mm smooth steel rod 300mm  SFC8  £3.60
8mm rod clamps x 2  SK08   £2.82
T2.5 32 tooth pulley for EAS rotation  £3.49
T2.5 Belt 6mm wide  145mm long for EAS rotation £3.96
Nema 17 motor SY42STH33-1334A for EAS rotation £11.00  (I found better since, read later)

These were from beltingonline.com
T2.5 6mm wide 177.50 long belts x 2  £6.98 for both
T2.5 30 tooth pulley x 2   £5.91 for both
T2.5 20 tooth pulley x 4  £10.94 for all 4 ( you only need 3)

ITC RTC DS1307 AT24C32 - Real Time Clock with rechargeable battery £2.85 Ebay Chinese seller
5v Stepper motor with ULN2003 driver x 2    £3.30 each or less - Ebay
EasyDriver - Arduino stepper motor driver (http://www.schmalzhaus.com/EasyDriver/)   £3.00 or less - Ebay (Chinese sellers)

Etch-A-Sketch - around £10 from Tesco online.
12V Power supply - at least 2 Amps - £varies

Arduino ATMega328 Arduino Uno chip kit   £3.50 - this is the Arduino chip, resistors, crystal, and 5V regulator kit. You could just as well buy any Arduino on a board. It doesn't matter. This is just the cheapest way.

Additional Notes:

The small stepper motors (x2) with the ULN2003 drivers cost next to nothing on Ebay. I bought them as I was experimenting and didn't even know if I was going to be able to get this to work at all so didn't want to commit too much money. They are slow. But they work. They also get very hot, but seem ok. They are slow enough that it takes around 2.5 minutes to draw the time. I then have the clock pause a while, then draw the time again. This way the motors can keep up, and the EAS is not constantly updating, which would surely wear it out in short order. My next step is to replace them with Nema 17 motors.

The stepper motor for the EAS rotation was a mistake. I didn't know what I was doing. It works, but only just! - It requires 1.3Amps per phase to run at full torque and is also quite a small motor. The EasyDriver stepper driver is only rated to around 750ma, so it can't run the stepper at full torque. With adjustment of the power screw on the EasyDriver it turns the EAS, but the weight of the EAS has to be balanced fairly well to take the work out of it.

I since bought some Nema 17 Stepper motors that are rated at 0.8amp per phase at 6v and they are unstoppable!

The easy driver can also be substituted with a generic L298N 4 wire stepper driver - but they cost nearly the same, and don't have nice smooth microstepping like the EasyDriver has, and they use more wires! I left the commented-out code in the main Arduino sketch so you can see where I 1st used one of these drivers to turn the EAS (before I burnt it out using the wrong motor!).

Step 2: Construction - Frame

Picture of Construction - Frame
Frame side.JPG
Frame rear.JPG
This is the first thing you need to make as you can't really test any motor control of the EAS with out it. You don't need to worry about adding the EAS rotation motor control until much later if you don't want to. Make sure you build the EAS frame (holder) first so you know what height to mount it so it doesn't hit the base when it rotates!

I used 4mm acrylic for the base and sides, and 3mm acrylic for the EAS holder/frame.

You will want to build yours to your taste, but to help you, my dimensions (rough) are:

Base = 20cm by 32cm
Sides = 10cm x 18cm
Side shaft/spindle hole = 16cm from base

EAS frame 3mm plate (unbent) = 30-31cm long x 24.5 wide ( could be thinner)

For the EAS frame (holder) I used a heat gun to bend the acrylic into a "U" shape at the bottom. This was neither easy, or neat! - I had to reheat the acrylic several times to get it mostly flat!. Google how to bend acrylic - you just place it on a good straight edge and then heat it up and it bends. The result is fine for casual inspection. When I add larger Nema 17 steppers later I will cut a piece of acrylic to mount the motors underneath, then attach this piece of acrylic to the main plate with 3cm stand-offs.

I fixed the sides to the base with spare 45 dgree angle brackets I had lying around, and then riveted them together. You could equally screw them together with nuts and bolts - I'd recommend M3.

To attach the EAS I tried several experiments. I learnt that any hole in the EAS is a mistake! Try it - and then try cleaning up aluminium powder....   In the end I glued the EAS knobs (which just pull off) on the back of the EAS using epoxy 2 part adhesive and drilled 2mm holes in them. I had 4 of these as I'd already experimented with drilling into another EAS......    Just use whatever you have to hand to put the EAS at a distance away from the plate that works for you. My system allows me to remove the EAS with 4 screws, for testing etc.

Step 3: Construction - Driving the EAS Knobs

Picture of Construction - Driving the EAS Knobs
Front pulley drivers.JPG
The motors for the EAS knobs are just screwed (M3 nuts and bolts) into the acrylic. Drill the holes for the screws larger than you need, then use washers on the bolts. This way you can adjust the belt tension by moving the motor on its holes.

Your motor pulleys should have 5mm holes. These will match the motor shafts well enough (or perfectly for NEMA 17 motors). Order your pulleys with the right diameter holes - I didn't - and even with a pillar drill, I managed to drill non-central holes - this really messes up the belt tension.

The larger pulleys again need 5mm holes. The 30T pulleys come with 6mm holes, so I bought some 5mm internal dia brass tubing and slid them in to reduce the 6mm holes to 5mm.

The belt tension needs to be tight, without bending the plastic EAS shafts.

I placed the driver boards that come with the steppers on the back of the EAS mount and just passed the wires round. If I'd thought ahead I would have drilled 8mm holes and passed the plugs and wires through the holes.

Step 4: Construction - Mounting and Driving the EAS Rotation

To mount the EAS  to the base and sides I used 8mm steel rod as the "axle", with clamps to hold the rod.

What I did first, was with the EAS mounted, and with the motors installed, I rested the whole thing on my finger tips to find the centre of gravity of the whole of the EAS - i.e. where to mount the steel rod so it would be at the balance point if you were to have the EAS flat, pointing at the ceiling. This is the first stage of balancing the whole contraption.

I then bolted on the clamps, and fed the steel bar through. I drilled 8mm holes in the side panels to take the bar. In my design I needed spacers between the clams and the side frames, so I bought some hollow round aluminium rod from B&Q that has an id that is larger than 8mm, and cut the spacers off it.

The next stage is to counter weight the whole thing so it doesn't want to spin of it's own accord. This is the aluminium tube sticking out the back with some steel and a g-clamp on it. This is my rough solution to balancing the weight. You can work out a more elegant solution!

When you are done, the whole EAS should rotate fairly evenly, without wanting to naturally fall in a specific direction all the time. The more balanced this is, the less the rotation motor has to work.

Finally, I mounted a NEMA 17 motor on the side, using two pulleys to rotate the EAS. I mounted the motor using metal stand-offs that suited the distance I needed the motor away from the frame. I have a fair few stand-offs to hand - I recommend you buy an assorted lot of them off ebay - they are so useful.

My stand-offs are female-female - so I cut the end of some small screws to make them studs for the motor end.

Again, the belt tension here wants to be tight, but not insanely so.

Step 5: Electronics

I'm not going to hand hold you too much here as it's all very standard stuff, and all the important connections are detailed in the Arduino Sketch files. If any of this is news to you then grab a breadboard and do a few basic arduino tutorials 1st, like blinking an LED... - but in summary.... (update - I've attached a rough and ready circuit diagram)

The main board is a standard Arduino 328 with it's standard crystal, capacitors, pull down resistors and an LED on chip pin 19 (So I can see when it has power and it flickers when I upload a sketch). Just google Arduino breadboard (http://arduino.cc/en/Main/Standalone) - it's the same - but I don't bother with the 5v regulator because the EasyDriver stepper driver board has 5v reg built in and I use this to power the arduino.

I use a USB FTDI programmer and just patch into the arduino with Tx and Rx (and power and earth and reset) - this is the 5 pin breakout on my circuit board..

I used a prototyping board as the circuit is so simple it's not worth printing a PCB (see my other Instructable! :-)  )

The real time clock is dead simple. It connects to ground and +5v, and then SCL goes to analogue 5 on the aruino (chip pin28) and SDA goes to analogue pin 4 (chip pin 27). That's it! It's really worth adding one of these. Without it, you would have to set the time in the Arduino each time you powered it up - and doing that with a slow drawing clock would be a nightmare. This way, the arduino keeps the time when it's powered off. 

The stepper drivers for the two EAS knobs connect as per the arduino sketch comments - vertical stepper in1, in2, in3, in4 goes to arduino digital  4,5,6,7, horizontal stepper (in1..2..3..4) goes to arduino digital pins 2,3,12,13. The stepper motor drivers connect to your 12v source - ground and live.

The EasyDriver connects to ground and live 12v again, and then the DIR pin goes to arduino digital 8, and the STEP pin goes to arduino digital 9 (easy hey!! :-)  )

I hot glued the RTC to the project board, then hot glued everything to a spare bit of acrylic, which I stuck to the main EAS plate with double sided foam tape.

As you can see, the steppers are powered by 12V directly - this is where they get their power! - they then get their signals from the low voltage arduino side.

The rest, is all in the code...

Step 6: Software - Setting the clock

Picture of Software - Setting the clock
The software is broken up into 3 separate sketches.

1- The clock setting

This program simply sets the time on the RTC chip to that of your programming PC.
You'll need to install the DS1307RTC library into your arduino IDE,
Copy and paste into Arduino IDE, Compile it, upload it, and run it.
Call up the serial monitor in Arduino IDE and you will see it confirm the time it has set on the RTC chip.

Done! - you never really need to use this again.

Tip - set your PC clock around 3 minutes fast when you do this. This way the EAS clock is always around 3 minutes fast, and by the time it has finished drawing the time in the EAS, it will be right! i.e. by the time it gets to the second minute digit , it will almost be three minutes after it started - so it will be right :-)

#include
#include
#include


tmElements_t tm;

void setup() {
  bool parse=false;
  bool config=false;

  // get the date and time the compiler was run
  if (getTime(__TIME__)) {
    parse = true;
    // and configure the RTC with this info
    if (RTC.write(tm)) {
      config = true;
    }
  }

  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor
  delay(200);
  if (parse && config) {
    Serial.print("DS1307 configured Time=");
    Serial.print(__TIME__);
   } else if (parse) {
    Serial.println("DS1307 Communication Error :-{");
    Serial.println("Please check your circuitry");
  } else {
    Serial.print("Could not parse info from the compiler, Time=\"");
    Serial.print(__TIME__);
    Serial.println("\"");
  }
}

void loop() {
}

bool getTime(const char *str)
{
  int Hour, Min, Sec;

  if (sscanf(str, "%d:%d:%d", &Hour, &Min, &Sec) != 3) return false;
  tm.Hour = Hour;
  tm.Minute = Min;
  tm.Second = Sec;
  return true;
}



Step 7: Software - Testing

2 - Testing the hardware

This arduino sketch is what I created to test everything other than the timekeeping, and draw and define the digits on the EAS.

Again, copy, paste, compile, upload, run.

For this program, you want to load the arduino IDE serial monitor each time you run it, as this is how we are going to control the EAS.

In the serial monitor, key the following, followed by enter, to:

c - clears the screen - i.e. rotates the EAS 
r,l,u d  - right, left, up and down for a small amount - the EAS cursor/stylus
p - loooong left return - be careful with this, you don't want to drive the EAS past it's edges. This is useful when testing number drawing and you end up at the far right end of the screen.
0-9 - draws 0 to 9 on the screen

Using this program, you can see how it will draw the numbers on your particular EAS and then edit the code to fine tune it.

/*
Small Stepper Motor and Driver
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=126
terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Stepper.h>

/*-----( Declare Constants, Pin Numbers )-----*/
#define STEPS 32 //Number of steps per revolution
//#define STEPSSIDE 200 //number steps side motor
/*-----( Declare objects )-----*/
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
//The pin connections need to be 4 pins connected
// to Motor Driver In1, In2, In3, In4 and then the pins entered
// here in the sequence 1-3-2-4 for proper sequencing
Stepper small_stepperV(STEPS, 4, 6, 5, 7);
Stepper small_stepperH(STEPS, 2, 12, 3, 13);
//Stepper small_stepperR(STEPSSIDE, 8, 10, 9, 11);
/*-----( Declare Variables )-----*/

void setup() /*----( SETUP: RUNS ONCE )----*/
{
// set the speed of the motor
small_stepperH.setSpeed(700);
small_stepperV.setSpeed(700);
  pinMode(8, OUTPUT);    
  pinMode(9, OUTPUT);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
 
// initialize serial communication:
Serial.begin(9600);
}/*--(end setup )---*/

void loop() /*----( LOOP: RUNS CONSTANTLY )----*/

{
if (Serial.available() > 0) {
int inByte = Serial.read();





switch (inByte) {

case 'c':  
//  small_stepperR.step(-150);
//  delay(1000);
//  small_stepperR.step(150);
//  delay(2000);
digitalWrite(8, LOW);
for (int microsteps = 1; microsteps < 1400; microsteps++) {
  digitalWrite(9, HIGH);
  delay(1);         
  digitalWrite(9, LOW);
  delay(1);
}
delay(1000);
digitalWrite(8, HIGH);
for (int microsteps = 1; microsteps < 1400; microsteps++) {
  digitalWrite(9, HIGH);
  delay(1);         
  digitalWrite(9, LOW);
  delay(1);
}
break;

case 'r':
Serial.println("RIGHT!");
small_stepperH.step(500);
delay(200);
break;

case 'p':
Serial.println("LONG LEFT");
small_stepperH.step(-10000);
delay(200);
break;

case 'l':
Serial.println("LEFT!");
small_stepperH.step(-500);
delay(200);
break;

case 'u':
Serial.println("UP");
small_stepperV.step(500);
delay(200);
break;

case 'd':
Serial.println("DOWN");
small_stepperV.step(-500);
delay(200);
break;

case '1':
Serial.println("1");
small_stepperH.step(700); //right
small_stepperV.step(3100); //up
small_stepperH.step(500); //right
small_stepperV.step(-3070); //down
small_stepperH.step(-1000); //left
small_stepperH.step(1700); //right
delay(200);
break;

case '2':
Serial.println("2");
small_stepperV.step(2000); //up
small_stepperH.step(1400); //right
small_stepperV.step(600); //up
small_stepperH.step(-1750); //left
small_stepperV.step(500); //up
small_stepperH.step(2200); //right
small_stepperV.step(-1950); //down
small_stepperH.step(-1600); //left
small_stepperV.step(-600); //down
small_stepperH.step(1600); //right
small_stepperV.step(-500); //down
small_stepperH.step(-2200); //left
small_stepperH.step(2200); //right

delay(200);
break;

case '3':
Serial.println("3");
small_stepperH.step(2000); //right
small_stepperV.step(3100); //up
small_stepperH.step(-2250); //left
small_stepperV.step(-950); //down
small_stepperH.step(1700); //right
small_stepperV.step(-500); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-550); //down
small_stepperH.step(1650); //right
small_stepperV.step(-550); //down
small_stepperH.step(-1700); //left
small_stepperV.step(-550); //down
small_stepperH.step(2150); //right
delay(200);
break;

case '4':
Serial.println("4");
small_stepperH.step(1800); //right
small_stepperV.step(3100); //up
small_stepperH.step(-950); //left
small_stepperV.step(-1500); //down
small_stepperH.step(-650); //left
small_stepperV.step(1500); //up
small_stepperH.step(-600); //left
small_stepperV.step(-1950); //down
small_stepperH.step(1600); //right
small_stepperV.step(-1130); //down
small_stepperH.step(630); //right
  delay(200);
break;

case '5':
Serial.println("5");
small_stepperV.step(1000); //up
small_stepperH.step(1300); //right
small_stepperV.step(600); //up
small_stepperH.step(-1700); //left
small_stepperV.step(1500); //up
small_stepperH.step(2100); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1700); //left
small_stepperV.step(-650); //down
small_stepperH.step(1700); //right
small_stepperV.step(-1450); //down
small_stepperH.step(-2200); //left
small_stepperH.step(2200); //right
  delay(200);
break;

case '6':
Serial.println("6");
small_stepperV.step(3100); //up
small_stepperH.step(1750); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-700); //down
small_stepperH.step(1650); //right
small_stepperV.step(-1450); //down
small_stepperH.step(-2200); //left
small_stepperH.step(950); //right

small_stepperV.step(1500); //up
small_stepperH.step(800); //right
small_stepperV.step(-1000); //down
small_stepperH.step(-1150); //left
small_stepperV.step(-480); //down
small_stepperH.step(1650); //right
delay(200);
break;

case '7':
Serial.println("7");
small_stepperH.step(1250); //right
small_stepperV.step(2600); //up
small_stepperH.step(-1100); //left
small_stepperV.step(-1200); //down
small_stepperH.step(-600); //left
small_stepperV.step(1670); //up
small_stepperH.step(2200); //right
small_stepperV.step(-3020); //down
small_stepperH.step(-900); //left
small_stepperH.step(1000); //right
delay(200);
break;

case '8':
Serial.println("8");
small_stepperV.step(3100); //up
small_stepperH.step(1750); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-700); //down
small_stepperH.step(1150); //right

small_stepperV.step(1200); //up
small_stepperH.step(470); //right
small_stepperV.step(-2600); //down
small_stepperH.step(-2200); //left
small_stepperH.step(950); //right

small_stepperV.step(1500); //up
small_stepperH.step(800); //right
small_stepperV.step(-1000); //down
small_stepperH.step(-1160); //left
small_stepperV.step(-500); //down
small_stepperH.step(1700); //right
delay(200);
break;

case '9':
Serial.println("9");
small_stepperH.step(1250); //right
small_stepperV.step(2650); //up
small_stepperH.step(-1100); //left
small_stepperV.step(-1200); //down

small_stepperH.step(1050); //right
small_stepperV.step(-450); //down

small_stepperH.step(-1550); //left
small_stepperV.step(2050); //up
small_stepperH.step(2150); //right
small_stepperV.step(-3050); //down
small_stepperH.step(-900); //left
small_stepperH.step(1000); //right
delay(200);
break;

case '0':
Serial.println("0");
small_stepperV.step(3100); //up
small_stepperH.step(1850); //right
small_stepperV.step(-3050); //down
small_stepperH.step(-2200); //left
small_stepperH.step(800); //right
small_stepperV.step(2500); //up
small_stepperH.step(850); //right
small_stepperV.step(-2000); //down
small_stepperH.step(-1200); //left
small_stepperV.step(-530); //down
small_stepperH.step(1850); //right

delay(200);
break;


}}}


Step 8: Software - the Main Code!

3 - Main code

Ok, this is the main program - you overwrite the test program with this.

You'll need to install the "Time" library though I think this is installed by default.

I'll talk you through the main functions of the code. I'm still very much a learner so I may well have chosen some clumsy methods, but it works.

The main hurdles are:

- Read the time
- Convert the hours from 24 hour format to 12 hour format, and stop the 0 from the 1st digit - don't want it drawing  "08  32"  - waste of time drawing the zero.
- take the minutes and strip them into individual digits.
- draw the time, each digit taking the same amount of space so that the cursor on the EAS always returns to the same place, ready for the next time update.  

I've done the time conversions with remote function calls (getDigit and hourConverter). print2digits is not used but was part of the testing.

There is a lot of commented testing code left in for your benefit. A lot of the testing of the actual time keeping was done via the IDE serial monitor - the EAS is far too slow for testing that kind of thing.

/*-----( Import needed libraries )-----*/
#include <DS1307RTC.h>
#include <Time.h>
#include <Wire.h>
#include <Stepper.h>
/*-----( Declare Constants, Pin Numbers )-----*/
#define STEPS 32 //Number of steps per revolution
#define STEPSSIDE 200 //number steps side motor
/*-----( Declare objects )-----*/
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
//The pin connections need to be 4 pins connected
// to Motor Driver In1, In2, In3, In4 and then the pins entered
// here in the sequence 1-3-2-4 for proper sequencing
Stepper small_stepperV(STEPS, 4, 6, 5, 7);
Stepper small_stepperH(STEPS, 2, 12, 3, 13);

void setup() {
  Serial.begin(9600);
  // set the speed of the motor
  small_stepperH.setSpeed(700);
  small_stepperV.setSpeed(700);
  pinMode(8, OUTPUT);    
  pinMode(9, OUTPUT);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
}

void loop() {
  tmElements_t tm;
  RTC.read(tm);
   
// MAJOR IF SECTION - check if the minute is a multiple of 5
//if ((getDigit (tm.Minute,1)) == 5 || (getDigit (tm.Minute,1)) == 0) {  // RE-ENABLE FOR 5 MIN UPDATE

// Clear EAS screen using an EasyDriver wired with Direction pin to Arduino pin 8, and Step pin to Aruino pin 9

  digitalWrite(8, LOW);
  for (int microsteps = 1; microsteps < 1400; microsteps++) {
  digitalWrite(9, HIGH);
  delay(1);         
  digitalWrite(9, LOW);
  delay(1);
}
  delay(1000);
  digitalWrite(8, HIGH);
  for (int microsteps = 1; microsteps < 1400; microsteps++) {
  digitalWrite(9, HIGH);
  delay(1);         
  digitalWrite(9, LOW);
  delay(1);
}
   
/*    Serial.print("Ok, Hour = ");
    Serial.print(hourConverter(tm.Hour));
    //hourConvert(tm.Hour);
    // Serial.print(tm.Hour);
    Serial.write(',   ');
    Serial.print("Minutes = ");
    print2digits(tm.Minute);
    //Serial.print(tm.Minute);
    Serial.println();
*/
// Main time extraction section
     // Extract and Draw HOUR
    if ((hourConverter(tm.Hour)) == 1) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch1 ();
      } else if ((hourConverter(tm.Hour)) == 2) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch2 ();
      } else if ((hourConverter(tm.Hour)) == 3) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch3 ();
      } else if ((hourConverter(tm.Hour)) == 4) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch4 ();
      } else if ((hourConverter(tm.Hour)) == 5) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch5 ();
      } else if ((hourConverter(tm.Hour)) == 6) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch6 ();
      } else if ((hourConverter(tm.Hour)) == 7) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch7 ();
      } else if ((hourConverter(tm.Hour)) == 8) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch8 ();
      } else if ((hourConverter(tm.Hour)) == 9) {
        sketchBlank ();
        sketchSpaceSml ();
        sketch9 ();
      } else if ((hourConverter(tm.Hour)) == 10) {
        sketch1 ();
        sketchSpaceSml ();
        sketch0 ();
      } else if ((hourConverter(tm.Hour)) == 11) {
        sketch1 ();
        sketchSpaceSml ();
        sketch1 ();
      } else if ((hourConverter(tm.Hour)) == 12) {
        sketch1 ();
        sketchSpaceSml ();
        sketch2 ();
      }
// space before minutes 
  sketchBlank ();
    
// Extract and draw Minute 1st digit
   if ((getDigit (tm.Minute,2)) == 1) {
       sketch1 ();
     } else if ((getDigit (tm.Minute,2)) == 2) {
       sketch2 ();
     } else if ((getDigit (tm.Minute,2)) == 3) {
       sketch3 ();
     } else if ((getDigit (tm.Minute,2)) == 4) {
       sketch4 ();
     } else if ((getDigit (tm.Minute,2)) == 5) {
       sketch5 ();
     } else {
       sketch0 ();
     }
// Space before 2nd minute digit
     sketchSpaceSml ();
 
// Extract and draw Minute 2nd digit
   if ((getDigit (tm.Minute,1)) == 1) {
       sketch1 ();
     } else if ((getDigit (tm.Minute,1)) == 2) {
       sketch2 ();
     } else if ((getDigit (tm.Minute,1)) == 3) {
       sketch3 ();
     } else if ((getDigit (tm.Minute,1)) == 4) {
       sketch4 ();
     } else if ((getDigit (tm.Minute,1)) == 5) {
       sketch5 ();
     } else if ((getDigit (tm.Minute,1)) == 6) {
       sketch6 ();
     } else if ((getDigit (tm.Minute,1)) == 7) {
       sketch7 ();
     } else if ((getDigit (tm.Minute,1)) == 8) {
       sketch8 ();
     } else if ((getDigit (tm.Minute,1)) == 9) {
       sketch9 ();
     } else {
       sketch0 ();
     }
 
// Return cursor to start
  small_stepperH.step(-11800); //left
  small_stepperH.step(1200); //right
 
  // test to extract 1st or second digit (counts from right) i.e. "12" - digit 1 = 2
/*  Serial.print("Min digit 2 = ");
  Serial.print(getDigit (tm.Minute,2));
  Serial.println();
  Serial.print("Min digit 1 = ");
  Serial.print(getDigit (tm.Minute,1));
  Serial.println();

  // test extracting hour number
  if ((hourConverter(tm.Hour)) == 9) {
  Serial.print("Digit hour = Nine!! ");
  } else if ((hourConverter(tm.Hour)) == 10) {
  Serial.print("Digit hour = Ten!! ");
  }
  Serial.println();
*/

  delay(59500);    // A decent delay between updates
//}  //remove the above delay and re-anable this line for 5 min updates

}
// END OF MAIN LOOP

void print2digits(int number) {
  if (number >= 0 && number < 10) {
    Serial.write('0');
  }
  Serial.print(number);
}

int getDigit(unsigned int number, int digit) {  //Takes a number and returns the x'th digit)
    for (int i=0; i<digit-1; i++) {
      number /= 10;
    }
    return number % 10;
}

int hourConverter(int number) { //Takes 24 hour time and subtracts 12, or adds 12 if it's 00: hour)
  if (number > 12) {
    number = number - 12;  
  } else if (number == 0) {
    number = number + 12;
  }
  return number;
  }

void sketch1 () {
small_stepperH.step(700); //right
small_stepperV.step(3100); //up
small_stepperH.step(500); //right
small_stepperV.step(-3090); //down
small_stepperH.step(-1000); //left
small_stepperH.step(1700); //right
}

void sketch2 () {
small_stepperV.step(2000); //up
small_stepperH.step(1400); //right
small_stepperV.step(600); //up
small_stepperH.step(-1750); //left
small_stepperV.step(500); //up
small_stepperH.step(2200); //right
small_stepperV.step(-1950); //down
small_stepperH.step(-1600); //left
small_stepperV.step(-600); //down
small_stepperH.step(1600); //right
small_stepperV.step(-500); //down
small_stepperH.step(-2200); //left
small_stepperH.step(2200); //right
}

void sketch3 () {
small_stepperH.step(2000); //right
small_stepperV.step(3100); //up
small_stepperH.step(-2250); //left
small_stepperV.step(-950); //down
small_stepperH.step(1700); //right
small_stepperV.step(-500); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-550); //down
small_stepperH.step(1650); //right
small_stepperV.step(-550); //down
small_stepperH.step(-1700); //left
small_stepperV.step(-550); //down
small_stepperH.step(2150); //right
}

void sketch4 () {
small_stepperH.step(1800); //right
small_stepperV.step(3100); //up
small_stepperH.step(-950); //left
small_stepperV.step(-1500); //down
small_stepperH.step(-650); //left
small_stepperV.step(1500); //up
small_stepperH.step(-600); //left
small_stepperV.step(-1950); //down
small_stepperH.step(1600); //right
small_stepperV.step(-1130); //down
small_stepperH.step(630); //right
}

void sketch5 () {
small_stepperV.step(1000); //up
small_stepperH.step(1300); //right
small_stepperV.step(600); //up
small_stepperH.step(-1700); //left
small_stepperV.step(1500); //up
small_stepperH.step(2100); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1700); //left
small_stepperV.step(-650); //down
small_stepperH.step(1700); //right
small_stepperV.step(-1450); //down
small_stepperH.step(-2200); //left
small_stepperH.step(2200); //right
}

void sketch6 () {
small_stepperV.step(3100); //up
small_stepperH.step(1750); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-700); //down
small_stepperH.step(1650); //right
small_stepperV.step(-1450); //down
small_stepperH.step(-2200); //left
small_stepperH.step(950); //right

small_stepperV.step(1500); //up
small_stepperH.step(800); //right
small_stepperV.step(-1000); //down
small_stepperH.step(-1150); //left
small_stepperV.step(-480); //down
small_stepperH.step(1650); //right
}

void sketch7 () {
small_stepperH.step(1250); //right
small_stepperV.step(2600); //up
small_stepperH.step(-1100); //left
small_stepperV.step(-1200); //down
small_stepperH.step(-600); //left
small_stepperV.step(1670); //up
small_stepperH.step(2200); //right
small_stepperV.step(-3020); //down
small_stepperH.step(-900); //left
small_stepperH.step(1000); //right
}

void sketch8 () {
small_stepperV.step(3100); //up
small_stepperH.step(1750); //right
small_stepperV.step(-950); //down
small_stepperH.step(-1650); //left
small_stepperV.step(-700); //down
small_stepperH.step(1150); //right

small_stepperV.step(1200); //up
small_stepperH.step(470); //right
small_stepperV.step(-2600); //down
small_stepperH.step(-2200); //left
small_stepperH.step(950); //right

small_stepperV.step(1500); //up
small_stepperH.step(800); //right
small_stepperV.step(-1000); //down
small_stepperH.step(-1160); //left
small_stepperV.step(-500); //down
small_stepperH.step(1700); //right
}

void sketch9 () {
small_stepperH.step(1250); //right
small_stepperV.step(2650); //up
small_stepperH.step(-1100); //left
small_stepperV.step(-1200); //down

small_stepperH.step(1050); //right
small_stepperV.step(-450); //down

small_stepperH.step(-1550); //left
small_stepperV.step(2050); //up
small_stepperH.step(2150); //right
small_stepperV.step(-3050); //down
small_stepperH.step(-900); //left
small_stepperH.step(1000); //right
}

void sketch0 () {
small_stepperV.step(3100); //up
small_stepperH.step(1850); //right
small_stepperV.step(-3050); //down
small_stepperH.step(-2200); //left
small_stepperH.step(800); //right
small_stepperV.step(2500); //up
small_stepperH.step(850); //right
small_stepperV.step(-2000); //down
small_stepperH.step(-1150); //left
small_stepperV.step(-530); //down
small_stepperH.step(1800); //right
}

void sketchBlank () {
  small_stepperH.step(2000); //right
}

void sketchSpaceSml () {
  small_stepperH.step(500); //right
}

Step 9: Final Notes

You need to switch off the EAS clock when the EAS cursor has returned all the way left and it stopped. This way when you next power it on it will start in the same place. If you get in a mess you can force the EAS pulleys by hand.

My digits are not perfect. They may not work well on your EAS. I'm very pleased with 1-7. I got lazy with 8,9 and 0 :-)

My EAS does not always return to the place it started - it gets close. It's not a problem, I never run if for more than a few hours when I've got people round :-)

If you use different stepper motors you will need to think about scaling all the numbers for drawing the digits by a factor if "x". The steppers I use have a built in gear reduction of 64:1 and are 32 steps. So 2048 steps = one full revolution. A standard Nema usually has 200 steps, but driven by an EasyDriver you cam run at 1/8th micro steps, so you would have 8x200 = 1600 steps per revolutions. So my code would work directly but draw 12% bigger digits - they should fit... I'll know soon! 
slush-Man3 months ago

BTW - it goes without saying - but this is a wonderful piece.

slush-Man3 months ago

QUESTIONS:

Could you use a simple tensioner pulley to take up the slack, placed in between the driver and the knob, spring loaded in an outward direction? If done right it should pre-load the knob, pulling up the slack.

Or in the same vein, could you use some sort of tension sensing device in the same place with a simple leaf switch that would be depressed when the tension is taken up? The first driver motion would turn until the slack is removed, then begin the drawing motion.

Or, I would think already considered, is determining the number of motor steps required to re-tension the knob after a movement? It would probably need to be deterministic based upon how many steps the last move had made.

Or could you place a sensor underneath the EAS to determine where the needle is, thereby creating a closed-loop system based upon actual needle placement, rather than open loop where it guesses based on wheel turns?

mobiansstech6 months ago

What A Brilliant work..

jensenr307 months ago

Very interesting! Thanks for posting!

j626no7 months ago

I am very impressed with this project. The "lag" you are talking about with the dials is referred to as "backlash" and is common place in machining equipment (eg. lathes, milling machines). I wonder if you could research how DRO's (Digital Read-Outs) retrofitted to manual Bridgeport milling machines compensates for this and you might be able to add this functionality into your code. It's late and I am about to go to bed, otherwise I would investigate this concept further. Hopefully this helps!

alinke7 months ago
Absolutely wonderful! I've been wanting to do my first stepper motor project , this may be the one! Thx for sharing
kjlpdx7 months ago

couldn't you change the pulley sizes to counteract the internal 1/64 gearing? or would that kill your resolution?

dodgey99 (author)  kjlpdx7 months ago
I tried 1-1 pulleys (same small pulleys on the EAS knobs and the motors didn't always have the power to move the EAS. The motors I used are running at the max of their ability, with the the gearing to the EAS being as "high" as I could get away with :-) Like I've said though, a simple change to Nema 17 motors and it will fly along.
Linksep dodgey997 months ago

Well there goes my idea of swapping the EAS and stepper pulleys to change from what looks like a 3:1 ratio to a 1:3 ratio.

rf7 months ago

I'm wondering if there isn't a way to re-use characters to limit the frequency of full-erasures. Either drawing over the last digit in such a way that it erases it enough to draw over it. Or turning a '1' into a '2', etc.

Some sort of second ticker might be nice too. Small movements to represent the progression of the current minute.

On the speed issue ... if you can't speed up the steppers you still might be able to change the gearing somewhat. Resolution may suffer a little, more software tricks could help with that. Or perhaps the steppers are simply too weak to gear up and still turn the knobs. Hmm.

apalacios27 months ago

If this is not the coolest, most creative digi-ana clock EVER, then I dunno which one is... So awesome!! I have a font that'd go perfect with it but unfortunately has curves and we all know what that means: hell to code the steps!!!

Awesome, simply awesome! Kudos!

RetroTechno7 months ago

Pretty cool...especially the screen clear.

An improvement would be to turn both knobs at once. Then you could draw some curvy numbers and make it even cooler!

perfo7 months ago

I must admit I haven't a single use for this but think its very creative and a great gadget. I had a though, that part of the delay is the fact you wipe the whole display then have to redraw the same thing (or 75 % of it) thus if you change it every minute then the 10s of hours the hours and the tens of minutes get redrawn loads of unnecessary times. What about using two EAS ? one for hours and one for minutes this will speed it up no end or one EAS for each digit and it'll be super fast (relatively).

dodgey99 (author)  perfo7 months ago

Ha!- I like the idea of 2 EAS - one for hours and one for minutes. Brilliant :-)

You could rotate them 90 degrees and make numbers you could see from across the room. Of course it would take so long to make the big numbers that the clock would be useless, but nothing is perfect.

What a brilliant way to waste time

and WHY did I give my EAS away ?

Fuddmaster8 months ago
The etch and sketch got my attention. I know nothing about this. But your instructable is very informative!! Good build!!! Voted for you. Might be a dumb question but is there a way to speed the controls up so it's not taking so long to tell the time?
dodgey99 (author)  Fuddmaster8 months ago

Thanks :-) - and no - those steppers won't go any faster. The only solution would be to replace them with NEMA 17 motors which will run 1:1 (the little steppers I used have a 64:1 gear reduction internally). I have everything ready to go, but I'm holding off as, to be honest, I kind of like watching it draw the numbers, as that , after all, is the magic of it.

alcurb dodgey997 months ago

Very nice project. But on a practical standpoint ...well...it isn't; it takes too long to tell the time. However, I understand about your issue with the gear reduction. I think it would be very cool if it were to run at break-neck speeds or have one normal speed that would be fast, and one demo speed which would be slow.

I imagine another application that captures an image into a laptop; the laptop vectorizes it and sends the commands via Bluetooth to your device which draws the portrait.

dodgey99 (author)  alcurb7 months ago

I hear you. But there is also the logic that if it drew the time in under a minute it would be rotating every minute, which isn't very relaxing after a short while :-) - I also like how the small steppers are dirt cheap. It makes it much more affordable. You could also use an RC servo to rotate the whole thing.

I will update it with fast steppers for the drawing soon, but I'm just playing with a new toy at the moment - a 3D printer :-)

alcurb dodgey997 months ago

Oh cool. What 3D printer did you get? I'm shopping for one. I bought a $100 PeachyPrinter just to get my feet wet (pun intended) but I also want to play with the big boys with an extrusion printer. There is a small delta type one, not for sale yet, that looks like a spider. Very cool. That project is still evolving.

To get back on subject, I was wondering how hard it would be to insert a mechanism, solenoid perhaps, into the EaS to lift the stylus off the glass (pen-up action)? Maybe the aluminum dust would pose a problem.

dodgey99 (author)  alcurb7 months ago

I am building a Prusa i3 (open source project) . All in it's costing me £350. I could have done it for less but for some bits I paid for convenience rather than spending days selecting nuts and bolts to buy.

Opening an EAS is a messy business. I recommend against it big time. Aluminium powder gets everywhere and is a nightmare to clean. I think part of the point is to work within the limitations of what an EAS can do natively.

agis687 months ago

its really interesting i have my own etch screen laying in my closet was gifted to me when i was 7...wow about 40years ago). Now the problem for me is that it takes almost 3 minutes to display the whole thing.....just kidding. Thank you for brinking lost memories

jaybo20997 months ago

So, I haven't read this 'ible as yet. I jumped straight to the video to watch the action. As I am watching, I'm wondering how in the world do you clear the screen. Then the whole device tilted. I literally laughed out loud! Nice!

invintive8 months ago

I'm new to stepper motors and I'm a little confused about the drivers since you have 2 ULN2003 drives and one EasyDriver. If I used 3 NEMA 17 stepper motors would I need 3 EasyDrivers to control them or 1 EasyDriver and 2 ULN2003 drivers like you have?

dodgey99 (author)  invintive8 months ago

The ULN2003's are just for those motors I used (well, they are only for 5 wire steppers). You are best forgetting about them as the EasyDriver is so nice to use, cheap, and uses only 2 wires to the arduino. If you use 3 Nemas then I'd use 3 EasyDrivers. My advice is to build a breadboard and experiment using an easydriver on one Nema, and play. You will find there are several ways to talk to the easydriver. You can use a loop like I have (slightly cumbersome for larger jobs, like drawing the numbers), you can use AccelStepper, or you can use the standard stepper library. I'm sure there are more ways. I'd get it working with one example, then try the other methods. Then choose the one you like coding with the best.

Thank you! Voted by the way, this is awesome!
dodgey99 (author)  invintive8 months ago

Oh - if you hardly want to change the code at all then you can use L298N drivers. Like this: http://www.ebay.co.uk/itm/L298N-DC-Stepper-Motor-D...

They use the same code as the ULN2003's. I'm not too keen on them though. They have no over current protection (so are easy to blow) and they are quite "notchy" at low speed as they don't do micro-stepping.

dodgey99 (author) 8 months ago

Thanks for the nice comments. I didn't intend to enter it into a contest, just wanted to share. Then saw the contest button !

action pig8 months ago

Very nice instructions and a very cool result! Voted :)

kenbob8 months ago

I so love this instructable. The challenge of overcoming the "sloppiness" in the etch-a-sketch is inspiring:) great documentation, and a beautiful build. One of my all time favorites!

Mielameri8 months ago
WANT. Such an awesome idea, and what great instructions! Thanks!
CobyUnger8 months ago

Fantastic. I love it.

trailtrekr8 months ago

Hey thats pretty darn cool! I'm just getting into C+ for arduino and this would be a cool project for it!