Posts Tagged ‘Hardware’

WTPA2 Clock Characterization & Pulse Shaping

Wednesday, July 6th, 2011

So, after getting back to client work for a minute, I decided to try and nail the clock pulse shaping circuit problem with a more viable solution than throwing in an extra $5 op amp.
The problem with the original pulse shaper circuit was simply that it was designed with a function generator and not a 20 cent opamp in a RC oscillator. The idea was sound (I think) but the values were not.

The real problem is that the square-to-pulse converter has to shape two different clocks — it’s always driving the same IRQ pin, but it can be hooked up to WTPA2′s 4046 based VCO, or the LM358 based on a user switch. The 4046 is HC logic, and has really square edges. The LM358′s edges are not square, and their slew rate seems frequency dependent also. So, you could optimize components for one or the other, but not both. I did some bench tests to figure out what I needed to change to get this right.

Check it. Here’s the rising edge of the output from the VCO:
4046_Edge

And the corresponding output from the pulse shaping network:
4046_pulse

Since we aren’t changing the VCO, this is what we’re gonna call “normal”. The top trace shows a risetime of about 0.1uS (scope is 0.1uS/div, 2v/div) which is quite fast (50V/uS in opamp terms). The ringing here probably has to do with the long ground connection on my probe, and it doesn’t hurt anything except my pride. The bottom trace (the output from the pulse shaper) shows a clean low pulse which is about 6uS long total (2uS/div)
Now, here’s the LM358:

358_Edge

And the corresponding output from the pulse shaping network:
358_Pulse

Waaay different! This is the LM358 at its best incidentally — tested at low oscillator frequencies. At higher clock frequencies it slews even more slowly.
The top trace is 10uS/div, and shows a rise time of about 25uS (it’s 60uS with the clock cranked up to 25kHz). Annoyingly, it has that characteristic LM358 style crossover mess. AND it only gets up to about 4v. The rise time is really what matters though, and it is orders of magnitude slower than the 74hc4046. The bottom trace shows the output of the pulse shaper, trying but not quite making it. That dip never makes zero volts and might last 0.25uS. This doesn’t consistently trigger our interrupt-on-change IRQ.

So, the question was what to do. I tested a TLV2462 opamp (my goto op amp for embedded stuff, made by TI, a tank) and it performed equivalently to the 4046, and the pulses worked great. It’s slew rate was rated at 1.6V/uS, which is about 5 times faster than the LM358′s 0.3 V/uS. So it was faster, but not by orders of magnitude. If I could find an opamp which cost about the same as the LM358 and had a better slew rate, that seemed appealing rather than trying to hack up a circuit on 300 already-fabbed boards. The question was how fast we needed to go.

I settled on three opamps for the test: The Microchip MCP6002 (0.6V/us), the Microchip MCP602 (2.3V/uS) and the Texas Instruments TLC272 (5.3V/uS). A few days later I had them all from Digikey. I tested the MCP6002 first, since it was the cheapest. (0.27 at quantity, as opposed to the LM358′s 0.20) Surprise surprise! It worked great on the first try.
Although I didn’t measure the rise time, it looked clean on a scope. The ouptut from the pulse shaper was 6-7uS which is as good as (and more importantly in line with) the logic chip in the VCO. This was also consistent with the TLV2462.

In conclusion, the cheapest and easiest way to solve this problem is (I think) to eat 0.27 per kit and throw in another opamp. Further, the results are interesting because they show that above a certain rise time, performance remains the same. My guess is that there’s a knee point in that filter, and as long as the dominant frequency of the edge is above it, we’re good to go. In this case, a clean 0.6V/uS output was enough to trigger the shaper reliably.

Now that the results are consistent and I’m in tweak mode anyway, I’ll probably try and get those pulse times down by half or so, just in case the ISR gets faster.

Analog is fun, yo.
xoxox
TB

WTPA2 Work Resumed!!

Monday, May 23rd, 2011

All right, so now that Cory’s biz is done and the art world is safe again, I can get back to God’s Work, by which I mean making samples that sound like farts. That’s right, WTPA2!
WTPA2 has been promised now for like a million years. I’m shooting for actually having it ready by the end of June for Bent Festival.

In that spirit, I dug out my old prototype. There’s a lot wrong with it. I found most of the hardware bugs way back when, and I added another input for a separate pitch control to the second sample bank. The idea was to use the spare op-amp to make an RC oscillator and use it to clock the second sample bank and use the main oscillator to clock the first bank. Clock sources could then be switched or interchanged in hard or software.

