Electronics for Curious Brains.

ShareBrained Technology makes electronic kits and devices for music, radio, and timekeeping. The Chronulator is our first product -- an analog, retro-ish clock with modern, programmable guts. Like all our (future) products, the Chronulator hardware and software are open-source. So you can customize it to look and work however you choose. Read more about the Chronulator or take a look at our gallery.

Chronulators

Microcontroller PLL and I2S operating!

Yesterday was spent getting the clock system in the STM32F205 up and running. ST provides an Excel spreadsheet which makes this task easy — or at least, I’m assuming it does, because I don’t have Excel and can’t open their *secured* spreadsheet on my non-Microsoft platform. So I had to do it all by hand. (Hey, ST! Make an online JavaScript+HTML5 clock configuration tool! Or I’ll do it for you! :-) )

So that now I have the processor running full-blast at 120MHz, it’s time to get the audio stuff working. It didn’t take long, really. I just had to get the right multiplication and division factors in place, turn on the I2S peripheral and configure it (only two registers), and then enable the “alternate function” for the pins that I used to interface to the audio codec chip. And here’s what I get:

The 11.2896MHz MCLK signal, which is 256x the audio sampling rate (44.1kHz):

The 44.1kHz LRC (left/right clock) or frame clock:

Bullseye!

Now to wire up the audio codec and try to speak with it via I2C. Perhaps I’ll start with my brand new Bus Pirate, then move on to doing it from the STM32.

Comments [0]

Audio Prototype is Alive!

I soldered up my prototype PCBs for my audio project today, and got some JTAG/SWD hardware help from Jim Larson. The net result is a partially-populated STM32F205 board that will talk to me via SWD and OpenOCD!

Foreground (purple DorkbotPDX laen-board) is my prototype. Behind it is an STM32VL-Discovery board modified to run the Maple bootloader and Versaloon firmware. And behind that, my laptop running openocd and vsprog.

Here’s a bit of the communication via Versaloon:

Info: Chip name undefined, try auto-detecting.
Info: Versaloon(0×33)by Simon(compiled on Jul 11 2011)
Info: USB_TO_XXX abilities: 0×00000008:0×00000040:0xC0000006
Info: SWDID = 0x2BA01477
Info: AHB-AP_ID = 0×24770011
Info: ROM_ADDRESS = 0xE00FF003
Info: CFG = 0×00000000, Little-endian
Info: CORTEX-M3 r2p0 processor detected
Info: CPUID = 0x412FC230
Info: STM32F2 type: XL device
Info: STM32F2 revision: Y
Info: Chip-id read is 0×411.
Info: Auto-detect signature is 0×411
Info: stm32f2_xl found
Info: SWDID = 0x2BA01477
Info: AHB-AP_ID = 0×24770011
Info: ROM_ADDRESS = 0xE00FF003
Info: CFG = 0×00000000, Little-endian
Info: CORTEX-M3 r2p0 processor detected
Info: CPUID = 0x412FC230

And from OpenOCD:

Info : OpenOCD runs in SWD mode
trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
Info : Versaloon(0×33)by Simon(compiled on Jul 11 2011)
Info : USB_TO_XXX abilities: 0×00000008:0×00000040:0xC0000006
Info : clock speed 1000 kHz
Info : stm32f2xxx.cpu: hardware has 6 breakpoints, 4 watchpoints

I should’ve put an LED or two on this board, so I could write an appropriate “Hello World”…

Comments [0]

Audio Project Trade-offs

I want to build a device that serves the audio experimenter in the same way the Arduino serves the artist community. The Arduino won’t do the job for audio because AVR8s are woefully underpowered (max clock speed, multiplier performance, very little RAM). The AVR8 also doesn’t have an I2S or AC97 interface to a true audio codec. In shopping around, I’ve settled on the STM32F205RB, a 120MHz ARM Cortex-M3 processor. It has I2S interfaces, so I can hook it up to a real audio codec — I’m thinking the inexpensive but very functional Wolfson WM8731. This should be a powerful platform for running bare-metal audio synthesis and processing algorithms, and some limited Pure Data (pd) or Supercollider patches.

