ben

TV output wing

53 posts in this topic

Hi all,

I built a homebrewn TV output wing, which could be an interesting replacement for the VGA+jack outputs of the arcade kit. It's a very simple R-2R ladder 6 bit DAC for the video line, and a plain wire for the audio (the DAC must be implemented through logic)

You can very easily output B/W video, and colors with some efforts :

IMAG0111.jpg

The schematics :

341915789.jpg

You should use R=115 ohms and 2R=230 ohms to get 0.3V from "010000" (black) on the input and 1.0V from "110000" (white), the remaining "001111" being left for color modulation at high luminance.

A picture of the homemade prototype :

341919423.jpg

You can see I used 120 and 240 ohms resistors. That's incorrect, but it only affects slightly luminance and saturation , not hue, so the resulting picture looks fine.

I attach some VHDL code, for the PAL encoder and the audio DAC. You should use a 64 MHz clock in the PAL encoder : you could adapt the code for 32MHz, but then you'll get heavy dot crawl.

EDIT: phase reversal does work. I just made a stupid mistake in the java program that generated the yuv tables, inverting red and blue...

Best,

Ben

tv_output.zip

Share this post


Link to post
Share on other sites

Ben,

This is great, does it work for NTSC too or just PAL?

BTW, the schematic attachment isn't showing.

This is something that would be great to add to the Papilio Playground. The password to modify the Playground is: papilio

Jack.

Share this post


Link to post
Share on other sites

As the theory is  the same, it should work for NTSC, but you'll have to change the timings: the vertical/horizontal sync (not included in the code) and the color clock (included in the PAL encoder) are all different.

More precisely, you should change the constant 145 281 to 117 285 to get colors (thanks to the 3.579545 MHz color clock), and adapt the  burst phase (U=+1,V=0 ?) to get the right colors. You might want to change the timings of the colour burst as well.

I have not tested any of that, but I'd be glad to know if this works.

If I can find the time, I'll build a sample "color bar" project that works on PAL and NTSC.

For the pictures: I used twitpic, which obviously was a bad idea -- I'll edit the post. You don't miss much, though : it's a plain R-2R ladder for bits 1-6 to the video RCA, and a wire from bit 7 to the audio RCA.

Share this post


Link to post
Share on other sites

If I can find the time, I'll build a sample "color bar" project that works on PAL and NTSC.

Here it is -- that was quicker than expected.

Compile this, plug your tv_output wing in A8-A15 and enjoy 8 color bars in the middle of the screen: yellow, cyan, green,magenta,red, blue, black and white. And overscan is grey.

IMAG0116.jpg

You can switch in main.vhd between pal and ntsc (*_video to produce the correct sync, *_encoder to transform rgb to quadrature modulated yuv)

I found why my PAL implementation did not work (I swapped red and blue in the uv tables indices...), so I fixed it, and built a quick and dirty NTSC implementation from that.

PAL image is ok although not that good: low sat on yellow and cyan, some dot crawl.

NTSC is poor, although saturation is better: horizontal stripes (interference between h sync and color carrier), strong dot crawl (although you might not notice it because it scrolls vertically really fast) -- you might make it better through adjusting the color carrier clock. More bits ?

I'll put something on the playground when I find the time.

tv_output.zip

Share this post


Link to post
Share on other sites

Looking closer at the schematic I realized you were accomplishing this without a transistor! Wow, awesome work.

I put together a quick Wing design in EAGLE. My question is if pin 0 is ground?

TV_Wing_Schematic.png

TV_Wing_Assembly.png

Jack.

BPW5035-TV-Video-V1.0.zip

Share this post


Link to post
Share on other sites

My question is if pin 0 is ground?

For the sake of simplicity in my prototype, yes. But it shouldn't be, there is a ground pin right next to it. If you aim a quality, you should definitely use pin 0 as a 7th bit for the DAC.

As the voltages change luminance and saturation, but not hue, that might not improve that much palettized images such as the ones generated by the 64 colors example provided. The quality of the color modulation, at least in my implementation, is poorer at this stage (dot crawl, color balance etc.)

Still, that would leave room for  ambitious B/W projects (32 levels of grey only with the 6 bits prototype) or space for better color implementations.

So, "professional" wings should definitely use this 7th bit. And you might want to add a low pass filter on that audio pin as well !

(my guess was the electronics in the TV filter out the megahertz artefact ferquencies of the DAC, but that's a bist nasty)

EDIT: looking at the eagle files, I can see you dit add a low pass filtre -- great. Slight correction : the last resistor (the one connected to ground) is a 2R=230 resistor. I found some SIL R-2R networks that might make a wing easier to make, but I doubt you could find the exact value for R -- you could use a lower value, and add a series resistor.

Share this post


Link to post
Share on other sites

Ok, I just updated the last message with the schematic and assembly drawings.

I did indeed add a low pass filter. :)

In the schematic drawing it looked like pin 0 was connected to the shield of the RCA jacks so I assumed pin 0 must be connected to ground...

So it sounds like it would be better to connect the shield of the RCA jack and the gnd side of the low pass filters cap to gnd instead of bit 0?

Jack.

Share this post


Link to post
Share on other sites

So it sounds like it would be better to connect the shield of the RCA jack and the gnd side of the low pass filters cap to gnd instead of bit 0?

