The current TVout library for arduino (which is great) uses 2 pins for video generation. I came up with a way to make use of the ATmega’s tri-stated pins to create a (potentially) single-pin NTSC renderer.

Referring to Generating Video with an AVR, I determined if you only want black and white (no gray!) you only need 3 voltages: 0V, 0.3V, and 1V. A tri-stated pin can have, as the name implies, 3 states: high, low, and hi-z input, which can be though of as no connection. With only two common resistors (820? and 330?),* the aforementioned 3 voltages can be created:

To create 1.0V (white), the pin is set to 5V (820? resistor bypassed, voltage divider is only 330? and internal 75?)

To create 0.3V (black), the pin is set to hi-z (voltage divider becomes (820+330 in series) and internal 75?)

To create 0.0V (sync), the pin is set to 0V (820? shunted to ground, 0V at output)

*most TVs contain a 75? resistor from the NTSC input to ground. This resistor is used in the voltage divider.

I have attached a plaintext file containing the code for the circuit, anyone who has falstad’s circuit simulator can try it for themselves. (choose file → import and paste in the code).

I am yet to try this in practice, and I don’t know if the arduino is fast enough. However, this could possibly be implemented into TVout if it does work and save one pin and some confusion (which resistors goes where?).



onepin.txt (611 Bytes)

Don't forget the 4th state: Hi-z with internal pull-up. :)

Yes... i thought of that. But the pull up resistor has very low precision: 20k? minimum; 50k? maximum. Assuming that it is "supposed" to be a 35k? resistor (midpoint of min & max), that would be about a ±35% resistor! Because of this, we can't assume it to be accurate, and it can't really be used to out benefit beside pulling up to voltage to 5V, but a high output accomplishes the same thing.


Does it work when incorporated into TVout? I could see the need to modify two separate ports (data and "direction") as changing the timing compared to only needing to modify one port...

I haven't tried it yet with TVout, but the library will most likely need to be redone to incorporate this idea (if its worth it...).