ClOCkTAL: For When Reading A Clock Is Just Too Easy

Over on Hackaday.io, [danjovic] presents clOCkTAL, a simple LED clock for those of us who struggle with the very concept of making it easy to read the time. Move aside binary clocks, you’re easy, let’s talk binary coded octal. Yes, it is a thing. We’ll leave it to [danjovic] to describe how to read the time from it:

Do not try to do the math using 6 bits. The trick to read this clock is to read every 3-bit digit in binary and multiply the MSBs by 8 before summing to the LSBs.

Simple. If you’re awake enough, that is. Anyway, we’re a big fan of the stripped-down raw build method using perf board, and scrap wood. No details hidden here. The circuit is straightforward, being based on a minimal configuration needed to drive the PIC16F688 and a handful of LEDs arranged in a 3×4 matrix.

An interesting detail is the use of Bresenham’s Algorithm to derive the one event-per-second needed to keep track of time. And no, this isn’t the more famous Bresenham’s line algorithm you may be more familiar with, it’s much simpler, but does work on the same principle of replacing expensive arithmetic division operations with incremental errors. The original Bresenham’s Algorithm was devised for using with X-Y plotters, which had limited resolution, and was intended to allow movements that were in an imperfect ratio to that resolution. It was developed into a method for approximating lines, then extended to cover circles, ellipses and other types of drawables.

Continue reading “ClOCkTAL: For When Reading A Clock Is Just Too Easy”

TeensyStep – Fast Stepper Library For Teensy

The Teensy platform is very popular with hackers — and rightly so. Teensys are available in 8-bit and 32-bit versions, the hardware has a bread-board friendly footprint, there are a ton of Teensy libraries available, and they can also run standard Arduino libraries. Want to blink a lot of LED’s? At very fast update rates? How about MIDI? Or USB-HID devices? The Teensy can handle just about anything you throw at it. Driving motors is easy using the standard Arduino libraries such as Stepper, AccelStepper or Arduino Stepper Library.

But if you want to move multiple motors at high micro-stepping speeds, either independently or synchronously and without step loss, these standard libraries become bottlenecks. [Lutz Niggl]’s new TeensyStep fast stepper control library offers a great improvement in performance when driving steppers at high speed. It works with all of the Teensy 3.x boards, and is able to handle accelerated synchronous and independent moves of multiple motors at the high pulse rates required for micro-stepping drivers.

The library can be used to turn motors at up to 300,000 steps/sec which works out to an incredible 5625 rpm at 1/16 th micro-stepping. In the demo video below, you can see him push two motors at 160,000 steps/sec — that’s 3000 rpm — without the two arms colliding. Motors can be moved either independently or synchronously. Synchronous movement uses Bresenham’s line algorithm to plan motor movements based on start and end positions. While doing a synchronous move, it can also run other motors independently. The TeensyStep library uses two class objects. The Stepper class does not require any system resources other than 56 bytes of memory. The StepControl class requires one IntervallTimer and two channels of a FTM  (FlexTimer Module) timer. Since all supported Teensys implement four PIT timers and a FTM0 module with eight timer channels, the usage is limited to four StepControl objects existing at the same time. Check out [Lutz]’s project page for some performance figures.

As a comparison, check out Better Stepping with 8-bit Micros — this approach uses DMA channels as high-speed counters, with each count sending a pulse to the motor.

Thanks to [Paul Stoffregen] for tipping us off about this new library. Continue reading “TeensyStep – Fast Stepper Library For Teensy”