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).
Arduino Etch-A-Sketch Clock




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).

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

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

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…

Arduino Etch-A-Sketch Clock circuit

Step 6: 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;
}




This Post / Project can also be found using search terms:

  • edge a sketch clock
  • etch a sketch arduino project
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Arduino Blinky Fish
Blinky Fish using an Arduino

Assembly instructions for an add-on board for the Arduino. **** FOR INSTRUCTIONS FOR MARCH 2013, KICKSTARTER PROJECT GO HERE http://www.instructables.com/id/Blinky-Fish-Kickstarter-Project/  ************ It has some...

Close
Scroll to top