Code and Life

Programming, electronics and other cool tech stuff

Supported by

Supported by Picotech

Composite video decoding: Theory and practice

After a few busy weeks, I’ve finally arranged enough time to cover the details behind my color composite video decoding project I featured recently. Before you proceed, I suggest you read the previous post, as well as the one before that covers B/W decoding (this post builds on that one), and watch the video, if you haven’t already:

So, feel ready to learn about composite color coding, quadrature amplitude modulation (QAM)? Let’s get started! Before you get going, you can grab the example excel file so you can view the diagrams below in full size, and study the data and formulas yourself.

Combining luminance and color information

If we look at one line of video information (“scanline”), it’s basically a function of two things: luminance (brightness) and chrominance (color) information, combined to a single waveform/signal like this one I showed in my first article.

If we’d like to just have a black-and-white image, encoding it would be easy: Maximum voltage for white, minimum voltage for black, and the values between would simply be shades of grey. However, if we’d like to add color information to this signal, we need to get clever. What the engineers in the 1960’s did to get two things stuffed into one signal was to add color in sine wave modulated form on top of the luminance signal. With proper analog electronics, these two signals could then be separated from the receiving end.

Read post

A bit of audio tinkering

I’ve been quite busy the last two weekends, first on a weekend holiday trip to Tallinn, Estonia, and then playing in the Helsinki Casual go tournament which successfully took most of my time last weekend. This has somewhat delayed my continuation to the composite video decoder project.

However, I haven’t been resting on my laurels completely even electronics-wise. My trip to Tallinn had one good by-product, namely new Audiotechnica ATH-M50 headphones. They are a marked improvement over my previous HD-500 Sennheisers, and got me inspired to getting a headphone amp, a tube-based Little Dot mkIII to be more exact. The 32 ohm ATHs don’t necessarily need an amp, but now I’ll at least be prepared if I ever end up getting something like HD-650s.

While researching for a proper USB DAC I came across an amazing audio blog by NwAvGuy. Compared to a lot of “audiophile” coverage he seems to have a solid engineering perspective to audio issues, and he has put an amazing effort to long articles that deal with many issues that surround headphone amp gear.

In addition to great scientific info, NwAvGuy has also designed a USB DAC called ODAC, which I ordered from Head’n’Hifi (they conveniently ship inside EU so no customs). And while I was at it, I couldn’t resist getting a DIY version of NwAvGuy’s O2 headphone amplifier. Read on for my experiences on building it and pitting it against the Little Dot mkIII tube amp.

Read post

Color composite video decoding with Picoscope 3206B

I recently finished an improved version of the NTSC composite video decoder previously featured here at Code and Life. With the bigger buffer of Picoscope 3206B, I was able to capture enough samples per frame to add color. A Youtube demonstration video has just finished uploading and you can view it below.

I already talk a bit about the techniques used in the new version, as well as the new features. For the readers of this blog, I’m planning a more detailed technical explanation, which I’ll put up as soon as I get the infographics for that one done.

Enjoy the show! If you want to take a look at the sources (or better yet, have a 3000 series Picoscope at hand), you can grab the source package. My code is licensed under GPL, see README.txt inside the archive for details.

Update: Technical details now published! Implementation details to be added in another post a bit later.

Read post

Donations, ATtiny2313 Breadboard Headers Left

In case anyone missed it the first time around, there are codeandlife.com ATtiny2313 breadboard headers still available for donations that exceed $10 ($10.01, $15, etc.) to the blog. If you want one, please send me an e-mail (jokkebk at codeandlife.com) with your postal address after donating, and I’ll ship one of these cuties to you as a small thanks!

All proceeds from the PayPal donations will go towards acquiring new interesting stuff to write about in this blog, so if you like the content, please consider donating!

Read post

Breakout Bonanza and DS1307 Realtime Clock

As if I didn’t have enough things on my “to try when I have the time” list already, I recently did a little shopping in both Adafruit and SparkFun. Both had several nifty breakout boards available that promised to speed up and streamline my breadboard projects a lot. In addition to some SMD breakouts that are still in their sealed bags, here’s what I got:

I had a lot of fun soldering the breadboard headers to these little guys. Many are for future projects, like the frequency generator which I’m planning to use for some RFID experiments, and some are just to avoid stripping apart stuff like the connector breakouts. As today’s main topic, I’m covering the DS1307 realtime clock (RTC) breakout in more detail. If you are interested in some of the other items, drop me a comment and I’ll get back to it!

DS1307 Realtime Clock

A realtime clock is simply something that keeps record of the time. Usually, these types of clocks are paired with a small coin cell battery that enables them to keep on counting even if the rest of the circuit is powered of. Such is the case with this breakout, too. Adafruit has an excellent tutorial covering the assembly of this device, all you need is some solder and an iron.

After getting it together, it took me a while to get it working. I used Bus Pirate to communicate with the chip, with the following connections:

Read post

Tips and Tricks: Flashing already soldered MCUs

I have been wanting to try this one out ever since I soldered together my USB password generator six months ago, just to realize that I would’ve actually liked to make a few changes to the firmware. The problem with my design was, that I had managed to pack everything so tightly, that there was no hope of reaching the ATtiny85 pins via normal methods to reprogram it.

I initially tried to use a 8-pin DIP socket and press it against the MCU, but it soon became apparent, that I could not keep it stable for all the pins to keep contact long enough. Lacking proper microhooks, I had to postpone the idea shown in the above photo until I just recently put my hand on this set of IC hooks from SparkFun.

The five IC hooks came one hook short of the six needed by the ISP header, but fortunately/unfortunately one of the pins was impossible to access even with these tiny hooks, so I manually held a yellow jumper wire against the MISO pin while running avrdude. Did it work? Look for yourself:

Definitely not rocket science, but for $4.95, I’d say it’s a pretty good deal!

Read post