In this design, I’m rapidly running into a bunch of competing constraints:

  • Arduino shield compatibility. This makes the board design bigger and awkward to lay out, especially if I include lots of built-in peripherals like MIDI in/out and headphone jack (see below). I’ll never be 100% compatible with all Arduino shields anyway, since my processor architecture is totally different than Arduino. So my compatibility would be limited to shields I (or others) make the effort to support on the STM32Fxxx platform. LeafLabs has done some good work on this front already. As an alternative, I can develop my own custom shield format and provide shield kits that customers can hand-assemble.
  • Built-in MIDI in/out. It’d be nice to plug my device straight into a keyboard or controller and go to town. But MIDI connectors are big and clumsy and would make my device bigger and harder to build into a hand-held instrument. MIDI ports also add a fair bit of cost — the connectors and opto-isolator, through-hole assembly, and the extra circuit board space. Are MIDI interfaces still important if I can instead provide USB MIDI using the STM32F205′s USB OTG functionality (e.g. just plug your USB-MIDI controller straight into my device and play)?
  • Headphone output. I’m already building in 1/8″ stereo line input and line output. The WM8731 also provides a headphone output. Would you want to listen on headphones, or would a line-out into a headphone amplifier work just fine for you?
  • Microphone input. The WM8731 has a mono microphone input, designed for cheap little electret capsules (like those you find built into laptops). It’s not a high-quality input. Would it still be worth having a jack where you could plug in a cheap Logitech computer microphone — instead of connecting some sort of microphone pre-amplification to my device’s line input?
  • Micro SD card slot. Would it be important to have access to vast amounts of data stored on an SD card? Or would the 128K or so of flash inside the ARM chip be enough for most applications?

Leave a comment and let me know what you think.

Comments [8]

Kevin Thornbloom’s Chronulator

Kevin writes:

After seeing some other great Chronulators on flickr that join the two meter panels into one display, I knew that’s where my design would go. I made a simple box out of Red Oak, and stained it dark. The front panel is acrylic with the back spray-painted black (except for a strip in the middle). After painting, I applied aluminum tape behind the black areas to help reflect light back at the meters. I used a second piece of acrylic inside the box to mount everything on. Four white LEDs point straight out at the aluminum tape backed faceplate to light it up. (I found this worked much better than trying to aim the LEDs at the meters.) I added a toggle switch for the lights, and called it a day! I love my new clock!

Comments [0]

Michael Walker’s Chronulator

Michael writes about his Chronulator project:

The face plate is curly maple. The front edge of the case is hand oiled black walnut, milled from a tree that had to be removed when I built my house. It’s made to sit on a shelf so the back half of the case is pine, joined with wood biscuits to the walnut. The meters are industrial meter relays I bought on eBay. My wife is quite good with Photoshop so she helped me with the scales on the meters. I removed the scales, scanned them on a flat bed scanner, altered the images, printed them out on heavy paper stock and attached the paper scales to the original plates with a glue stick. They are 100uA meters so I didn’t have to alter the circuit. Because they are meter relays I could use it as a timer/alarm clock but that would require 120VAC and I like the long battery life you designed into the original circuit.

Comments [1]

Open JTAG Interfaces

I’m shopping around for hardware I can use to program and debug ARM microcontrollers. I used the Keil ULINK 2 at my last job, and it worked just fine. Now that I’m on my own, I can’t afford to drop hundreds of dollars on debug hardware. What’s more, the ULINK is proprietary hardware and is only officially supported with Keil products on Windows. That just doesn’t jibe with ShareBrained philosophy. So I’m shopping around for other options that are compatible with OpenOCD, have open hardware and open protocols, and use USB (not parallel or serial ports). Here’s what I’ve found so far (corrections and changes welcome):

Device Hardware Protocol Software Performance
Dangerous Prototypes Bus Pirate Open Open All Poor (designed for human-rate interface)
Dangerous Prototypes Bus Blaster Open FTDI Proprietary (but works with open libFTDI) All OK
Embedded Projects GmbH usbprog Open Open, supported by OpenOCD All Bad (improved with alternate firmware and OpenOCD driver)
Keil ULINK2 Proprietary Proprietary Windows only OK
Segger J-Link Proprietary Public but proprietary, supported by OpenOCD All OK
Nuvoton Nu-Link Proprietary, Nuvoton target devices only? Proprietary Windows only OK
ST Microelectronics ST-Link/V2 Proprietary Proprietary, provided to OpenOCD under NDA Windows only? OK?
CooCox CoLink Open Proprietary? Windows only OK
CooCox CoLinkEx Open FTDI Proprietary (but works with open libFTDI?) Windows only? OK
KrisTech KT-LINK Crude schematic in user manual FTDI Proprietary (but works with open libFTDI?) All
Amontec JTAGkey ? FTDI Proprietary (but works with open libFTDI?) All
NGX ARM USB JTAG ? FTDI Proprietary (but works with open libFTDI?) All
Micromint PicoJTAG ? FTDI Proprietary (but works with open libFTDI?) All?
Olimex ARM-USB-OCD FTDI Proprietary (but works with open libFTDI?) All
Goepel PicoTAP Proprietary?

At some point in my research, I noticed that the Dangerous Prototypes Bus Blaster might be the solution to all my concerns. It’s open (except for the FTDI chip, which works with the open libFTDI library), inexpensive, and *should* support SWD soon. This is the interface I’m going to try.

Comments [5]

Day 1 of La Vida Open Hardware

I started ShareBrained about four years ago. It’s always been a side-business to my various day jobs, and I have often wondered what would happen if I put my full time and energy into ShareBrained. A couple of months ago, the circumstances arose where we (my wife and I) became comfortable enough with the risks vs. rewards to give it a shot. Yesterday was my last day at a “day-job”, and today is the first day of full-time ShareBrained employment! (Another recurring thought I have now: “What the *hell* am I thinking?!?!?”)

You may wonder where I’m going to take ShareBrained. Right now, I’m really in to these things:

  • Audio projects — new musical instrument interfaces and synthesis platforms.
  • Software radio projects — agile radio transceivers and spectrum analyzers.
  • Open technical tools — JTAG and Serial Wire Debug interfaces, logic analyzers, oscilloscopes.
  • Cool and hackable timekeeping devices like The Chronulator

As I get more in to these projects, I’ll post them here on the blog. I look forward to all your comments, suggestions, and contributions.

Wish me luck!

Comments [1]

Ubertooth Spectrum Analysis Fun

I put together a quick video (no audio) of some things I found in the 2.4GHz spectrum with the Great Scott Gadgets Ubertooth One:

In this gripping video, you’ll see idle and busy Wi-Fi signals, Bluetooth discovery, and a leaky microwave oven! It’s kinda like being in The Matrix…

We have Ubertooth Ones in stock, so consider picking one up if you want to do some Bluetooth or RF hacking. Everything (including the hardware) is open-source, and there’s a growing community of people developing software for the Ubertooth. The next few months should be very interesting!

Comments [3]

Ubertooth Spectrum Analysis

Update: I put a much better spectrum analysis video here. Enjoy!

I committed a very basic spectrum analyzer GUI for the Ubertooth One yesterday. Here’s a video (M4V | WebM | Ogg) of it in action, scanning the 2.4GHz band in 1MHz steps:

In the first bit of video, you can see my 802.11b network beacon banging away on channel 11. Later, I turn on the Bluetooth discovery on my iDevice — massive spectral shrapnel!

It’s written in Python using the PySide Qt bindings. USB support is provided by PyUSB 1.0 on top of libusb 1.0.

If you don’t have an Ubertooth One, you know where to order one, right?

Next on the agenda: add a legend to the display, improve scan speed (by somehow reducing USB and PLL/VCO tuning time), and bundle up Mac and Windows builds so people can download and play with them on non-Linux platforms without having to get a whole toolchain set up.

Comments [0]

PCB stencils on the cheap (kinda)

I’m in a heavy prototyping phase with my software-defined radio projects. Every time DorkbotPDX has a board order, I make sure I’ve got one or two boards in the order. Of course, once I get the boards, I have to assemble them. And since radio-frequency projects involve high frequencies, small surface-mount components are essential.

adf4350_finished

How small? It’s common to use “0402″ resistors, capacitors, and inductors on a circuit board that operates at gigahertz frequencies. The name “0402″ comes from the dimensions of the components — 0.04″ x 0.02″ (1.0mm x 0.5mm). That’s really tiny. I don’t want to hand-solder those because I drink too much coffee and can’t hold still enough… So I investigated reflow soldering, a technique my Dorkbot colleagues have used with great success. It usually involves an cheap hot plate and some solder paste. The solder paste is applied to the board at places where solder needs to join components. Then the components are placed on top of the solder paste points. When the assembly is heated, the solder paste melts, and the surface tension of the molten solder pulls the components into place on their respective solder pads. It’s immensely easier than hand-soldering, and produces beautiful results.

The Hard and Messy Way

My first attempt involved applying solder paste in coarse blobs on the board, using a toothpick. That barely worked. The largest problem was that some solder joints had too much solder and flowed together with other solder joints. Other solder joints were too dry and in some cases didn’t connect reliably between the board and component.

In the real world of mass-production circuit board assembly, solder stencils are used. The solder paste is applied through a screen (stencil) that ensures the right amount of solder is applied in precisely the right places. As an individual, you can order laser-cut stencils cut from metal or expensive, high-temperature Kapton plastic. I didn’t want to wait for a stencil, take on the added cost, or have to procure large amounts of specialized plastic.

A colleague of mine suggested cutting stencils on the laser cutter we have in the office. Our laser cutter can’t cut metal, but it can cut paper. Since I’m making prototypes, not mass-producing products, it’s OK if the paper stencil is destroyed by using it. So I cut a stencil from paper and tried it.

The result with the paper stencil was OK, but not great. The paste bled underneath the stencil. In those spots, I had too much solder. It was also a bit tricky keeping the paper still as I applied the solder paste with the squeegee. Then, I had a revelation…

Adhesive Mailing Labels — SRSLY?

I have these Avery mailing labels that I use to address Chronulator kit shipments to my customers. They’re made of paper, and they stick to stuff. What if I cut my stencil from a mailing label? Let’s give it a try…

To start with, I need to prepare a solder paste template. I output a PDF with the paste layers shrunk a bit. I shrink the paste layer because the mailing label is quite thick, and therefore so is the paste when it’s applied. So I need to compensate for the thick paste by making the paste areas smaller.

From the paste template file, I laser the mailing label with the Epilog 45W laser at work. My settings are “speed 25″ and “power 25″. I use raster mode, as it tends to produce more accurate, even results.

stencil_laser

Then, I cut out the template. I leave enough border so I have some room to spread the solder paste without getting it on the board. I also need a border to hold on to when I peel off the label.

stencil_cutout

I clean the circuit board with rubbing alcohol to make sure there’s no dirt or grime that will foul up soldering. Then I stick the template to the circuit board. Lining up the stencil is a bit tricky, but the mailing labels are only mildly sticky, and can easily be pulled up and reapplied if the alignment is off.

stencil_on_pcb

I’ve noticed that the mailing label adhesive gets stickier after being on the board a while. If you leave the label on the board for more than a day or two, it’s very hard to remove without ripping (and messing up your solder paste).

Like Buttering Toast

I apply the solder paste with a little metal squeegee. At first, I apply a lot of solder paste (several times what I need) and squeeze it against the board to get the paste deep into the template’s holes. The layer of paste is very thick.

paste_on_board

paste_application

thick_paste

After I have a thick layer of paste on the board, I scrape off all the excess — until I can see the template paper through the paste. Sometimes, I wind up scraping some of the paste out of a hole in the template, so I have to re-apply the paste and re-squeegy it to be smooth.

thin_paste

Once the solder paste is even, it’s time to peel off the template!

paste_applied

The hardest part of the whole process is placing the components on the board without damaging the solder paste. It’s essential to have a good eyesight, a good pair of tweezers, a steady hand, and lots of patience.

placing_parts

If you do smudge your solder paste, you can try to reshape it with the tip of a pen knife. And if one of your components doesn’t want to move into place, nudging it with the side of a pen knife blade seems to be the easiest way.

Turn On the Heat

After all the components are placed on the board, gently transfer it to the hot plate. Or better yet, put the board on the hotplate before you place the components.

on_hotplate

Other people use fancy PID controllers to control their hot plate temperature. Since I’m building very small prototypes, I don’t need a lot of temperature precision. I warm up the board to the point where I see the first wisp of smoke (130C or so, I think), then turn off the heat and let it sit for a minute to stabilize the temperature. I turn the heat back on until I see the solder melt on all the components. I immediately turn the heat off. I let the board cool down for a couple of minutes, then move the board off the hot plate to cool the rest of the way. I’m probably stressing the components by shock-cooling them…

Go Forth and Modify

At this point, the board is done and it’s time to hook it up and see it work! So far, all the boards I’ve made with this technique (four) have worked great (except for the solder flux incident). Good luck to all who try it, and I hope to see people discussing improvements…

Comments [16]