Tuesday, March 19, 2013

Connecting Arduino Pro (3.3V/8Mhz) to TV

In this post I’m going to connect my home made  Arduino Pro clone to the television using composite input on the TV. I found a good library called arduino-tvout, but had to modify the hardware a bit to run with 3.3V board as the hardware connections shown in the library site is for 5V systems. Let’ s check the process part by part.

TV connector module:


As the arduino-tvout library wiki has connections for a 5V system,I had to modify it as follows. If you have an idea about composite signals you can understand the modification.

The original connection is like this (Source),

The internal termination impedance of a composite input of a TV is 75Ω. So at 5V,considering only sync resistor, Vid = (75)/(1000+75) * 5V = 0.35V . Actually a standard composite sync level is 0.3V and I used a 680Ω resistor instead of 1kΩ resistor. So, Vid=(75)/(680+75) * 3.3V = 0.33V. Same for the video resistor. As Vid= (75)/(470+75) * 5V = 0.69V, I used a 270Ω resistor to get Vid= (75)/(270+75) * 3.3V = 0.72V. So my TV module’s circuit is as follows and I built this on a veroboard (Cost Rs:25/ $0.2)

image

Arduino Board:


I’m using my Techduino Pro board which I build on an earlier post along with the my modified CP2102 USB to UART board. Please note that my Arduino is working at 3.3V.

Connections:


I connected the two boards as follows, You can get Arduino –> ATMEGA328 pinout from here.

TV Module Arduino
Sync Pin 9 (Pin15/PB1 on chip)
Video Pin 7 (Pin13/PD7 on chip)
GND GND

DSCF5803_640x480

DSCF5800_640x480

Code:

First of all you have to download the arduino-tvout library from here and extract it into your Arduino IDE’s library folder. I used TVOutBeta1 version for testing. Then I tested this simple code (later I tried a simple counter too). You can get full documentation from the library’s documentation. I tested various resolutions but most of them had synchronization problems(may be due to 8Mhz clock,this library is designed for 16MHz clock systems). I found out that 48*36 resolution in PAL system worked well for me.

#include <TVout.h>
#include <fontALL.h>

TVout TV;

void setup() {
  TV.begin(PAL,48,36);
  TV.clear_screen();
  TV.select_font(font4x6);
  TV.println(0,0,"Hello");
  TV.println(4,12,"incrediblediy.com");
  TV.delay(5000);
}

void loop() {

  }

Testing:

I have tested the circuit on 2 TVs and it worked on the both for 48*36 resolution in PAL system. As I mentioned for other resolutions I got vertical synchronization problems.(May be able to fixing by playing with library headers, I didn’t check yet)

Testing on a CRT TV,

DSCF5791_640x480

Testing on a LED 3DTV,

DSCF5810_640x480

2 comments: