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).
The signal is pretty simple (see video):
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.
Attached two wires to the coil copper wire and connected them to Box0 (
I glued the wire to body with glue gun so that copper wire don’t break.
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 BITSIZE = 12 CHAN = 0 # Get resources dev = box0.usb.open_supported() aout = dev.aout() # output signal aout.snapshot_prepare() aout.bitsize_speed_set(BITSIZE, SPEED) aout.chan_seq_set([CHAN]) aout.snapshot_start(signal) input("Press any key to exit") # deallocate resources aout.snapshot_stop() 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!
Before actually driving the motor with
AOUT0.CH0, i connected
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+