Exactly. And add two resistors to make bit 0 the 7th bit of the dac -- the provided code should still work (it forces it to 0)

Share this post


Link to post
Share on other sites

Ok, how does this updated schematic look?

Jack.

post-3-13431627474885.png

Share this post


Link to post
Share on other sites

Ok, how does this updated schematic look?

Looks fine to me on the video part.

Thinking again, I have strong doubts on the audio part: 3.3k seems really high. If the TV impedance is 75 ohms (I did not test it, but that's the value for the video), then you are dividing voltage by 45 ! 330+47nF would seem more reasonable, then.

This deserve some testing. I do not have many capacitors to play with, but I'll give it a try tomorrow (it's past midnight in France...)

Share this post


Link to post
Share on other sites

Hey Ben,

Those are the values I've been using on the Audio Wings for some time now, the audio output seems to be really good to my ear. I've piped music out of the Audio Wings and it sounded like CD quality to me. :)

Jack.

Share this post


Link to post
Share on other sites

Those are the values I've been using on the Audio Wings for some time now, the audio output seems to be really good to my ear. I've piped music out of the Audio Wings and it sounded like CD quality to me. :)

No doubt about it in sound oriented hardware, such as earphones or computer speakers, but the input impedance of the TV might be different, though.

From what I found after a quick Google search, it seems this is in the kOhm range, so 3.3k is not that high.

Still, it seems plugging an audio output made for TV on computer speakers gives an extremely high volume (http://www.diyaudio.com/forums/parts/69215-whats-resistance-rca-inputs.html). Conversely, using output designed for computer speakers on a TV might give very low volume. As I am not exactly an expert in analog electronics, forgive me if what I write is silly...

Share this post


Link to post
Share on other sites

Oh, one more thing. I want to build one of these on a protoboard and record a video of it in action. :) The color bar will be awesome, but is there a bit file for anything else I can show?

Jack.

Share this post


Link to post
Share on other sites

I just uploaded the design to BatchPCB and ordered a board. I'm still working on my seller status but once I have it setup I'll make it available for purchase and update here.

Jack.

Share this post


Link to post
Share on other sites

Oh, one more thing. I want to build one of these on a protoboard and record a video of it in action. :) The color bar will be awesome, but is there a bit file for anything else I can show?

I'll update my Sega Master System project to use this wing and code (at this time, it uses RGB). Then, I'll build a quick SMS rom that show some text and pictures, and sings a small tune ! (music is copyrighted from Psycho Fox, but I'll take my chances for the demo)

An idea about the placement of the RCA jacks: I understand you don't have enough space to have them pointing out, but why not put the two of them on the same side ? you'd free space for the wing next to it.

And, looking at the board, I see that the input pins are reversed -- that's not a big issue, of course, but you'll have to change the code a bit to get it to work.

Ben

Share this post


Link to post
Share on other sites

Here it is, a demo for the "official" Papilio TV output wing :

IMAG0118.jpg

I attach the .bit file. It's PAL, and uses wing A2: A8 (ground) A9-A14 (video) and A15 (audio)

Jack : I added a 1k series resistor for the audio to limit the current, as there was lots of interferences between audio and video. Sound volume is fine (I had to turn it down a little), so the 3.3k resistor of your low pass filter should be just fine.

pal_demo.zip

Share this post


Link to post
Share on other sites

Yay! I got a prototype board built this weekend and I connected it to a tv, unfortunately I only have NTSC tv's but I was at least able to see the Papilio image flickering across the screen! Any possibility of getting a NTSC version, I want to get a video of this so people can see the coolness. I've never heard of this being done with just resistors, very impressive Ben. :)

Jack.

Share this post


Link to post
Share on other sites

I only have NTSC tv's but I was at least able to see the Papilio image flickering across the screen! Any possibility of getting a NTSC version, I want to get a video of this so people can see the coolness. I've never heard of this being done with just resistors, very impressive Ben. :)

Can you hear the music ? If not, there could be a difference between my ain't and your (wiring)

Perhaps you can try the color bars demo first, as you can easily modify it, to make sure you've got the wiring right. The Papilio demo is actually an Sms Rom, and my implementation is pal only at this stage. An Ntsc version is on my todo list, but this might take a while -- and I would really appreciate feedback on the Ntsc color bars, to make sure I got the tidings right (my tv seems very lax)

About the 'resistor only' : I've seen quite a few on the internet, built around pic or avr. They are of course very limited, but that's where the dogs magic comes into play. In my opinion the major breakthrough is the absence of external oscillator for the color carrier.

Share this post


Link to post
Share on other sites

Ok, I just did some more testing and I can hear the music just fine, I can see the Papilio screen with the PAL release but it is not in color and it keeps moving.

I built the color bar demo for NTSC and loaded the bit file, but it does not show anything at all on the TV...

Jack.

Share this post


Link to post
Share on other sites

Any possibility of getting a NTSC version, I want to get a video of this so people can see the coolness. I've never heard of this being done with just resistors, very impressive Ben. :)

I implemented a pal/ntsc switch on my sega master system. can you try this one ? it's for 500k, and the TV signal is output on C8-C15.

BTW, I corrected the NTSC color carrier frequency (I originally got my calculations wrong), and the image is much better now.

ntsc.zip

Share this post


Link to post
Share on other sites

Excellent! It works! I just tested it out and it looks good! I will try to post a video tomorrow.

Jack.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now