Posts Tagged ‘Analog’

Rainbow Poo, NTSC Synths, and Maker Faire

Monday, September 23rd, 2013

This last weekend, analog man-about-town Paul Rako asked me to show off some nerd stuff I built at the Atmel booth at Maker Faire New York.

To be totally hashtag-real-talk about it: I was skeptical. I have a lot of complicated feelings about Maker Faire, many of which come out when I’ve been drinking, and which I shall save to share with you, dear reader, until we have a beer together. But. I think Paul rules, and I also owe him big time for letting my unwashed self crash the Analog Aficionados parties AND I also use a ton of Atmel parts for both work and fun AND it seemed like the sort of “networkey personal brand-ey” thing that, while it makes me want to slice myself, is usually a good idea in these troubled and humanistic times.

Here’s the thing I showed off:

Color Me Baddly Analog Video Synth Mark 6

It’s an analog video synthesizer — the sixth prototype I’ve made of one in fact, and this one is finally starting to get OK (you can see some earlier ones if you dig back on the site). It generates NTSC video natively and can spit out either composite or S-Video, most of which looks like so much rainbow flavored wee. But I’m fond of it. The “synthesis” part is basically a processor (an Atmel AVR Atmega, programmed in C and a bit of assembly, at least for now) which generates sync, blanking, and colorburst and a bunch of op amps and transistors which encode control voltages into various video parameters. The majority of the board is taken up by oscillators and signal processors which make or shape incoming waveforms in such a way that they look cool when translated into video.

The synth itself stood up to tons of small children beating on it (some of whom were impressively bright and discovered amazing patches I never would have, and some of whom just wiped peanut butter on the board), I met a bunch of amazing people, and I ended up having a great time despite my initial hey-you-kids-get-that-3d-printer-off-my-lawn attitude. So. THANKS ATMEL and THANKS PAUL you were totally right. And to the grinning hellion with the jelly-hands: I’ve got your number.

The following photos pretty much describe how it went.

This kid was a genius who made at least two amazing patches that I unceremoniously snatched later. His mom also cracked a joke about chirality.

This is the face I make when I steal intellectual property from children. G-UNIT!

Close up of your standard-issue unicorn vomit.

Also, this happened.

Big Ups to Adam and Lexie for taking such great photos and providing stellar moral support.

Vectors, or “My Man Inf Left A VEC and a 9 At My Crib”

Thursday, August 8th, 2013

So awhile back my man Andrew Reitano dragged home a vector monitor from an old Asteroids arcade cabinet.
Here’s what we’ve done with it so far:

It was a long road to get there!
For those of you born after the cold war, Asteroids was a hugely popular game by Atari which used a now-obsolete style of monitor. If you haven’t played one in an arcade you owe it to yourself to do it, because they look like nothing else. The phosphor artifacts are trippy and beautiful.

Anyway, the trick with these things is that they get driven more like an oscilloscope than like a normal TV or raster monitor. Meaning, you send them voltages and deflect an electron gun to a certain spot on the screen, rather than drawing an image out line by line like an NTSC or RGB display. This presents all kinds of problems.

First, you have to move this electron gun at an even rate, and you need to do it on a halfway stable and reasonably fast way. I think Asteroids drew at 4MHz, meaning you needed to be pushing the gun that often AND slewing a beam that fast. After blowing up a handful of output transistors in the monitor, we came up with these:


That’s a Xilinx Spartan-3E FPGA on a Nexys2 dev board which Andrew programmed to be our vector generator, and a DAC/Amplifier board I designed to sling the beam around at 20 MHz and 12-bit resolution. First thing we did (this was with some gnarly R2R dac) was get a cube to display on the scope (I think the monitor was still fried from earlier “tests”). It kinda sucked:


Encouraged, we got drunk, fixed the monitor, Andrew wrote a rasterizer and we put the patron saint of Bed Stuy on the screen. It sucked less:


By then we were pretty sure we had a new arcade game in the works and the heavy lifting started. Andrew tuned the hell out of the VHDL and got the FPGA tweaking all kinds of gun parameters. I fixed the amp a couple times to get it running that gun right, and both of us spent a lot of time coding in C. I’ve wanted to make video games ever since I was a kid, but somehow this was my first foray into coding 3d rotations, particles, dynamic memory, and a lot of other generally non-embedded stuff. It ruled. We got to the point where we could rudely waste 3d polygons:


We wrote a storyboard about the Soviet Union blowing up Chicago, threw in a bangin track by Nicholas “Windbreaker” Read and coded a chaingun. Lastly, one awesome thing is that since we’d basically made a vector “video card”, it was not too hard to generate a commlink / stores display / HUD using a monochrome VGA display, running as a secondary monitor. It looks amazing!

We’re pretty sure we’re on our way to a totally kickass arcade cabinet once we get the real game coded. If you know what we should do with this hot mess once we’re done, hit us up!
TB, August 2013

Component Variation, Or, The Least Sexy Electronics Problem Evar

Thursday, July 7th, 2011

Analog is sexy, we all agree, right? Embedded systems on the other hand, are full of lots of unglamorous problems. Filesystems, say. Inherently un-sexy.


But I think component variation is maybe the best, most un-sexy problem there ever was. The unsexy cherry on the diet sundae. Like, you HAVE to solve it if you are making lots of something or that thing as a population will suck, even though the one on your bench always ruled.

All the pots in WTPA2 are these custom Taiwan Alpha jobbies. There are two values, 10kA and 100kA. The VCO uses one of the 10kAs as a coarse control, and it sets the voltage into a current sink which in turn sets the frequency. I’d been messing with the op amps in this circuit to try and get some performance improvements and “all of a sudden” one of the DUTs didn’t work correctly. At first I figured it was the opamp change, but after a lot of measurement and desoldering and component testing, it turned out one of the 10k pots was really 11.4k. This was a greater than 10% variation!

I’d built a margin in for error, but this was above it, and the current sink was getting too high of a voltage. I tested a dozen pots or so from the bin, and all of them were much less off. Still, since one was off, probably another one could be as well. It could even have been a result of the soldering process. I actually bothered to do a DC simulation at this point (using qucs) and fiddled with the component values until they were all as off as I could imagine them possibly being, and then resized the scaling resistor that sets the upper range of the VCO. It was a really crappy annoying unsatisfying solution, because it means that MOST of the units will be operating at a slower maximum clock than they need to. But that one in twelve or one in 100 will work correctly. Serves me right for getting the cheap pots, but there you go. Margin. Component variation.

Least Sexy Problem Evar.


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:

And the corresponding output from the pulse shaping network:

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:


And the corresponding output from the pulse shaping network:

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.

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.