Realtime Composite Video Decoding with PicoScope

After getting my Raspberry Pi and successfully trying out serial console and communication with Arduino, I wanted to see if I could use the Pi as a “display shield” for Arduino and other simpler microcontroller projects. However, this plan had a minor problem: My workstation’s monitor wouldn’t display the HDMI image from Pi, and neither had it had a composite input. Working with the Pi in my living room which has a projector with both HDMI and composite was an option, but spreading all my gear there didn’t seem like such a good plan. But then I got a crazy idea:

The Pi has a composite output, which seems like a standard RCA connector. Presumably it’s sending out a rather straightforward analog signal. Would it be possible to digitize this signal and emulate a composite video display on the PC?

The short answer is: Yes. The medium length answer is, that it either requires an expensive oscilloscope with very large capture buffer (millions of samples), or then something that can stream the data fast enough so there’s enough samples per scanline to go by. Turns out my Picoscope 2204 can do the latter just enough – it isn’t enough for color, but here’s what I was able to achieve (hint: you may want to set video quality to 480p):

What my program does is essentially capture a run of 500 000 samples at 150ns intervals, analyze the data stream to see whether we have a working frame (and because the signal is interlaced, whether we got odd or even pixels), plot it on screen and get a new set of data. It essentially creates a “virtual composite input” for the PC. There’s some jitter and horizontal resolution lost due to capture rate and decoding algorithm limitations, and the picture is monochrome, but if you consider that realtime serial decoding is considered a nice feature in oscilloscopes, this does take things to a whole another level.

Read on to learn how this is achieved, and you’ll learn a thing or two about video signals! I’ve also included full source code (consider it alpha grade) for any readers with similar equipment in their hands.

Continue reading Realtime Composite Video Decoding with PicoScope

PicoScope 2204 USB Oscilloscope Review

PicoScope 2204 USB scope

One of the nicest things when starting a new hobby is that there’s just so many things you don’t yet have, and can thus look forward to researching and then maybe buying if the price is right. In electronics, you can pretty much get started with a $10 soldering iron, $25 multimeter, maybe a $30 programmer if you want to use microcontrollers, and then just buy cheap components to tinker with. But sooner or later, you start thinking about how nice it would be if you had an oscilloscope.

For me it took about nine months. I saw an article on using AVR as an RFID tag and noticed I could build a simple RFID reader with a few components. However, to really learn something, it would be nice to actually see the 125 kHz RFID carrier wave instead of fumbling blindly with the schematics. Additionally, I could use the scope to verify DIY D/A circuits, maybe debug serial protocols and much more. So I started researching.

Getting a used analog or digital scope from eBay was of course one option. However, old scopes are big, clunky and I don’t really have much table space. And if the scope fell out of use, it would be wasting space in a closet. New Chinese-made digital scopes from Owon and Rigol looked good and were relatively small and light. However, they had 640×480 or 800×600 displays and I had 2560×1600 30″ monitor sitting on my workspace, and being more of a software person, I eventually decided against them and chose to get a PC scope instead.

Options in USB scopes

Going through the options for digital scopes, there seemed to be a few price brackets:
Continue reading PicoScope 2204 USB Oscilloscope Review