Problem is, the only uncommitted pins left that can trigger an IRQ are interrupt-on-change pins. That means that I can’t only trigger on a rising or falling edge — the ISR will trigger on BOTH. That means a 10kHz square wave will trigger 20k interrupts a second. I could make the clock half as fast I guess, but that seems like it will confuse people. For the time being I dealt with it by checking the state of the pin in the ISR, but that’s lame too. It means we vector away from mainline code twice as often as we need to. So I came up with this:

Analog Wyzyrdry

It’s a pulse shaper. It takes a clock input, and regardless of duty cycle, spits out a low-going pulse on every rising clock edge. The diode and cap here are responsible for separating out the edges, and the transistor squares them up again (more or less). Hooked up to the function generator (Agilent 33120A, 50ohm out) I can get a nice 0.5uS low going pulse really consistently! I can use this to trigger an interrupt, and the pulse will ALWAYS rise again during the ISR (the fastest ISR in WTPA2 is like 9uS). Then at the end of the ISR I can clear the interrupt flag. Viola, rising edge interrupts with a couple cents worth of hardware! I’ve rolled this and some other hardware changes into the next proto revision and will be ordering it soon.

Whitney Dancing Stand Development, Part 3

Tuesday, April 26th, 2011

What a marathon.
So, in the last week or so we solidified the designs and there is a horde of 20-somethings with cool haircuts in my apartment running power drills.
CHANGES:
– Nixed the PID loop in favor of a stepper specific approach. We now calculate error in steps once a turn and adjust for it.
– Added vibration dampening grommets to the motor mounts to keep noise down.
– Added covers for the AC lines (so you can’t climb under the new media art and lick mains current)

Here’s one underway. That vented thing is an enclosed switcher to run the stepper and electronics.

Building it...

And here’s good old Lucky Number 13, all set to go:

Built.

Lastly, before kicking these things out the door I made some videos of them correcting for errors. By which I mean “beating them up”. If you get a chance to do this at the Whitney and the guard isn’t looking, you should do it. More videos on the youtube channel.

Beer o’clock,
TB

Whitney Dancing Stand Development, Part 2

Tuesday, April 19th, 2011

Sorry for the short posts. These are long days.
The real dancing stand controller boards are here!

Legit Stand Boards

The real magnetic position sensing encoders, too:

Legit Encoders

The other side of those encoders is a magnet (read the datasheet if you’re curious — these parts are expensive and awesome and totally worth it), and that magnet has to be centered very precisely over the IC. Any eccentricity or slop or variation in Z height will make for bad accuracy. You wouldn’t guess from the datasheet but these parts are actually pretty forgiving. Nonetheless, I had a buddy of mine (Joe, over at BreadBox Studio) turn me some ABS magnet holders which keep the magnet aligned with the shaft of the stand. They also space the magnet off the shaft itself (the shaft is steel and screws with the magnetic field as the encoder wants to see it) and provide some registration holes. The magnets are press fit into the ABS turnings. Like so:

Magnet Holders

Thanks, Joe! Now I gotta crank out 17 and make sure they all do what they should. Wish me luck….

Whitney Dancing Stand Development, Part 1

Sunday, April 10th, 2011

So Cory has a bigass show coming up at the Whitney this summer, and I’ve got SEVENTEEN!! dancing stands to build. They’re different from the last batch in that they have to run synchronously. The idea is to use a PID control loop and sync them via RF. They run on steppers, mostly because it was easy to find steppers that were torquey enough for the application and still fit under the dancing stand easily. The MCU is an Atmel, the RF link is by LINX, and the stepper driver is a TI DRV8xxx part.

Here’s the protos:

Stand Controller Proto

The system has a lot of slop, and I decided to do positional feedback using an absolute position sensing magnetic rotary encoder. This one is by Austria Microsystems. The specs on these are INCREDIBLE, but mounting them takes serious care to get that accuracy. I made a bunch of jigs, you can see this one all strung up under the stand’s driven leg. We’ll see how well they work…

Encoder Jig

Oh, yeah. And we made more bowling controllers. Or mostly my assistant Daniel did. These guys are really getting pretty cookie-cutter:

Moar Bowling

I feel pretty good about the protos of those stands, but my crystal ball predicts something will be screwy. We’ll see.