Hacking wall clock with Box0


A few days ago i found a wall clock thrown in garbage (while i was searching for one of the community dog puppy :).

From past experience i was sure that the internal mechanism was still functional.
(people usually throw clocks due to the broken glass or old body).

I salvaged the electro-mechanical mechanism from the garbage and cleaned it up.
After inserting an AA battery, it started its usual sound: tik, tik, tik….

So, i just kept it on the shelf.
then an idea struck to my mind! Why don’t i take it apart (which i would have done later anyway) and drive the motor with Box0!

I removed all the gear mechanism that was not required to run the motor.
Now what left was just the motor(the coil+ magnetic rotor) and the battery compartment.

I soldered two wires to the coil solder pad (coming out of the IC underneath epoxy).

Attached wire to coil

Attached the wires to Box0 (AIN0.CH0 and GND pins) and started Box0 Studio – Oscilloscope to see the driving signal.

Box0 reading signal

Waveform with pulse zoomed in

Waveform with two pulse - opposite polarity

The signal is pretty simple (see video):

  1. generates a 32ms pulse with around +1.4V.
  2. wait 1 second (from the start of the pulse)
  3. generates a 32ms pulse with -1.4V
  4. wait 1 second (from the start of the pulse)
  5. goto “1”

Easy peasy, i can generate that signal with AOUT0 (Analog OUT module of Box0).

Now, after understanding the signal, i completly removed the driver circuit.

Chip detached from coil

Attached two wires to the coil copper wire and connected them to Box0 (AOUT0.CH0 and GND).

I glued the wire to body with glue gun so that copper wire don’t break.

Wire glued to body

Finally i wrote a little Python script, and it started working as expected!

Now, with able to drive the motor with Box0, i can start abusing it 😉

import box0
import numpy as np

# python2 raw_input and python3 input
try: input = raw_input
except: pass

# 10ms, 25ms (Demo 3 - Fastest)
signal = np.empty(50)
signal[:] = 0
signal[15:25] = 1.5
signal[40:50] = -1.5

SPEED = 1000
CHAN = 0

# Get resources
dev = box0.usb.open_supported()
aout = dev.aout()

# output signal
aout.bitsize_speed_set(BITSIZE, SPEED)

input("Press any key to exit")

# deallocate resources
del aout
del dev

I was curious if i could run the motor at different speeds.
My first guess was to vary the waveform timing to see if it has any effect on motor speed.
So i made variants of “Original” signal in code and it idea worked.

# 32ms, 1000ms (Demo 1 - Original)
#~ signal = np.empty(2000)
#~ signal[:] = 0
#~ signal[968:999] = 1.5
#~ signal[1968:1999] = -1.5

# 32ms, 500ms
#~ signal = np.empty(2000)
#~ signal[:] = 0
#~ signal[468:500] = 1.5
#~ signal[968:1000] = -1.5
#~ signal[1468:1500] = 1.5
#~ signal[1968:2000] = -1.5

# 20ms, 100ms (Demo 2)
#~ signal = np.empty(200)
#~ signal[:] = 0
#~ signal[80:100] = 1.5
#~ signal[180:200] = -1.5

# 20ms, 50ms
#~ signal = np.empty(100)
#~ signal[:] = 0
#~ signal[30:50] = 1.5
#~ signal[80:100] = -1.5

# 10ms, 25ms (Demo 3 - Fastest)
signal = np.empty(50)
signal[:] = 0
signal[15:25] = 1.5
signal[40:50] = -1.5

Here you have!

  1. a seemingly useless little clock motor get to see another day!
  2. I found the puppy. 🙂

Before actually driving the motor with AOUT0.CH0, i connected AOUT0.CH0 -> AIN0.CH0 pin, and checked if im not generating a faulty signal.
Thanks to the modular architecture of Box0, i was able to run AOUT0 module with Python code and AIN0 with Box0 Studio – Oscilloscope.

Note: All above code under GPLv3+

One thought on “Hacking wall clock with Box0

  1. This is awesome, I see an application of using Box0 with wall clock, we don’t have to worry about Daylight Saving Time (DST) changes which do not necessarily occur on the same date every year. For example in 2016 DST started on Sun, Mar 13 and ended on Sun, Nov 6 , in 2017 Sun, Mar 12 / Sun, Nov 5 and in 2018 it will be Sun, Mar 11 / Sun, Nov 4 . Clock can be programmed to work automatically it will be specially useful at clocks at public places . And if you are in synchronization with NTP it will be the best, Which is definitely possible .
    *In this context it is worth mentioning that the strong reason behind usage of analog clocks in this digital age is – the “principal of visual management” , reading and comprehending the meaning of the clock hands occurs instantaneously for human brain (feel of time) with compared to reading a digital clock.

Leave a Reply

Your email address will not be published. Required fields are marked *