Hacking wall clock with Box0

A project log for Box0

Free and open source tool for exploring science and electronics anytime anywhere

Kuldeep Singh DhakaKuldeep Singh Dhaka 01/25/2017 at 19:150 Comments

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

From past experience, i was sure that the internal mechanism is 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 a idea struck to my mind! Why don’t i take it apart (which i would have later anyway), and drive the motor with Box0!

So first, i removed all the gear mechanism and made it to minimal so that the motor can work.
Now, the motor is functional, i soldered two wires to the coil solder pad (coming out of the IC underneath epoxy).

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

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, with an idea about the signal, i completly removed the driver circuit.

And attached two wires to the coil copper wire, and connect them to Box0 (AOUT0.CH0 and GND).

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

Now, 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

So, i made multiple similar looking waveform, and i was able to control motor speed.

# 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 seamingly 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+

Originally posted on: