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.


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.


Attached wire to coil


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.
  3. generates a 32ms pulse with -1.4V
  5. goto “1”


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


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


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
