# Older blog entries for shimniok (starting at number 70)

Tiny, Portable Turntable Strobe

I love turntables. The very idea is simultaneously insane and an awesome feat of engineering.

Microscopic grooves in a rotating disc of plastic vibrate a minuscule, precisely ground chunk of diamond stuck on a tiny metal tube with magnets attached, inducing tiny currents in a cartridge coil, subsequently amplified up the wazoo. Somehow, instead of sounding like garbled crap, the reproduced sound is quite excellent on a decent system.

But how fast does the record spin? That's the purpose of my project, an extremely accurate, compact turntable strobe. An LP is supposed to spin at 33-1/3 RPM. Many probably don't. Not precisely. And the voices in my head like precision.

 Introducing Pocket Turntable Strobe

Some turntables, like my Realistic Lab 400 above, have strobes built in that run off mains frequency to illuminate precisely spaced platter markings that appear to stand still when the platter speed is just right. Except the mains frequency varies and is only 60Hz on average.

Compare to my Turntable Strobe, which uses a quartz crystal and ATtiny25 to flash a white LED at 60.0±0.03Hz (30ppm absolute accuracy plus 20ppm temperature variation). Use it with platter strobe markings or speed check disks that you can find online.

 Turntable Strobe with speed check disc
It uses a tiny 3V, CR1225 battery which, combined with not-quite-Vcc output from the ATtiny25, produces barely enough voltage to dimly light a white LED. Adding four components makes the strobe burns bright as below, right.

 Same circuit, same LED, CR2032 left, CR1225 right
What sorcery is this? A Dickson charge pump.

 From Jonathan Thompson's Web Journal [link]
The circuit is simple, requiring two capacitors and two diodes and one of the pins on the microcontroller for the clock signal. The result is a higher voltage supply (4.2V unloaded) that can brightly illuminate the high intensity, 5mm LED through a 1K current limiting resistor. I'll provide more detail on this circuit in an upcoming article.

 Diagrammed in Upverter
Another trick to minimize complexity and parts count is that the microcontroller directly sinks current from the LED. You may object, claiming it's unsafe given the LED circuit is powered by a voltage exceeding the Vcc+0.5V limits of the ATtiny. Rules are meant to be broken, provided you have sufficient understanding of their purpose and how things work. I'll show you why it's safe in another upcoming article.

Meanwhile, if you want one, they are for sale.

Syndicated 2014-03-12 16:30:00 from Michael Shimniok

Freescale FRDM-KL46Z Board

I've been playing with a \$15 Freescale Freedom board based on the Kinetis MKL46Z256 [pdf]. It has a built in magnetometer and accelerometer and possibly the cutest little 4-digit, 7-segment LCD I've ever laid eyes on. This is quite a capable board.

It's a 48MHz Cortex M0+ with 256K flash memory, 32K RAM. That's enough power to do some serious computation. Perhaps a Kalman Filter-equipped Segway type robot? Or AVC rover?

On top of that, typical of other Freescale chips, a fast ADC running >400kSPS at 16bit or >800kSPS at lower resolution. With DMA available.

With Arduino form-factor headers plus another row of headers in addition to those, the board provides easy access to a lot of MCU pins, 64 to be exact.

You also get a light sensor, capacitive touch slider, a couple of tactile switches, and USB host / device capabilities.

The board is supported by mbed for easy programming and prototyping. And to dispel the myths: the mbed SDK is open source and you can offline compile it for several supported ARM toolchains.

Debug, in the form of CMSIS-DAP, is available, too. A 20mm battery holder footprint is provided on the board.

## Getting Started

If you plug your USB cable into the OpenSDA USB connector (use your Quick Reference Card to locate it), then your system will mount a Mass Storage Device.

On the drive are several HTML files. SDA_INFO.HTM takes you over to a P&E Microcomputer registration site where you can register your hardware. TOOLS.HTM redirects your browser to a page listing P&E debugger tools. For some reason the FSL_WEB.HTM leads to 404 error on the Freescale website. It should point to this page.

Next, head over to the mbed.org site, register or login, navigate to the Freedom KL46Z platform page and on the right side, click the "Add to Compiler" button.

## Compiling Demos

On this same page you'll find a series of examples for the board. You can also search mbed.org for more. I selected an accelerometer demo from Freescale. Import it into the IDE, select your platform with the button at the upper right. Click compile and then move the bin file that is downloaded onto the Freedom's mass storage device.

The demo prints accelerometer values for X, Y and Z axes to the USB serial port. On Linux this device appears as /dev/ttyACM*. Fire up minicom and you get output...

X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00
X: 0.99, Y: 0.97, Z: 0.00
X: 1.00, Y: 0.96, Z: 0.00

Next I tried a touch slider demo which controls the PWM signal sent to the board's green LED. The code is really simple. Here's main:
```  `int main(void) {    PwmOut led(LED_GREEN);    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);    while (true) {        led = 1.0 - tsi.readPercentage();        wait(0.1);    }}`
```

## Conclusion

I think this board is a decent deal at \$15, the main selling point being mbed compatibility. My view is that boards are only worth as much as their toolchains and community support. And you can get other Freedom boards in the same form factor as well including other M0+ boards and an M4, the FRDM-K20D50M which boasts a 50MHz M4 with DSP capability.

While I touched on the highlights of this board, there's a lot more to explore. I'm looking forward to writing come code for it and using it in an upcoming project. SHARC will be hosting a Firefighting competition in the next few months and Pokey could use a major refit. However, come to think of it, I'm up to my ears in projects. Instead, perhaps I'll use it for one of those projects, such as my Take Out The Trash Bot. Whatever I do, I'll be sure to post about it here.

Syndicated 2014-03-06 16:00:00 from Michael Shimniok

Lithium-Sulphur Batteries

I ran across an article on Lithium-Sulphur batteries the other day. With theoretically double the energy density of Lithium-Ion batteries, Lithium-Sulpher batteries look promising, but the chemistry comes with many challenges. However, researchers at Lawrence Berkeley National Laboratory have found some ways to address the problems. (read the Full Article)

Syndicated 2014-03-04 18:15:00 from Michael Shimniok