TI Chronos & Pibrella Part 1

CAM00706A couple of years ago when they were on sale for half price I bought a TI Chronos. I wasn’t sure what I was going to do with it but I needed a new watch anyway and it was only a few bucks more expensive than a cheapo street watch. However when it arrived and because for some weird reason that I only recently worked out although I am mostly  right-handed I am left-handed when it comes wearing a watch and it was too clunky to wear all the time as my main watch so it sat on a shelf not being used. Then last year Pimoroni had a competition on twitter & one of the tasks they set was to take a photo of a real or fake device using a Raspberry Pi and my entry was a time/motion activated reward system. BafbeN0CAAA0TrpUsing a TI Chronos accelerometer to control when the Raspberry Pi would unlock the container that the reward was stored in. At the time the device was fake but I decided that i would try to build it for real some day. So when I was looking for a procrastination project a couple of months ago I decided that this would be a good one.

As the Pibrella had been released and from a quick scan of the docs it looked like it would be a good way to give the project some extras like sound & blinking leds as well as controlling a solenoid with no additional hardware, I’m really not that good with hardware. i used to be but that was 25+ years ago when I was building things all the time & could actually see what I was doing. I actually did a couple of semesters of EE at college when i was in my “can’t decide what I want to do with my life” mode and swapped courses every week but i’ve forgotten more than I ever knew so whenever possible I try to keep the hardware that I use where I have to do the putting together to a bare minimum at the moment although i’m slowly getting back into the swing of things as long as all the components are through hole & large.

When the solenoid I ordered arrived it had been destroyed in transit but as it’d only been a couple of bucks with free shipping it didn’t seem worth complaining about and I put the project on hold while I decided what to use instead. I thought that a servo would do just as well instead so went an bought the cheapest servo they had in my local radioshack however, although the Pibrella is a great piece of kit it looks like the ONE!! thing it can’t do, at least not easily is control a servo, at least not that i’ve found and as I really wanted to use the Pibrella I went with my final option for a locking mechanism, A stepper motor.

After porting a wiringPi pibrella example to python pibrella library I ended up

import pibrella


pulse = []
pulse = range(0, MAX_STEPS*4)
  1, 0, 0, 0,
  1, 1, 0, 0,
  0, 1, 0, 0,
  0, 1, 1, 0,
  0, 0, 1, 0,
  0, 0, 1, 1,
  0, 0, 0, 1,
  1, 0, 0, 1

def stepCW(steps):
  global pulseStep
  for i in range(0,steps):
    pulseStep -= 4
    if (pulseStep < 0):       pulseStep = MAX_STEPS * 4 - 4     pibrella.output.e.write(pulse [pulseStep+0])     pibrella.output.f.write(pulse [pulseStep+1])     pibrella.output.g.write(pulse [pulseStep+2])     pibrella.output.h.write(pulse [pulseStep+3]) def stepACW (steps):    global pulseStep    for i in range(0,steps):      pulseStep += 4      if (pulseStep >= (MAX_STEPS * 4)):
       pulseStep = 0
     pibrella.output.e.write(pulse [pulseStep+0])
     pibrella.output.f.write(pulse [pulseStep+1])
     pibrella.output.g.write(pulse [pulseStep+2])
     pibrella.output.h.write(pulse [pulseStep+3])

def stop():

while 1:

So using a stepper motor as a locking mechanism would work and although i’d still prefer to use a solenoid I think using a stepper motor might actually give me more options and flexibility in the long run.

Part 2 of the project will document getting accelerometer data from the Chronos to the Raspberry Pi.


Leave a Reply

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


russelldavis.org © 2014 Frontier Theme